On 11/15/19 4:14 PM, Jiri Denemark wrote:
On Fri, Nov 15, 2019 at 15:55:04 +0100, Christian Borntraeger wrote:
>
>
> On 15.11.19 15:47, Jiri Denemark wrote:
>> On Fri, Nov 15, 2019 at 15:12:18 +0100, Boris Fiuczynski wrote:
>>> Just a heads up.
>>> After installing libvirt rpms of this branch all my existing kvm s390
>>> domains ended up with
>>>
>>> <cpu mode='custom' match='exact'
check='none'>
>>> <model fallback='forbid'>qemu</model>
>>> </cpu>
>>>
>>> Newly defined domains without specified cpu do so as well.
>>
>> Unless the domains are all TCG, it seems your QEMU is too old. You need
>> a fairly recent one which contains commit v4.1.0-1683-gde60a92ea7
>> (s390x/kvm: Set default cpu model for all machine classes)
>>
>> I the domains all use KVM and you have new enough QEMU, there might be a
>> bug somewhere. Which should not happen :=)
>
> So shouldnt libvirt fence this rework (add default model) to qemu 4.2 and newer?
Libvirt does all this only if query-machines returns default-cpu-type,
which is introduced in 4.2. But since it was introduced earlier, anyone
using qemu from git between the two commits will see this behavior.
Somewhat similar thing will happen on ppc64, but even with the current
master. Everything should be OK once QEMU 4.2.0 final release is used,
though (since it will contain all required patches).
Jirka
I tested with a newer version of qemu and it worked as you outlined.
After that I also tested with qemu v4.1.0. I was a bit surprised at
first that a default host-model cpu was generated since I though it
would only be done when the qemu has the commit your specified above.
After reading your patch 4 the generation is tied to the cpu-model
support in qemu. Since this became available on s390 with qemu v2.8.0 I
created an additional test patch just to ensure that we do not lose
backwards compatibility.
I also attached the patch if below does not work out.
=======
From: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Date: Mon, 18 Nov 2019 17:41:02 +0100
Subject: [PATCH] qemuxml2*test: Add test cases for not setting default CPU
models on s390
Adding tests for QEMU v2.7.0 which was the last version without CPU model
support on s390 to ensure the default CPU model is not automatically added.
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
...lt-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.args | 29 +++++++++++++++++++
.../s390-default-cpu-kvm-ccw-virtio-2.7.xml | 16 ++++++++++
tests/qemuxml2argvtest.c | 1 +
...ult-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.xml | 23 +++++++++++++++
tests/qemuxml2xmltest.c | 1 +
5 files changed, 70 insertions(+)
create mode 100644
tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.args
create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml
create mode 100644
tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.xml
diff --git a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.args
b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.args
new file mode 100644
index 0000000000..431de90bcc
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.args
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-test \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-test/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-test/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-test/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x \
+-name guest=test,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-test/master-key.aes \
+-machine s390-ccw-virtio-2.7,accel=kvm,usb=off,dump-guest-core=off \
+-m 256 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-test/monitor.sock,server,nowait
\
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0000 \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml
b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml
new file mode 100644
index 0000000000..5051c861ee
--- /dev/null
+++ b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml
@@ -0,0 +1,16 @@
+<domain type='kvm'>
+ <name>test</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory>262144</memory>
+ <currentMemory>262144</currentMemory>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index e3e2bc5e63..753c588f95 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3031,6 +3031,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-3.1",
"ppc64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-4.2",
"ppc64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-4.2",
"ppc64");
+ DO_TEST_CAPS_ARCH_VER("s390-default-cpu-kvm-ccw-virtio-2.7",
"s390x", "2.7.0");
DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-4.2",
"s390x");
DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-4.2",
"s390x");
DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-kvm-pc-4.2",
"x86_64");
diff --git a/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.xml
b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.xml
new file mode 100644
index 0000000000..9ae5356bf3
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-2.7.0.xml
@@ -0,0 +1,23 @@
+<domain type='kvm'>
+ <name>test</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x'
machine='s390-ccw-virtio-2.7'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0'
devno='0x0000'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 64a6971740..9bf1969047 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1349,6 +1349,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-3.1",
"ppc64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-4.2",
"ppc64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-4.2",
"ppc64");
+ DO_TEST_CAPS_ARCH_VER("s390-default-cpu-kvm-ccw-virtio-2.7",
"s390x", "2.7.0");
DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-4.2",
"s390x");
DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-4.2",
"s390x");
DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-kvm-pc-4.2",
"x86_64");
--
2.21.0
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294