[PATCH v13 14/49] extract general code from qemuDomainReAttachHostdevDevices

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

 



Extract general code from qemuDomainReAttachHostdevDevicesi
to virHostdevReAttachPCIDevices

Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 src/qemu/qemu_hostdev.c |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index bbc85bc..74923a1 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -1299,22 +1299,19 @@ qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
     virPCIDeviceFree(dev);
 }
 
-
-void
-qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
-                                 const char *name,
-                                 virDomainHostdevDefPtr *hostdevs,
-                                 int nhostdevs)
+/* @oldStateDir:
+ * For upgrade purpose: see virHostdevNetConfigRestore
+ */
+static void
+virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
+                             const char *name,
+                             virDomainHostdevDefPtr *hostdevs,
+                             int nhostdevs,
+                             char *oldStateDir)
 {
     virPCIDeviceListPtr pcidevs;
     size_t i;
-    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
-    char *oldStateDir = cfg->stateDir;
-    virHostdevManagerPtr hostdev_mgr;
 
-    hostdev_mgr = virHostdevManagerGetDefault();
-    if (hostdev_mgr == NULL)
-        goto out;
     virObjectLock(hostdev_mgr->activePciHostdevs);
     virObjectLock(hostdev_mgr->inactivePciHostdevs);
 
@@ -1388,6 +1385,26 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
 cleanup:
     virObjectUnlock(hostdev_mgr->activePciHostdevs);
     virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
+
+}
+
+void
+qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
+                                 const char *name,
+                                 virDomainHostdevDefPtr *hostdevs,
+                                 int nhostdevs)
+{
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+    char *oldStateDir = cfg->stateDir;
+    virHostdevManagerPtr hostdev_mgr;
+
+    hostdev_mgr = virHostdevManagerGetDefault();
+    if (hostdev_mgr == NULL)
+        goto out;
+
+    virHostdevReAttachPCIDevices(hostdev_mgr, name,
+                                 hostdevs, nhostdevs, oldStateDir);
+
 out:
     virObjectUnref(cfg);
 }
-- 
1.6.0.2

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