Re: [libvirt] Problem compiling latest code from libvirt CVS

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

 



Daniel P. Berrange wrote:
On Fri, Jun 05, 2009 at 12:08:13PM -0400, Dave Allan wrote:
Daniel P. Berrange wrote:
<snip>
which is failing because neither of the node device driver implementations
are turned on.

This is a bug in the storage_backend.c file. This is a generic shared file
and as such, it should not have any dependancy on the node device driver code, since the latter is guarenteed to be available.
I'd split out this code to avoid duplication, but I'll refactor it again to avoid the dependency on the node device code & submit a patch.

Simply having the dependancy reversed should be OK. storage_backend.c
is a shared file always available to drivers.

Daniel

Here's a patch that should remove the dependency on the node device code.

Dave

>From 1795bd359faf85b887893492e3b80c033ddd06b2 Mon Sep 17 00:00:00 2001
From: David Allan <dallan@xxxxxxxxxx>
Date: Fri, 5 Jun 2009 13:38:35 -0400
Subject: [PATCH 1/1] Fix build failure when building without node device code

---
 src/node_device.c     |   29 ++---------------------------
 src/node_device.h     |    2 --
 src/storage_backend.c |   29 ++++++++++++++++++++++++++++-
 src/storage_backend.h |    2 ++
 4 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/src/node_device.c b/src/node_device.c
index cd9fb6e..787d720 100644
--- a/src/node_device.c
+++ b/src/node_device.c
@@ -34,6 +34,7 @@
 #include "logging.h"
 #include "node_device_conf.h"
 #include "node_device.h"
+#include "storage_backend.h" /* For virWaitForDevices */
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
 
@@ -505,7 +506,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
 
     while ((now - start) < LINUX_NEW_DEVICE_WAIT_TIME) {
 
-        virNodeDeviceWaitForDevices(conn);
+        virWaitForDevices(conn);
 
         dev = nodeDeviceLookupByWWN(conn, wwnn, wwpn);
 
@@ -639,32 +640,6 @@ out:
 }
 
 
-#if defined(UDEVADM) || defined(UDEVSETTLE)
-void virNodeDeviceWaitForDevices(virConnectPtr conn)
-{
-#ifdef UDEVADM
-    const char *const settleprog[] = { UDEVADM, "settle", NULL };
-#else
-    const char *const settleprog[] = { UDEVSETTLE, NULL };
-#endif
-    int exitstatus;
-
-    if (access(settleprog[0], 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 virNodeDeviceWaitForDevices(virConnectPtr conn ATTRIBUTE_UNUSED) {}
-#endif
-
-
 void registerCommonNodeFuncs(virDeviceMonitorPtr driver)
 {
     driver->numOfDevices = nodeNumOfDevices;
diff --git a/src/node_device.h b/src/node_device.h
index 882ba0f..db01624 100644
--- a/src/node_device.h
+++ b/src/node_device.h
@@ -53,6 +53,4 @@ void registerCommonNodeFuncs(virDeviceMonitorPtr mon);
 
 int nodedevRegister(void);
 
-void virNodeDeviceWaitForDevices(virConnectPtr conn);
-
 #endif /* __VIR_NODE_DEVICE_H__ */
diff --git a/src/storage_backend.c b/src/storage_backend.c
index d731a23..953928e 100644
--- a/src/storage_backend.c
+++ b/src/storage_backend.c
@@ -96,6 +96,32 @@ static virStorageBackendPtr backends[] = {
 };
 
 
+#if defined(UDEVADM) || defined(UDEVSETTLE)
+void virWaitForDevices(virConnectPtr conn)
+{
+#ifdef UDEVADM
+    const char *const settleprog[] = { UDEVADM, "settle", NULL };
+#else
+    const char *const settleprog[] = { UDEVSETTLE, NULL };
+#endif
+    int exitstatus;
+
+    if (access(settleprog[0], 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 virWaitForDevices(virConnectPtr conn ATTRIBUTE_UNUSED) {}
+#endif
+
+
 virStorageBackendPtr
 virStorageBackendForType(int type) {
     unsigned int i;
@@ -259,7 +285,7 @@ virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
 
 void virStorageBackendWaitForDevices(virConnectPtr conn)
 {
-    virNodeDeviceWaitForDevices(conn);
+    virWaitForDevices(conn);
     return;
 }
 
@@ -668,3 +694,4 @@ virStorageBackendRunProgNul(virConnectPtr conn,
     return -1;
 }
 #endif
+
diff --git a/src/storage_backend.h b/src/storage_backend.h
index 7bf8814..a3f441c 100644
--- a/src/storage_backend.h
+++ b/src/storage_backend.h
@@ -111,4 +111,6 @@ int virStorageBackendRunProgNul(virConnectPtr conn,
                                 virStorageBackendListVolNulFunc func,
                                 void *data);
 
+void virWaitForDevices(virConnectPtr conn);
+
 #endif /* __VIR_STORAGE_BACKEND_H__ */
-- 
1.6.0.6

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]