From 01ecee247a4b172d89c90e13c433e47d89bb2283 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 30 Apr 2015 11:10:16 +0200 Subject: [PATCH] cpu: Honor vendor_id override in host-model https://bugzilla.redhat.com/show_bug.cgi?id=858147 Signed-off-by: Jiri Denemark --- src/cpu/cpu_x86.c | 6 ++++++ .../qemuxml2argv-cpu-host-model-vendor.args | 20 ++++++++++++++++++ .../qemuxml2argv-cpu-host-model-vendor.xml | 21 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 48 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.xml diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index bf1867bd4d..2a147058c6 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2107,6 +2107,12 @@ x86UpdateHostModel(virCPUDefPtr guest, if (virCPUDefCopyModel(guest, host, true) < 0) goto cleanup; + if (oldguest->vendor_id) { + VIR_FREE(guest->vendor_id); + if (VIR_STRDUP(guest->vendor_id, oldguest->vendor_id) < 0) + goto cleanup; + } + /* Remove non-migratable features by default * Note: this only works as long as no CPU model contains non-migratable * features directly */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.args new file mode 100644 index 0000000000..5d67d554d6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-S \ +-M pc \ +-cpu 'core2duo,vendor=Libvirt QEMU,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,\ ++ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds' \ +-m 214 \ +-smp 6 \ +-nographic \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot n \ +-usb \ +-net none \ +-serial none \ +-parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.xml new file mode 100644 index 0000000000..a33362f251 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-vendor.xml @@ -0,0 +1,21 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 6 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0763068c6b..670465e309 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1245,6 +1245,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_SMP_TOPOLOGY); DO_TEST("cpu-host-model", NONE); + DO_TEST("cpu-host-model-vendor", NONE); skipLegacyCPUs = true; DO_TEST("cpu-host-model-fallback", NONE); DO_TEST_FAILURE("cpu-host-model-nofallback", NONE);