On Mon, 2014-02-17 at 14:32 +0800, Chunyan Liu wrote: > 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. > > Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> > --- > src/qemu/qemu_hostdev.c | 6 +++--- > src/qemu/qemu_hostdev.h | 2 +- > src/qemu/qemu_process.c | 4 +++- > 3 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c > index 0d313c0..ce5012d 100644 > --- a/src/qemu/qemu_hostdev.c > +++ b/src/qemu/qemu_hostdev.c > @@ -992,7 +992,7 @@ out: > static int > qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, > virDomainDefPtr def, > - bool coldBoot) > + unsigned int flags) > { > size_t i; > int ret = -1; > @@ -1000,6 +1000,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, > virUSBDevicePtr tmp; > virDomainHostdevDefPtr *hostdevs = def->hostdevs; > int nhostdevs = def->nhostdevs; > + bool coldBoot = !!(flags & VIR_COLD_BOOT); > > /* To prevent situation where USB device is assigned to two domains > * we need to keep a list of currently assigned USB devices. > @@ -1189,7 +1190,6 @@ int > qemuPrepareHostDevices(virQEMUDriverPtr driver, > virDomainDefPtr def, > virQEMUCapsPtr qemuCaps, > - bool coldBoot, > unsigned int flags) > { > if (!def->nhostdevs) > @@ -1200,7 +1200,7 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver, > qemuCaps, flags) < 0) > return -1; > > - if (qemuPrepareHostUSBDevices(driver, def, coldBoot) < 0) > + if (qemuPrepareHostUSBDevices(driver, def, flags) < 0) > return -1; > > if (qemuPrepareHostdevSCSIDevices(driver, def->name, > diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h > index ab7fb9f..710867d 100644 > --- a/src/qemu/qemu_hostdev.h > +++ b/src/qemu/qemu_hostdev.h > @@ -29,6 +29,7 @@ > > typedef enum { > VIR_STRICT_ACS_CHECK = (1 << 0), /* strict acs check */ > + VIR_COLD_BOOT = (1 << 1), /* cold boot */ > } qemuHostdevFlag; > > int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver, > @@ -59,7 +60,6 @@ int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver, > int qemuPrepareHostDevices(virQEMUDriverPtr driver, > virDomainDefPtr def, > virQEMUCapsPtr qemuCaps, > - bool coldBoot, > unsigned int flags); > void qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver, > const char *name, > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c > index c0f0719..f1fe35e 100644 > --- a/src/qemu/qemu_process.c > +++ b/src/qemu/qemu_process.c > @@ -3688,8 +3688,10 @@ int qemuProcessStart(virConnectPtr conn, > VIR_DEBUG("Preparing host devices"); > if (!cfg->relaxedACS) > hostdev_flags |= VIR_STRICT_ACS_CHECK; > + if (!migrateFrom) > + hostdev_flags |= VIR_COLD_BOOT; > if (qemuPrepareHostDevices(driver, vm->def, priv->qemuCaps, > - !migrateFrom, hostdev_flags) < 0) > + hostdev_flags) < 0) > goto cleanup; > > VIR_DEBUG("Preparing chr devices"); ACK -- Cedric -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list