[libvirt] [PATCH v3 6/6] qemuhotplugtest: add a persistent attachment testcase

Tomasz Flendrich t.flendrich at gmail.com
Thu Jul 28 19:54:01 UTC 2016


This is the first testcase for attaching and detaching a device
to the persistent domain.
---
 tests/qemuhotplugtest.c                            |  7 ++++
 .../qemuhotplug-qemu-agent.xml                     |  1 -
 .../qemuhotplug-base-config+qemu-agent+config.xml  | 44 ++++++++++++++++++++++
 .../qemuhotplug-base-config.xml                    | 40 ++++++++++++++++++++
 4 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-config+qemu-agent+config.xml
 create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-config.xml

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 0bb4fe6..f26aedd 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -626,6 +626,13 @@ mymain(void)
                         "human-monitor-command", HMP("OK\\r\\n"),
                         "device_add", QMP_OK);
 
+    DO_TEST_ATTACH_CONFIG("base-config", "qemu-agent", false, true,
+                   "chardev-add", QMP_OK,
+                   "device_add", QMP_OK);
+    DO_TEST_DETACH_CONFIG("base-config", "qemu-agent", false, false,
+                   "device_del", QMP_OK,
+                   "chardev-remove", QMP_OK);
+
     qemuTestDriverFree(&driver);
     return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent.xml b/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent.xml
index f0e90de..648da4b 100644
--- a/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent.xml
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent.xml
@@ -1,5 +1,4 @@
     <channel type='unix'>
-      <source mode='bind'/>
       <target type='virtio' name='org.qemu.guest_agent.0'/>
       <address type='virtio-serial' controller='0' bus='0' port='1'/>
     </channel>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-config+qemu-agent+config.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-config+qemu-agent+config.xml
new file mode 100644
index 0000000..94dc934
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-config+qemu-agent+config.xml
@@ -0,0 +1,44 @@
+<domain type='kvm'>
+  <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/libexec/qemu-kvm</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <channel type='unix'>
+      <target type='virtio' name='org.qemu.guest_agent.0'/>
+      <address type='virtio-serial' controller='0' bus='0' port='1'/>
+    </channel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+  <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-config.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-config.xml
new file mode 100644
index 0000000..20ad0a5
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-config.xml
@@ -0,0 +1,40 @@
+<domain type='kvm'>
+  <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/libexec/qemu-kvm</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+  <seclabel type='none' model='none'/>
+</domain>
-- 
1.9.1




More information about the libvir-list mailing list