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