mirror of https://gitee.com/openkylin/libvirt.git
fix a module dependency problem
* src/node_device.[ch] src/storage_backend.[ch]: fixes a module dependency problem, patch by Dave Allan Daniel
This commit is contained in:
parent
502278d5b2
commit
c0b64e9daa
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jun 17 10:31:35 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/node_device.[ch] src/storage_backend.[ch]: fixes a
|
||||||
|
module dependency problem, patch by Dave Allan
|
||||||
|
|
||||||
Tue Jun 16 14:30:05 EDT 2009 Cole Robinson <crobinso@redhat.com>
|
Tue Jun 16 14:30:05 EDT 2009 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
* src/domain_conf.c
|
* src/domain_conf.c
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "node_device_conf.h"
|
#include "node_device_conf.h"
|
||||||
#include "node_device.h"
|
#include "node_device.h"
|
||||||
|
#include "storage_backend.h" /* For virWaitForDevices */
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
||||||
|
|
||||||
|
@ -560,7 +561,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
|
||||||
|
|
||||||
while ((now - start) < LINUX_NEW_DEVICE_WAIT_TIME) {
|
while ((now - start) < LINUX_NEW_DEVICE_WAIT_TIME) {
|
||||||
|
|
||||||
virNodeDeviceWaitForDevices(conn);
|
virWaitForDevices(conn);
|
||||||
|
|
||||||
dev = nodeDeviceLookupByWWN(conn, wwnn, wwpn);
|
dev = nodeDeviceLookupByWWN(conn, wwnn, wwpn);
|
||||||
|
|
||||||
|
@ -694,32 +695,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)
|
void registerCommonNodeFuncs(virDeviceMonitorPtr driver)
|
||||||
{
|
{
|
||||||
driver->numOfDevices = nodeNumOfDevices;
|
driver->numOfDevices = nodeNumOfDevices;
|
||||||
|
|
|
@ -53,6 +53,4 @@ void registerCommonNodeFuncs(virDeviceMonitorPtr mon);
|
||||||
|
|
||||||
int nodedevRegister(void);
|
int nodedevRegister(void);
|
||||||
|
|
||||||
void virNodeDeviceWaitForDevices(virConnectPtr conn);
|
|
||||||
|
|
||||||
#endif /* __VIR_NODE_DEVICE_H__ */
|
#endif /* __VIR_NODE_DEVICE_H__ */
|
||||||
|
|
|
@ -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
|
virStorageBackendPtr
|
||||||
virStorageBackendForType(int type) {
|
virStorageBackendForType(int type) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -259,7 +285,7 @@ virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
|
||||||
|
|
||||||
void virStorageBackendWaitForDevices(virConnectPtr conn)
|
void virStorageBackendWaitForDevices(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virNodeDeviceWaitForDevices(conn);
|
virWaitForDevices(conn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,3 +694,4 @@ virStorageBackendRunProgNul(virConnectPtr conn,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -111,4 +111,6 @@ int virStorageBackendRunProgNul(virConnectPtr conn,
|
||||||
virStorageBackendListVolNulFunc func,
|
virStorageBackendListVolNulFunc func,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
|
void virWaitForDevices(virConnectPtr conn);
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_H__ */
|
||||||
|
|
Loading…
Reference in New Issue