qemu: fix QEMU_CAPS_NO_ACPI detection

In commit c4bbaaf8, caps->arch was checked uninitialized, rendering the
whole check useless.

This patch moves the conditional setting of QEMU_CAPS_NO_ACPI to
qemuCapsInitQMP, and removes the no longer needed exception for S390.

It also clears the flag for all non-x86 archs instead of just S390 in
qemuCapsInitHelp.
This commit is contained in:
Ján Tomko 2012-12-21 14:20:11 +01:00
parent 0995b00084
commit 31494974c4

View File

@ -2192,13 +2192,11 @@ qemuCapsInitHelp(qemuCapsPtr caps, uid_t runUid, gid_t runGid)
if (caps->arch == VIR_ARCH_X86_64 || if (caps->arch == VIR_ARCH_X86_64 ||
caps->arch == VIR_ARCH_I686) { caps->arch == VIR_ARCH_I686) {
qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS); qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS);
} } else {
/* -no-acpi is not supported on other archs
/* S390 and probably other archs do not support no-acpi - * even if qemu reports it in -help */
maybe the qemu option parsing should be re-thought. */
if (caps->arch == VIR_ARCH_S390 ||
caps->arch == VIR_ARCH_S390X)
qemuCapsClear(caps, QEMU_CAPS_NO_ACPI); qemuCapsClear(caps, QEMU_CAPS_NO_ACPI);
}
/* qemuCapsExtractDeviceStr will only set additional caps if qemu /* qemuCapsExtractDeviceStr will only set additional caps if qemu
* understands the 0.13.0+ notion of "-device driver,". */ * understands the 0.13.0+ notion of "-device driver,". */
@ -2277,13 +2275,6 @@ qemuCapsInitQMPBasic(qemuCapsPtr caps)
qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC); qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
qemuCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN); qemuCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN);
qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE); qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
/* ACPI is only supported on x86, PPC or
* other platforms don't support it*/
if (caps->arch == VIR_ARCH_I686 ||
caps->arch == VIR_ARCH_X86_64)
qemuCapsSet(caps, QEMU_CAPS_NO_ACPI);
qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY); qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY);
qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO); qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ); qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ);
@ -2430,16 +2421,12 @@ qemuCapsInitQMP(qemuCapsPtr caps,
} }
VIR_FREE(archstr); VIR_FREE(archstr);
/* Currently only x86_64 and i686 support PCI-multibus. */ /* Currently only x86_64 and i686 support PCI-multibus and -no-acpi. */
if (caps->arch == VIR_ARCH_X86_64 || if (caps->arch == VIR_ARCH_X86_64 ||
caps->arch == VIR_ARCH_I686) caps->arch == VIR_ARCH_I686) {
qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS); qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS);
qemuCapsSet(caps, QEMU_CAPS_NO_ACPI);
/* S390 and probably other archs do not support no-acpi - }
maybe the qemu option parsing should be re-thought. */
if (caps->arch == VIR_ARCH_S390 ||
caps->arch == VIR_ARCH_S390X)
qemuCapsClear(caps, QEMU_CAPS_NO_ACPI);
if (qemuCapsProbeQMPCommands(caps, mon) < 0) if (qemuCapsProbeQMPCommands(caps, mon) < 0)
goto cleanup; goto cleanup;