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