|
|
9119d9 |
From 6b34e105829caf93a230b41f43200b036061638d Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <6b34e105829caf93a230b41f43200b036061638d@dist-git>
|
|
|
9119d9 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
9119d9 |
Date: Thu, 11 Dec 2014 13:28:10 +0100
|
|
|
9119d9 |
Subject: [PATCH] Ignore CPU features without a model for host-passthrough
|
|
|
9119d9 |
|
|
|
9119d9 |
This fixes reverting to snapshots created by older libvirt
|
|
|
9119d9 |
and allows libvirt not to lose track of a domain that
|
|
|
9119d9 |
has this in its live status XML (such as a domain
|
|
|
9119d9 |
restored from managedsave)
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1030793
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1151885
|
|
|
9119d9 |
(cherry picked from commit 15abebdecb35308ddd4d2967efa6dffa4842fac9)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/conf/cpu_conf.c | 5 ++
|
|
|
9119d9 |
...argv-cpu-host-passthrough-features-invalid.args | 22 +++++++++
|
|
|
9119d9 |
...2argv-cpu-host-passthrough-features-invalid.xml | 55 ++++++++++++++++++++++
|
|
|
9119d9 |
tests/qemuxml2argvtest.c | 1 +
|
|
|
9119d9 |
4 files changed, 83 insertions(+)
|
|
|
9119d9 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.args
|
|
|
9119d9 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.xml
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
|
|
9119d9 |
index 72555a7..95e04c7 100644
|
|
|
9119d9 |
--- a/src/conf/cpu_conf.c
|
|
|
9119d9 |
+++ b/src/conf/cpu_conf.c
|
|
|
9119d9 |
@@ -365,6 +365,11 @@ virCPUDefParseXML(xmlNodePtr node,
|
|
|
9119d9 |
goto error;
|
|
|
9119d9 |
|
|
|
9119d9 |
if (n > 0) {
|
|
|
9119d9 |
+ if (!def->model && def->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
|
|
|
9119d9 |
+ /* silently ignore incorrectly formatted features generated
|
|
|
9119d9 |
+ * by older libvirt */
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
if (!def->model && def->mode != VIR_CPU_MODE_HOST_MODEL) {
|
|
|
9119d9 |
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
9119d9 |
_("Non-empty feature list specified without "
|
|
|
9119d9 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.args
|
|
|
9119d9 |
new file mode 100644
|
|
|
9119d9 |
index 0000000..18c1dce
|
|
|
9119d9 |
--- /dev/null
|
|
|
9119d9 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.args
|
|
|
9119d9 |
@@ -0,0 +1,22 @@
|
|
|
9119d9 |
+LC_ALL=C \
|
|
|
9119d9 |
+PATH=/bin \
|
|
|
9119d9 |
+HOME=/home/test \
|
|
|
9119d9 |
+USER=test \
|
|
|
9119d9 |
+LOGNAME=test \
|
|
|
9119d9 |
+QEMU_AUD\
|
|
|
9119d9 |
+IO_DRV=none \
|
|
|
9119d9 |
+/usr/bin/qemu \
|
|
|
9119d9 |
+-S \
|
|
|
9119d9 |
+-M pc \
|
|
|
9119d9 |
+-cpu host \
|
|
|
9119d9 |
+-m 214 \
|
|
|
9119d9 |
+-smp 1 \
|
|
|
9119d9 |
+-nographic \
|
|
|
9119d9 |
+-monitor unix:/tmp/test-monitor,server,nowait \
|
|
|
9119d9 |
+-no-acpi \
|
|
|
9119d9 |
+-boot c \
|
|
|
9119d9 |
+-usb \
|
|
|
9119d9 |
+-hda /dev/HostVG/QEMUGuest1 \
|
|
|
9119d9 |
+-net none \
|
|
|
9119d9 |
+-serial none \
|
|
|
9119d9 |
+-parallel none
|
|
|
9119d9 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.xml
|
|
|
9119d9 |
new file mode 100644
|
|
|
9119d9 |
index 0000000..b5f5326
|
|
|
9119d9 |
--- /dev/null
|
|
|
9119d9 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-passthrough-features-invalid.xml
|
|
|
9119d9 |
@@ -0,0 +1,55 @@
|
|
|
9119d9 |
+<domain type='kvm'>
|
|
|
9119d9 |
+ <name>QEMUGuest1</name>
|
|
|
9119d9 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
9119d9 |
+ <title>A description of the test machine.</title>
|
|
|
9119d9 |
+ <description>
|
|
|
9119d9 |
+ A test of qemu's minimal configuration.
|
|
|
9119d9 |
+ This test also tests the description and title elements.
|
|
|
9119d9 |
+ </description>
|
|
|
9119d9 |
+ <memory unit='KiB'>219100</memory>
|
|
|
9119d9 |
+ <currentMemory unit='KiB'>219100</currentMemory>
|
|
|
9119d9 |
+ <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
|
|
9119d9 |
+ <os>
|
|
|
9119d9 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
9119d9 |
+ <boot dev='hd'/>
|
|
|
9119d9 |
+ </os>
|
|
|
9119d9 |
+ <cpu mode='host-passthrough'>
|
|
|
9119d9 |
+ <feature policy='require' name='abm'/>
|
|
|
9119d9 |
+ <feature policy='require' name='pdpe1gb'/>
|
|
|
9119d9 |
+ <feature policy='require' name='rdrand'/>
|
|
|
9119d9 |
+ <feature policy='require' name='f16c'/>
|
|
|
9119d9 |
+ <feature policy='require' name='osxsave'/>
|
|
|
9119d9 |
+ <feature policy='require' name='pdcm'/>
|
|
|
9119d9 |
+ <feature policy='require' name='xtpr'/>
|
|
|
9119d9 |
+ <feature policy='require' name='tm2'/>
|
|
|
9119d9 |
+ <feature policy='require' name='est'/>
|
|
|
9119d9 |
+ <feature policy='require' name='smx'/>
|
|
|
9119d9 |
+ <feature policy='require' name='vmx'/>
|
|
|
9119d9 |
+ <feature policy='require' name='ds_cpl'/>
|
|
|
9119d9 |
+ <feature policy='require' name='monitor'/>
|
|
|
9119d9 |
+ <feature policy='require' name='dtes64'/>
|
|
|
9119d9 |
+ <feature policy='require' name='pbe'/>
|
|
|
9119d9 |
+ <feature policy='require' name='tm'/>
|
|
|
9119d9 |
+ <feature policy='require' name='ht'/>
|
|
|
9119d9 |
+ <feature policy='require' name='ss'/>
|
|
|
9119d9 |
+ <feature policy='require' name='acpi'/>
|
|
|
9119d9 |
+ <feature policy='require' name='ds'/>
|
|
|
9119d9 |
+ <feature policy='require' name='vme'/>
|
|
|
9119d9 |
+ </cpu>
|
|
|
9119d9 |
+ <clock offset='utc'/>
|
|
|
9119d9 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
9119d9 |
+ <on_reboot>restart</on_reboot>
|
|
|
9119d9 |
+ <on_crash>destroy</on_crash>
|
|
|
9119d9 |
+ <devices>
|
|
|
9119d9 |
+ <emulator>/usr/bin/qemu</emulator>
|
|
|
9119d9 |
+ <disk type='block' device='disk'>
|
|
|
9119d9 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
9119d9 |
+ <target dev='hda' bus='ide'/>
|
|
|
9119d9 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
9119d9 |
+ </disk>
|
|
|
9119d9 |
+ <controller type='usb' index='0'/>
|
|
|
9119d9 |
+ <controller type='ide' index='0'/>
|
|
|
9119d9 |
+ <controller type='pci' index='0' model='pci-root'/>
|
|
|
9119d9 |
+ <memballoon model='virtio'/>
|
|
|
9119d9 |
+ </devices>
|
|
|
9119d9 |
+</domain>
|
|
|
9119d9 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
9119d9 |
index 967760a..595b658 100644
|
|
|
9119d9 |
--- a/tests/qemuxml2argvtest.c
|
|
|
9119d9 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
9119d9 |
@@ -1490,6 +1490,7 @@ mymain(void)
|
|
|
9119d9 |
DO_TEST_FAILURE("shmem-invalid-size", NONE);
|
|
|
9119d9 |
DO_TEST_FAILURE("shmem-small-size", NONE);
|
|
|
9119d9 |
DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
|
|
|
9119d9 |
+ DO_TEST("cpu-host-passthrough-features-invalid", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
|
|
|
9119d9 |
|
|
|
9119d9 |
virObjectUnref(driver.config);
|
|
|
9119d9 |
virObjectUnref(driver.caps);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.2.0
|
|
|
9119d9 |
|