d76c62
From a620d42d440828f1f978a75c01a9515d0c131721 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <a620d42d440828f1f978a75c01a9515d0c131721@dist-git>
d76c62
From: Jiri Denemark <jdenemar@redhat.com>
d76c62
Date: Thu, 20 Feb 2020 09:08:04 +0100
d76c62
Subject: [PATCH] qemuxml2xmltest: Add case for host-model vendor_id
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
This patch shows a bug in our code: the
d76c62
d76c62
    <model vendor_id="Libvirt QEMU"/>
d76c62
d76c62
element present in the source XML is lost when the parsed CPU definition
d76c62
is formatted back to XML.
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804549
d76c62
d76c62
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 1939fbef989e6990cb5dd2d2d7ff8ea002c517c2)
d76c62
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
d76c62
Message-Id: <cef7f3e28619a9fc306f17eddaa6d81df5ce21c2.1582186015.git.jdenemar@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 .../cpu-host-model-vendor.xml                 | 28 +++++++++++++++++++
d76c62
 tests/qemuxml2xmltest.c                       |  1 +
d76c62
 2 files changed, 29 insertions(+)
d76c62
 create mode 100644 tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
d76c62
d76c62
diff --git a/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml b/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
d76c62
new file mode 100644
d76c62
index 0000000000..d2447ccd10
d76c62
--- /dev/null
d76c62
+++ b/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
d76c62
@@ -0,0 +1,28 @@
d76c62
+<domain type='qemu'>
d76c62
+  <name>QEMUGuest1</name>
d76c62
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
d76c62
+  <memory unit='KiB'>219100</memory>
d76c62
+  <currentMemory unit='KiB'>219100</currentMemory>
d76c62
+  <vcpu placement='static'>6</vcpu>
d76c62
+  <os>
d76c62
+    <type arch='x86_64' machine='pc'>hvm</type>
d76c62
+    <boot dev='network'/>
d76c62
+  </os>
d76c62
+  <cpu mode='host-model' check='partial'/>
d76c62
+  <clock offset='utc'/>
d76c62
+  <on_poweroff>destroy</on_poweroff>
d76c62
+  <on_reboot>restart</on_reboot>
d76c62
+  <on_crash>destroy</on_crash>
d76c62
+  <devices>
d76c62
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
d76c62
+    <controller type='usb' index='0'>
d76c62
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
d76c62
+    </controller>
d76c62
+    <controller type='pci' index='0' model='pci-root'/>
d76c62
+    <input type='mouse' bus='ps2'/>
d76c62
+    <input type='keyboard' bus='ps2'/>
d76c62
+    <memballoon model='virtio'>
d76c62
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
d76c62
+    </memballoon>
d76c62
+  </devices>
d76c62
+</domain>
d76c62
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
d76c62
index a3c7f8fd47..7c105e5207 100644
d76c62
--- a/tests/qemuxml2xmltest.c
d76c62
+++ b/tests/qemuxml2xmltest.c
d76c62
@@ -266,6 +266,7 @@ mymain(void)
d76c62
     DO_TEST("cpu-host-kvmclock", NONE);
d76c62
     DO_TEST("cpu-host-passthrough-features", NONE);
d76c62
     DO_TEST("cpu-host-model-features", NONE);
d76c62
+    DO_TEST("cpu-host-model-vendor", NONE);
d76c62
     DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY);
d76c62
     DO_TEST("kvmclock", NONE);
d76c62
     DO_TEST("clock-timer-hyperv-rtc", NONE);
d76c62
-- 
d76c62
2.25.0
d76c62