[PATCH v14 09/49] qemu_hostdev: move ColdBoot as a flag

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

 



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 | 4 ++--
 src/qemu/qemu_process.c | 4 +++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 32b5921..72d84c8 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -1003,13 +1003,14 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
                           const char *name,
                           virDomainHostdevDefPtr *hostdevs,
                           int nhostdevs,
-                          bool coldBoot)
+                          unsigned int flags)
 {
     size_t i;
     int ret = -1;
     virUSBDeviceListPtr list;
     virUSBDevicePtr tmp;
     virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+    bool coldBoot = !!(flags & VIR_HOSTDEV_COLD_BOOT);
 
     /* To prevent situation where USB device is assigned to two domains
      * we need to keep a list of currently assigned USB devices.
@@ -1201,7 +1202,6 @@ int
 qemuPrepareHostDevices(virQEMUDriverPtr driver,
                        virDomainDefPtr def,
                        virQEMUCapsPtr qemuCaps,
-                       bool coldBoot,
                        unsigned int flags)
 {
     if (!def->nhostdevs)
@@ -1213,7 +1213,7 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
         return -1;
 
     if (qemuPrepareHostUSBDevices(driver, def->name,
-                                  def->hostdevs, def->nhostdevs, coldBoot) < 0)
+                                  def->hostdevs, def->nhostdevs, flags) < 0)
         return -1;
 
     if (qemuPrepareHostdevSCSIDevices(driver, def->name,
diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h
index d0ed82f..7c4e95a 100644
--- a/src/qemu/qemu_hostdev.h
+++ b/src/qemu/qemu_hostdev.h
@@ -29,6 +29,7 @@
 
 typedef enum {
     VIR_HOSTDEV_STRICT_ACS_CHECK     = (1 << 0), /* strict acs check */
+    VIR_HOSTDEV_COLD_BOOT            = (1 << 1), /* cold boot */
 } virHostdevFlag;
 
 int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
@@ -51,7 +52,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
                           const char *name,
                           virDomainHostdevDefPtr *hostdevs,
                           int nhostdevs,
-                          bool coldBoot);
+                          unsigned int flags);
 int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
                                   const char *name,
                                   virDomainHostdevDefPtr *hostdevs,
@@ -59,7 +60,6 @@ int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
 int qemuPrepareHostDevices(virQEMUDriverPtr driver,
                            virDomainDefPtr def,
                            virQEMUCapsPtr qemuCaps,
-                           bool coldBoot,
                            unsigned int flags);
 void
 qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 5e7672f..7d71e9e 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_HOSTDEV_STRICT_ACS_CHECK;
+    if (!migrateFrom)
+        hostdev_flags |= VIR_HOSTDEV_COLD_BOOT;
     if (qemuPrepareHostDevices(driver, vm->def, priv->qemuCaps,
-                               !migrateFrom, hostdev_flags) < 0)
+                               hostdev_flags) < 0)
         goto cleanup;
 
     VIR_DEBUG("Preparing chr devices");
-- 
1.9.0

--
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]