[PATCH v3 5/6] qemuhotplugtest: add testcase to update a disk device

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

 



Since we can now use qemuDomainUpdateDeviceLiveAndConfig in tests,
updating more types of devices can be tested now.

One particular testcase was previously expected to trivially fail
because there was no way to test updating a disk device. Since now
it's possible to execute it, I modified it to make it work.
---
 tests/qemuhotplugtest.c                                          | 9 ++-------
 tests/qemuhotplugtestdevices/qemuhotplug-disk-cdrom-nochange.xml | 2 +-
 tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml          | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 115dc1e..0bb4fe6 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -164,13 +164,9 @@ testQemuHotplugUpdate(virDomainObjPtr vm,
 {
     int ret = -1;
 
-    /* XXX Ideally, we would call qemuDomainUpdateDeviceLive here.  But that
-     * would require us to provide virConnectPtr and virDomainPtr (they're used
-     * in case of updating a disk device. So for now, we will proceed with
-     * breaking the function into pieces. If we ever learn how to fake those
-     * required object, we can replace this code then. */
     switch (dev->type) {
     case VIR_DOMAIN_DEVICE_GRAPHICS:
+    case VIR_DOMAIN_DEVICE_DISK:
         /* conn is only used for storage lookup, so passing NULL should be safe. */
         ret = qemuDomainUpdateDeviceLiveAndConfig(NULL, vm, &driver,
                                                   device_xml, impact);
@@ -485,8 +481,7 @@ mymain(void)
     DO_TEST_UPDATE_LIVE("graphics-spice", "graphics-spice-listen", true, false, NULL);
     DO_TEST_UPDATE_LIVE("graphics-spice-listen-network", "graphics-spice-listen-network-password", false, false,
                         "set_password", QMP_OK, "expire_password", QMP_OK);
-    /* Strange huh? Currently, only graphics can be updated :-P */
-    DO_TEST_UPDATE_LIVE("disk-cdrom", "disk-cdrom-nochange", true, false, NULL);
+    DO_TEST_UPDATE_LIVE("disk-cdrom", "disk-cdrom-nochange", false, false, NULL);
 
     DO_TEST_ATTACH_LIVE("console-compat-2-live", "console-virtio", false, true,
                         "chardev-add", "{\"return\": {\"pty\": \"/dev/pts/26\"}}",
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-disk-cdrom-nochange.xml b/tests/qemuhotplugtestdevices/qemuhotplug-disk-cdrom-nochange.xml
index 26841ea..ad2f9a6 100644
--- a/tests/qemuhotplugtestdevices/qemuhotplug-disk-cdrom-nochange.xml
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-disk-cdrom-nochange.xml
@@ -1,6 +1,6 @@
     <disk type='block' device='disk'>
       <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <source dev='/dev/null'/>
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml
index 04f4976..89ca23e 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml
@@ -16,7 +16,7 @@
     <emulator>/usr/bin/qemu</emulator>
     <disk type='block' device='disk'>
       <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <source dev='/dev/null'/>
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-- 
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]