[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/2]: Call udevsettle in the appropriate places



Alan Pevec wrote:
> On Thu, Nov 27, 2008 at 8:53 AM, Chris Lalancette <clalance redhat com
> <mailto:clalance redhat com>> wrote:
> 
>     Right, both points make sense.  I think the following patch should
>     address it; I
>     only conditionally set the UDEVADM variable if I find it.  So, for
>     machines
>     without it, the meat of virStorageBackendWaitForDevices is compiled
>     out.  In
>     places where I've found it on the build machine, I then do "access" for
>     executable at runtime, and only if that succeeds do I run it.  Does
>     that seem
>     correct?  In addition, based on the comment from Guido, I changed it
>     over to use
>     "udevadm settle" instead of "udevsettle".
> 
> 
> Please make it try both: RHEL5 has an ancient udev095 and doesn't have
> udevadm but it does have udevsettle

Sigh.  Silly older distros :).  Thanks for the heads up, though, good to know it
now rather than later.  Unfortunately, it's not so easy to make it try both; we
would get into a twisty passage of #ifdef's, I think.  Dan, what do you think of
the attached patch for older udev compatibility?

-- 
Chris Lalancette
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.188
diff -u -r1.188 configure.in
--- configure.in	28 Nov 2008 07:50:20 -0000	1.188
+++ configure.in	28 Nov 2008 14:50:11 -0000
@@ -117,6 +117,8 @@
 	[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
 AC_PATH_PROG([UDEVADM], [udevadm], [],
 	[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
+AC_PATH_PROG([UDEVSETTLE], [udevsettle], [],
+	[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
 
 AC_DEFINE_UNQUOTED([DNSMASQ],["$DNSMASQ"],
         [Location or name of the dnsmasq program])
@@ -126,6 +128,10 @@
   AC_DEFINE_UNQUOTED([UDEVADM],["$UDEVADM"],
         [Location or name of the udevadm program])
 fi
+if test -n "$UDEVSETTLE"; then
+  AC_DEFINE_UNQUOTED([UDEVSETTLE],["$UDEVSETTLE"],
+        [Location or name of the udevsettle program])
+fi
 
 dnl Specific dir for HTML output ?
 AC_ARG_WITH([html-dir], [AC_HELP_STRING([--with-html-dir=path],
Index: src/storage_backend.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend.c,v
retrieving revision 1.31
diff -u -r1.31 storage_backend.c
--- src/storage_backend.c	28 Nov 2008 07:50:20 -0000	1.31
+++ src/storage_backend.c	28 Nov 2008 14:50:11 -0000
@@ -287,6 +287,23 @@
      */
     virRun(conn, settleprog, &exitstatus);
 }
+#elif defined(UDEVSETTLE)
+void virStorageBackendWaitForDevices(virConnectPtr conn)
+{
+    const char *const settleprog[] = { UDEVSETTLE, NULL };
+    int exitstatus;
+
+    if (access(UDEVSETTLE, X_OK) != 0)
+        return;
+
+    /*
+     * NOTE: we ignore errors here; this is just to make sure that any device
+     * nodes that are being created finish before we try to scan them.
+     * If this fails for any reason, we still have the backup of polling for
+     * 5 seconds for device nodes.
+     */
+    virRun(conn, settleprog, &exitstatus);
+}
 #else
 void virStorageBackendWaitForDevices(virConnectPtr conn ATTRIBUTE_UNUSED) {}
 #endif

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]