提交 e3c9e3a3 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

qemu_hostdev: move ColdBoot as a flag

For extracting hostdev codes from qemu_hostdev.c to common library, change qemu
specific COLD_BOOT handling to be a flag, and pass it to hostdev functions.
上级 3a331da8
...@@ -1003,13 +1003,14 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, ...@@ -1003,13 +1003,14 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
bool coldBoot) unsigned int flags)
{ {
size_t i; size_t i;
int ret = -1; int ret = -1;
virUSBDeviceListPtr list; virUSBDeviceListPtr list;
virUSBDevicePtr tmp; virUSBDevicePtr tmp;
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
bool coldBoot = !!(flags & VIR_HOSTDEV_COLD_BOOT);
/* To prevent situation where USB device is assigned to two domains /* To prevent situation where USB device is assigned to two domains
* we need to keep a list of currently assigned USB devices. * we need to keep a list of currently assigned USB devices.
...@@ -1201,7 +1202,6 @@ int ...@@ -1201,7 +1202,6 @@ int
qemuPrepareHostDevices(virQEMUDriverPtr driver, qemuPrepareHostDevices(virQEMUDriverPtr driver,
virDomainDefPtr def, virDomainDefPtr def,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
bool coldBoot,
unsigned int flags) unsigned int flags)
{ {
if (!def->nhostdevs) if (!def->nhostdevs)
...@@ -1213,7 +1213,7 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver, ...@@ -1213,7 +1213,7 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
return -1; return -1;
if (qemuPrepareHostUSBDevices(driver, def->name, if (qemuPrepareHostUSBDevices(driver, def->name,
def->hostdevs, def->nhostdevs, coldBoot) < 0) def->hostdevs, def->nhostdevs, flags) < 0)
return -1; return -1;
if (qemuPrepareHostdevSCSIDevices(driver, def->name, if (qemuPrepareHostdevSCSIDevices(driver, def->name,
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
typedef enum { typedef enum {
VIR_HOSTDEV_STRICT_ACS_CHECK = (1 << 0), /* strict acs check */ VIR_HOSTDEV_STRICT_ACS_CHECK = (1 << 0), /* strict acs check */
VIR_HOSTDEV_COLD_BOOT = (1 << 1), /* cold boot */
} virHostdevFlag; } virHostdevFlag;
int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver, int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
...@@ -51,7 +52,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, ...@@ -51,7 +52,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
bool coldBoot); unsigned int flags);
int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver, int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
...@@ -59,7 +60,6 @@ int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver, ...@@ -59,7 +60,6 @@ int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
int qemuPrepareHostDevices(virQEMUDriverPtr driver, int qemuPrepareHostDevices(virQEMUDriverPtr driver,
virDomainDefPtr def, virDomainDefPtr def,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
bool coldBoot,
unsigned int flags); unsigned int flags);
void void
qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver, qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver,
......
...@@ -3687,8 +3687,10 @@ int qemuProcessStart(virConnectPtr conn, ...@@ -3687,8 +3687,10 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Preparing host devices"); VIR_DEBUG("Preparing host devices");
if (!cfg->relaxedACS) if (!cfg->relaxedACS)
hostdev_flags |= VIR_HOSTDEV_STRICT_ACS_CHECK; hostdev_flags |= VIR_HOSTDEV_STRICT_ACS_CHECK;
if (!migrateFrom)
hostdev_flags |= VIR_HOSTDEV_COLD_BOOT;
if (qemuPrepareHostDevices(driver, vm->def, priv->qemuCaps, if (qemuPrepareHostDevices(driver, vm->def, priv->qemuCaps,
!migrateFrom, hostdev_flags) < 0) hostdev_flags) < 0)
goto cleanup; goto cleanup;
VIR_DEBUG("Preparing chr devices"); VIR_DEBUG("Preparing chr devices");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册