diff --git a/8910e063-arch-caps.patch b/8910e063-arch-caps.patch new file mode 100644 index 0000000..48dd06a --- /dev/null +++ b/8910e063-arch-caps.patch @@ -0,0 +1,260 @@ +commit 8910e063dbafc09695b2100c80213be569abb7ef +Author: Cole Robinson +Date: Wed May 6 18:32:05 2015 -0400 + + caps: Fix regression defaulting to host arch + + My commit 747761a79 (v1.2.15 only) dropped this bit of logic when filling + in a default arch in the XML: + + - /* First try to find one matching host arch */ + - for (i = 0; i < caps->nguests; i++) { + - if (caps->guests[i]->ostype == ostype) { + - for (j = 0; j < caps->guests[i]->arch.ndomains; j++) { + - if (caps->guests[i]->arch.domains[j]->type == domain && + - caps->guests[i]->arch.id == caps->host.arch) + - return caps->guests[i]->arch.id; + - } + - } + - } + + That attempt to match host.arch is important, otherwise we end up + defaulting to i686 on x86_64 host for KVM, which is not intended. + Duplicate it in the centralized CapsLookup function. + + Additionally add some testcases that would have caught this. + + https://bugzilla.redhat.com/show_bug.cgi?id=1219191 + +Index: libvirt-1.2.15/src/conf/capabilities.c +=================================================================== +--- libvirt-1.2.15.orig/src/conf/capabilities.c ++++ libvirt-1.2.15/src/conf/capabilities.c +@@ -607,25 +607,13 @@ virCapsDomainDataCompare(virCapsGuestPtr + return true; + } + +-/** +- * virCapabilitiesDomainDataLookup: +- * @caps: capabilities to query +- * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE +- * @arch: Architecture to search for +- * @domaintype: domain type to search for, of enum VIR_DOMAIN_VIRT +- * @emulator: Emulator path to search for +- * @machinetype: Machine type to search for +- * +- * Search capabilities for the passed values, and if found return +- * virCapabilitiesDomainDataLookup filled in with the default values +- */ +-virCapsDomainDataPtr +-virCapabilitiesDomainDataLookup(virCapsPtr caps, +- int ostype, +- virArch arch, +- int domaintype, +- const char *emulator, +- const char *machinetype) ++static virCapsDomainDataPtr ++virCapabilitiesDomainDataLookupInternal(virCapsPtr caps, ++ int ostype, ++ virArch arch, ++ int domaintype, ++ const char *emulator, ++ const char *machinetype) + { + virCapsGuestPtr foundguest = NULL; + virCapsGuestDomainPtr founddomain = NULL; +@@ -730,6 +718,43 @@ virCapabilitiesDomainDataLookup(virCapsP + return ret; + } + ++/** ++ * virCapabilitiesDomainDataLookup: ++ * @caps: capabilities to query ++ * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE ++ * @arch: Architecture to search for ++ * @domaintype: domain type to search for, of enum VIR_DOMAIN_VIRT ++ * @emulator: Emulator path to search for ++ * @machinetype: Machine type to search for ++ * ++ * Search capabilities for the passed values, and if found return ++ * virCapabilitiesDomainDataLookup filled in with the default values ++ */ ++virCapsDomainDataPtr ++virCapabilitiesDomainDataLookup(virCapsPtr caps, ++ int ostype, ++ virArch arch, ++ int domaintype, ++ const char *emulator, ++ const char *machinetype) ++{ ++ virCapsDomainDataPtr ret; ++ ++ if (arch == VIR_ARCH_NONE) { ++ /* Prefer host arch if its available */ ++ ret = virCapabilitiesDomainDataLookupInternal(caps, ostype, ++ caps->host.arch, ++ domaintype, ++ emulator, machinetype); ++ if (ret) ++ return ret; ++ } ++ ++ return virCapabilitiesDomainDataLookupInternal(caps, ostype, ++ arch, domaintype, ++ emulator, machinetype); ++} ++ + static int + virCapabilitiesFormatNUMATopology(virBufferPtr buf, + size_t ncells, +Index: libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args +=================================================================== +--- /dev/null ++++ libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args +@@ -0,0 +1,4 @@ ++LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ ++/usr/bin/kvm -S -machine pc,accel=kvm -m 4096 -smp 4 -nographic \ ++-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -net none \ ++-serial none -parallel none +Index: libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml +=================================================================== +--- /dev/null ++++ libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml +@@ -0,0 +1,11 @@ ++ ++ kvm ++ d091ea82-29e6-2e34-3005-f02617b36e87 ++ 4194304 ++ 4194304 ++ 4 ++ ++ hvm ++ ++ ++ +Index: libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.args +=================================================================== +--- /dev/null ++++ libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.args +@@ -0,0 +1,4 @@ ++LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-x86_64 -S -machine pc-0.11,accel=tcg -m 4096 -smp 4 \ ++-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ ++-usb -net none -serial none -parallel none +Index: libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.xml +=================================================================== +--- /dev/null ++++ libvirt-1.2.15/tests/qemuxml2argvdata/qemuxml2argv-default-qemu-host-arch.xml +@@ -0,0 +1,11 @@ ++ ++ qemu-host ++ d091ea82-29e6-2e34-3005-f02617b36e87 ++ 4194304 ++ 4194304 ++ 4 ++ ++ hvm ++ ++ ++ +Index: libvirt-1.2.15/tests/qemuxml2argvtest.c +=================================================================== +--- libvirt-1.2.15.orig/tests/qemuxml2argvtest.c ++++ libvirt-1.2.15/tests/qemuxml2argvtest.c +@@ -595,6 +595,8 @@ mymain(void) + DO_TEST("machine-usb-opt", QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_USB_OPT); + DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT); ++ DO_TEST("default-kvm-host-arch", QEMU_CAPS_MACHINE_OPT); ++ DO_TEST("default-qemu-host-arch", QEMU_CAPS_MACHINE_OPT); + DO_TEST("boot-cdrom", NONE); + DO_TEST("boot-network", NONE); + DO_TEST("boot-floppy", NONE); +Index: libvirt-1.2.15/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml +=================================================================== +--- /dev/null ++++ libvirt-1.2.15/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml +@@ -0,0 +1,21 @@ ++ ++ kvm ++ d091ea82-29e6-2e34-3005-f02617b36e87 ++ 4194304 ++ 4194304 ++ 4 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/kvm ++ ++ ++ ++ ++ +Index: libvirt-1.2.15/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml +=================================================================== +--- /dev/null ++++ libvirt-1.2.15/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-qemu-host-arch.xml +@@ -0,0 +1,21 @@ ++ ++ qemu-host ++ d091ea82-29e6-2e34-3005-f02617b36e87 ++ 4194304 ++ 4194304 ++ 4 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-x86_64 ++ ++ ++ ++ ++ +Index: libvirt-1.2.15/tests/qemuxml2xmltest.c +=================================================================== +--- libvirt-1.2.15.orig/tests/qemuxml2xmltest.c ++++ libvirt-1.2.15/tests/qemuxml2xmltest.c +@@ -346,6 +346,8 @@ mymain(void) + DO_TEST("minimal"); + DO_TEST("machine-core-on"); + DO_TEST("machine-core-off"); ++ DO_TEST_DIFFERENT("default-kvm-host-arch"); ++ DO_TEST_DIFFERENT("default-qemu-host-arch"); + DO_TEST("boot-cdrom"); + DO_TEST("boot-network"); + DO_TEST("boot-floppy"); +Index: libvirt-1.2.15/tests/testutilsqemu.c +=================================================================== +--- libvirt-1.2.15.orig/tests/testutilsqemu.c ++++ libvirt-1.2.15/tests/testutilsqemu.c +@@ -354,6 +354,18 @@ virCapsPtr testQemuCapsInit(void) + NULL) == NULL) + goto cleanup; + ++ if ((machines = testQemuAllocMachines(&nmachines)) == NULL) ++ goto cleanup; ++ ++ if (virCapabilitiesAddGuestDomain(guest, ++ VIR_DOMAIN_VIRT_KVM, ++ "/usr/bin/qemu-kvm", ++ NULL, ++ nmachines, ++ machines) == NULL) ++ goto cleanup; ++ machines = NULL; ++ + if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL) + goto cleanup; + diff --git a/libvirt.changes b/libvirt.changes index c8c5e62..cb23576 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed May 20 08:29:00 UTC 2015 - dmacvicar@suse.de + +- qemu: fix regression defaulting to host arch + 8910e063-arch-caps.patch + rhb#1219191 + ------------------------------------------------------------------- Wed May 6 09:51:21 MDT 2015 - jfehlig@suse.com diff --git a/libvirt.spec b/libvirt.spec index 8effdd6..1b9373d 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -445,6 +445,7 @@ Source5: polkit-10-virt.rules Source99: baselibs.conf # Upstream patches Patch0: c0d3f608-libxl-soundhw.patch +Patch1: 8910e063-arch-caps.patch # Patches pending upstream review # Need to go upstream Patch150: xen-pv-cdrom.patch @@ -975,6 +976,7 @@ Provides a dissector for the libvirt RPC protocol to help debugging it. %prep %setup -q %patch0 -p1 +%patch1 -p1 %patch150 -p1 %patch151 -p1 %patch152 -p1