[PATCH 06/10] tests/qemuhotplugtest: Add transient disk hotplug test

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

 



From: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx>

Add disk hotplug test for <transient/> disk option. The tests check
virtio and scsi bus disk hotplug.

Signed-off-by: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx>
---
 tests/qemuhotplugtest.c                       | 66 +++++++++++++++++++
 .../qemuhotplug-disk-scsi-transient.xml       |  7 ++
 .../qemuhotplug-disk-virtio-transient.xml     |  7 ++
 ...lug-transient-live+disk-scsi-transient.xml | 65 ++++++++++++++++++
 ...g-transient-live+disk-virtio-transient.xml | 65 ++++++++++++++++++
 .../qemuhotplug-transient-live.xml            | 51 ++++++++++++++
 6 files changed, 261 insertions(+)
 create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-transient.xml
 create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-disk-virtio-transient.xml
 create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-scsi-transient.xml
 create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-virtio-transient.xml
 create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-transient-live.xml

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 6750b33d51..0668a11da5 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -694,6 +694,18 @@ mymain(void)
     "    }" \
     "}\r\n"
 
+
+#define QMP_JOB_CONCLUDED(id) \
+    "{"\
+    "    \"return\": [{"\
+    "        \"current-progress\": 1,"\
+    "        \"status\": \"concluded\","\
+    "        \"total-progress\": 1,"\
+    "        \"type\": \"create\","\
+    "        \"id\": \"" id "\""\
+    "    }]"\
+    "}"
+
     cfg->spiceTLS = true;
     DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, 0, NULL);
     DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false, 0,
@@ -867,6 +879,60 @@ mymain(void)
     DO_TEST_DETACH("base-live", "guestfwd", false, false, 0,
                    "netdev_del", QMP_OK);
 
+    DO_TEST_ATTACH("transient-live", "disk-virtio-transient", false, true,
+                   QEMU_CAPS_BLOCKDEV,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-create", QMP_OK,
+                   "query-jobs", QMP_JOB_CONCLUDED("create-libvirt-1-format"),
+                   "job-dismiss", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "device_add", QMP_OK);
+
+    DO_TEST_DETACH("transient-live", "disk-virtio-transient", true, true,
+                   QEMU_CAPS_BLOCKDEV,
+                   "device_del", QMP_OK);
+
+    DO_TEST_DETACH("transient-live", "disk-virtio-transient", false, false,
+                   QEMU_CAPS_BLOCKDEV,
+                   "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
+
+    DO_TEST_ATTACH("transient-live", "disk-scsi-transient", false, true,
+                   QEMU_CAPS_BLOCKDEV,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-create", QMP_OK,
+                   "query-jobs", QMP_JOB_CONCLUDED("create-libvirt-1-format"),
+                   "job-dismiss", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
+                   "device_add", QMP_OK);
+
+    DO_TEST_DETACH("transient-live", "disk-scsi-transient", true, true,
+                   QEMU_CAPS_BLOCKDEV,
+                   "device_del", QMP_OK);
+
+    DO_TEST_DETACH("transient-live", "disk-scsi-transient", false, false,
+                   QEMU_CAPS_BLOCKDEV,
+                   "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
+
 #define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \
     do { \
         cpudata.test = prefix; \
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-transient.xml b/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-transient.xml
new file mode 100644
index 0000000000..5ef2a63016
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-disk-scsi-transient.xml
@@ -0,0 +1,7 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='raw' cache='none'/>
+  <source file='/dev/null'/>
+  <target dev='sdf' bus='scsi'/>
+  <shareable/>
+  <transient/>
+</disk>
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-disk-virtio-transient.xml b/tests/qemuhotplugtestdevices/qemuhotplug-disk-virtio-transient.xml
new file mode 100644
index 0000000000..76be133d84
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-disk-virtio-transient.xml
@@ -0,0 +1,7 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow2' cache='none'/>
+  <source file='/dev/null'/>
+  <target dev='vde' bus='virtio'/>
+  <shareable/>
+  <transient/>
+</disk>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-scsi-transient.xml b/tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-scsi-transient.xml
new file mode 100644
index 0000000000..a007dc992e
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-scsi-transient.xml
@@ -0,0 +1,65 @@
+<domain type='kvm' id='7'>
+  <name>hotplug</name>
+  <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/dev/null.TRANSIENT-hotplug' index='2'/>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/dev/null'/>
+        <backingStore/>
+      </backingStore>
+      <target dev='sdf' bus='scsi'/>
+      <shareable/>
+      <transient/>
+      <alias name='scsi0-0-0-5'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='5'/>
+    </disk>
+    <controller type='usb' index='0'>
+      <alias name='usb'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <alias name='ide'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <alias name='scsi0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <alias name='pci'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <alias name='virtio-serial0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <input type='mouse' bus='ps2'>
+      <alias name='input0'/>
+    </input>
+    <input type='keyboard' bus='ps2'>
+      <alias name='input1'/>
+    </input>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+  <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-virtio-transient.xml b/tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-virtio-transient.xml
new file mode 100644
index 0000000000..221a293878
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-transient-live+disk-virtio-transient.xml
@@ -0,0 +1,65 @@
+<domain type='kvm' id='7'>
+  <name>hotplug</name>
+  <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/dev/null.TRANSIENT-hotplug' index='2'/>
+      <backingStore type='file' index='3'>
+        <format type='qcow2'/>
+        <source file='/dev/null'/>
+        <backingStore/>
+      </backingStore>
+      <target dev='vde' bus='virtio'/>
+      <shareable/>
+      <transient/>
+      <alias name='virtio-disk4'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'>
+      <alias name='usb'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <alias name='ide'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <alias name='scsi0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <alias name='pci'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <alias name='virtio-serial0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <input type='mouse' bus='ps2'>
+      <alias name='input0'/>
+    </input>
+    <input type='keyboard' bus='ps2'>
+      <alias name='input1'/>
+    </input>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+  <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-transient-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-transient-live.xml
new file mode 100644
index 0000000000..a02bc39663
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-transient-live.xml
@@ -0,0 +1,51 @@
+<domain type='kvm' id='7'>
+  <name>hotplug</name>
+  <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0'>
+      <alias name='usb'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <alias name='ide'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <alias name='scsi0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <alias name='pci'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <alias name='virtio-serial0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <input type='mouse' bus='ps2'>
+      <alias name='input0'/>
+    </input>
+    <input type='keyboard' bus='ps2'>
+      <alias name='input1'/>
+    </input>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+  <seclabel type='none' model='none'/>
+</domain>
-- 
2.27.0




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

  Powered by Linux