Test that libvirt generates the correct cpu feature syntax when query-cpu-model-expansion is supported and when it is not. Signed-off-by: Jason J. Herne <jjherne@xxxxxxxxxxxxxxxxxx> --- .../qemuxml2argv-cpu-features-post-qcme.args | 19 ++++++++++++++++++ .../qemuxml2argv-cpu-features-post-qcme.xml | 23 ++++++++++++++++++++++ .../qemuxml2argv-cpu-features-pre-qcme.args | 19 ++++++++++++++++++ .../qemuxml2argv-cpu-features-pre-qcme.xml | 23 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 7 +++++++ 5 files changed, 91 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.args new file mode 100644 index 0000000..07abc93 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.args @@ -0,0 +1,19 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-kvm \ +-name guest1 \ +-S \ +-M s390-ccw-virtio \ +-cpu zEC12,dfppc=on,stckf=off \ +-m 214 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-guest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.xml new file mode 100644 index 0000000..47279c4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.xml @@ -0,0 +1,23 @@ +<domain type='kvm'> + <name>guest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <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> + <cpu mode='custom' match='exact'> + <model fallback='forbid'>zEC12</model> + <feature policy='require' name='dfppc'/> + <feature policy='disable' name='stckf'/> + </cpu> + <devices> + <emulator>/usr/bin/qemu-kvm</emulator> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args new file mode 100644 index 0000000..4622014 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args @@ -0,0 +1,19 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-kvm \ +-name guest1 \ +-S \ +-M s390-ccw-virtio \ +-cpu zEC12,+dfppc,-stckf \ +-m 214 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-guest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.xml new file mode 100644 index 0000000..47279c4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.xml @@ -0,0 +1,23 @@ +<domain type='kvm'> + <name>guest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <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> + <cpu mode='custom' match='exact'> + <model fallback='forbid'>zEC12</model> + <feature policy='require' name='dfppc'/> + <feature policy='disable' name='stckf'/> + </cpu> + <devices> + <emulator>/usr/bin/qemu-kvm</emulator> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bd2cdcb..1478d17 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1522,6 +1522,13 @@ mymain(void) qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X); DO_TEST("cpu-s390-zEC12", QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + + /* Cpu feature tests for both possible formats: + * Qemu < 2.8 : no query-cpu-model-expansion support : +/-feature format + * Qemu >= 2.8 : query-cpu-model-expansion support : feature=state format + */ + DO_TEST("cpu-features-post-qcme", QEMU_CAPS_KVM, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION); + DO_TEST("cpu-features-pre-qcme", QEMU_CAPS_KVM); qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE); qemuTestSetHostCPU(driver.caps, cpuHaswell); -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list