[PATCH v3 4/6] qemuhotplug: Use a more generic function to update devices

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

 



Previously, specific functions had to be used to test updating devices,
different for every device type. It was too much trouble and noone
bothered with it.
qemuDomainUpdateDeviceLiveAndConfig is now being used instead.
---
 src/qemu/qemu_driver.c     |  2 +-
 src/qemu/qemu_driverpriv.h |  7 +++++++
 tests/qemuhotplugtest.c    | 10 +++++++---
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f650766..b10efd4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8202,7 +8202,7 @@ static int qemuDomainAttachDevice(virDomainPtr dom, const char *xml)
                                        VIR_DOMAIN_AFFECT_LIVE);
 }
 
-static int
+int
 qemuDomainUpdateDeviceLiveAndConfig(virConnectPtr conn,
                                     virDomainObjPtr vm,
                                     virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_driverpriv.h b/src/qemu/qemu_driverpriv.h
index 943f0da..2a71a00 100644
--- a/src/qemu/qemu_driverpriv.h
+++ b/src/qemu/qemu_driverpriv.h
@@ -37,4 +37,11 @@ int qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
                                         const char *xml,
                                         unsigned int flags);
 
+int
+qemuDomainUpdateDeviceLiveAndConfig(virConnectPtr conn,
+                                    virDomainObjPtr vm,
+                                    virQEMUDriverPtr driver,
+                                    const char *xml,
+                                    unsigned int flags);
+
 #endif /* __QEMU_DRIVERPRIV_H__ */
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 13d2bdc..115dc1e 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -158,7 +158,9 @@ testQemuHotplugDetach(virDomainObjPtr vm,
 
 static int
 testQemuHotplugUpdate(virDomainObjPtr vm,
-                      virDomainDeviceDefPtr dev)
+                      virDomainDeviceDefPtr dev,
+                      const char *device_xml,
+                      virDomainModificationImpact impact)
 {
     int ret = -1;
 
@@ -169,7 +171,9 @@ testQemuHotplugUpdate(virDomainObjPtr vm,
      * required object, we can replace this code then. */
     switch (dev->type) {
     case VIR_DOMAIN_DEVICE_GRAPHICS:
-        ret = qemuDomainChangeGraphics(&driver, vm, dev->data.graphics);
+        /* conn is only used for storage lookup, so passing NULL should be safe. */
+        ret = qemuDomainUpdateDeviceLiveAndConfig(NULL, vm, &driver,
+                                                  device_xml, impact);
         break;
     default:
         VIR_TEST_VERBOSE("device type '%s' cannot be updated\n",
@@ -350,7 +354,7 @@ testQemuHotplug(const void *data)
         break;
 
     case UPDATE:
-        ret = testQemuHotplugUpdate(vm, dev);
+        ret = testQemuHotplugUpdate(vm, dev, device_xml, impact);
     }
 
  cleanup:
-- 
1.9.1

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