[libvirt] [PATCH 10/10] Add a persistent attachment testcase

Tomasz Flendrich t.flendrich at gmail.com
Sun Jul 10 04:57:17 UTC 2016


This is the first testcase for qemuhotplugtest for attaching and
detaching a device to the persistent domain.
---
 tests/qemuhotplugtest.c                            |  7 ++++
 .../qemuhotplug-base-config+qemu-agent+config.xml  | 45 ++++++++++++++++++++++
 .../qemuhotplug-base-config.xml                    | 40 +++++++++++++++++++
 3 files changed, 92 insertions(+)
 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 0244519..25bf406 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -606,6 +606,13 @@ mymain(void)
                    "human-monitor-command", HMP("OK\\r\\n"),
                    "device_add", QMP_OK);
 
+    DO_TEST_ATTACH("base-config", "qemu-agent", false, true, VIR_DOMAIN_AFFECT_CONFIG,
+                   "chardev-add", QMP_OK,
+                   "device_add", QMP_OK);
+    DO_TEST_DETACH("base-config", "qemu-agent", false, false, VIR_DOMAIN_AFFECT_CONFIG,
+                   "device_del", QMP_OK,
+                   "chardev-remove", QMP_OK);
+
     qemuTestDriverFree(&driver);
     return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
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..e209f67
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-config+qemu-agent+config.xml
@@ -0,0 +1,45 @@
+<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'>
+      <source mode='bind'/>
+      <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