c480ed
From 37dbf9fd0da8345ad03948543b9ae64954d219e1 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <37dbf9fd0da8345ad03948543b9ae64954d219e1@dist-git>
c480ed
From: Michal Privoznik <mprivozn@redhat.com>
c480ed
Date: Thu, 27 Jun 2019 14:44:48 +0200
c480ed
Subject: [PATCH] qemuhotplugtest: Test guestfwd attach and detach
c480ed
c480ed
Previous two commits demonstrate a hole in our test scenario.
c480ed
Fix that.
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Reviewed-by: John Ferlan <jferlan@redhat.com>
c480ed
(cherry picked from commit 17ddfd420a0dbcdd3f76fbecf7428acb301db188)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1624204
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Message-Id: <08fcf2bbdefa193065ecb3c28f8d5a5a61cfeb69.1561639408.git.mprivozn@redhat.com>
c480ed
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
---
c480ed
 tests/qemuhotplugtest.c                       |  6 ++
c480ed
 .../qemuhotplug-guestfwd.xml                  |  4 ++
c480ed
 .../qemuhotplug-base-live+guestfwd.xml        | 55 +++++++++++++++++++
c480ed
 3 files changed, 65 insertions(+)
c480ed
 create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml
c480ed
 create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml
c480ed
c480ed
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
c480ed
index 8e0086a269..aaa3492d4c 100644
c480ed
--- a/tests/qemuhotplugtest.c
c480ed
+++ b/tests/qemuhotplugtest.c
c480ed
@@ -836,6 +836,12 @@ mymain(void)
c480ed
     DO_TEST_DETACH("base-live", "watchdog-user-alias-full", false, false,
c480ed
                    "device_del", QMP_OK);
c480ed
 
c480ed
+    DO_TEST_ATTACH("base-live", "guestfwd", false, true,
c480ed
+                   "chardev-add", QMP_OK,
c480ed
+                   "netdev_add", QMP_OK);
c480ed
+    DO_TEST_DETACH("base-live", "guestfwd", false, false,
c480ed
+                   "netdev_del", QMP_OK);
c480ed
+
c480ed
 #define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \
c480ed
     do { \
c480ed
         cpudata.test = prefix; \
c480ed
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml b/tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml
c480ed
new file mode 100644
c480ed
index 0000000000..c67dbdb8df
c480ed
--- /dev/null
c480ed
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-guestfwd.xml
c480ed
@@ -0,0 +1,4 @@
c480ed
+<channel type='unix'>
c480ed
+  <source mode='bind' path='/tmp/guestfwd'/>
c480ed
+  <target type='guestfwd' address='10.0.2.1' port='4600'/>
c480ed
+</channel>
c480ed
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml
c480ed
new file mode 100644
c480ed
index 0000000000..8d7294123b
c480ed
--- /dev/null
c480ed
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+guestfwd.xml
c480ed
@@ -0,0 +1,55 @@
c480ed
+<domain type='kvm' id='7'>
c480ed
+  <name>hotplug</name>
c480ed
+  <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
c480ed
+  <memory unit='KiB'>4194304</memory>
c480ed
+  <currentMemory unit='KiB'>4194304</currentMemory>
c480ed
+  <vcpu placement='static'>4</vcpu>
c480ed
+  <os>
c480ed
+    <type arch='x86_64' machine='pc'>hvm</type>
c480ed
+    <boot dev='hd'/>
c480ed
+  </os>
c480ed
+  <features>
c480ed
+    <acpi/>
c480ed
+    <apic/>
c480ed
+    <pae/>
c480ed
+  </features>
c480ed
+  <clock offset='utc'/>
c480ed
+  <on_poweroff>destroy</on_poweroff>
c480ed
+  <on_reboot>restart</on_reboot>
c480ed
+  <on_crash>restart</on_crash>
c480ed
+  <devices>
c480ed
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
c480ed
+    <controller type='usb' index='0'>
c480ed
+      <alias name='usb'/>
c480ed
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
c480ed
+    </controller>
c480ed
+    <controller type='ide' index='0'>
c480ed
+      <alias name='ide'/>
c480ed
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
c480ed
+    </controller>
c480ed
+    <controller type='scsi' index='0' model='virtio-scsi'>
c480ed
+      <alias name='scsi0'/>
c480ed
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
c480ed
+    </controller>
c480ed
+    <controller type='pci' index='0' model='pci-root'>
c480ed
+      <alias name='pci'/>
c480ed
+    </controller>
c480ed
+    <controller type='virtio-serial' index='0'>
c480ed
+      <alias name='virtio-serial0'/>
c480ed
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
c480ed
+    </controller>
c480ed
+    <channel type='unix'>
c480ed
+      <source mode='bind' path='/tmp/guestfwd'/>
c480ed
+      <target type='guestfwd' address='10.0.2.1' port='4600'/>
c480ed
+      <alias name='channel0'/>
c480ed
+    </channel>
c480ed
+    <input type='mouse' bus='ps2'>
c480ed
+      <alias name='input0'/>
c480ed
+    </input>
c480ed
+    <input type='keyboard' bus='ps2'>
c480ed
+      <alias name='input1'/>
c480ed
+    </input>
c480ed
+    <memballoon model='none'/>
c480ed
+  </devices>
c480ed
+  <seclabel type='none' model='none'/>
c480ed
+</domain>
c480ed
-- 
c480ed
2.22.0
c480ed