From: "Daniel P. Berrange" <berrange(a)redhat.com>
For i686 arch we look for the 'qemu' binary, followed by the
'qemu-system-x86_64' binary. This is not good with QEMU 1.0,
since the 'qemu' binary was renamed to 'qemu-system-i386'
and the 'qemu' name might be reused for another purpose
later.
Make sure we look for 'qemu-system-i386', then 'qemu-system-x86_64'
then the qemu-kvm binary. Only use 'qemu' as a very last resort
* src/qemu/qemu_capabilities.c: Prefer qemu-system-i386
---
src/qemu/qemu_capabilities.c | 48 ++++++++++++++++++++++++-----------------
1 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0e09d6d..16d9b21 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -169,7 +169,6 @@ struct qemu_arch_info {
int wordsize;
const char *machine;
const char *binary;
- const char *altbinary;
const struct qemu_feature_flags *flags;
int nflags;
};
@@ -189,25 +188,25 @@ static const struct qemu_feature_flags const arch_info_x86_64_flags
[] = {
/* The archicture tables for supported QEMU archs */
static const struct qemu_arch_info const arch_info_hvm[] = {
- { "i686", 32, NULL, "qemu",
- "qemu-system-x86_64", arch_info_i686_flags, 4 },
+ { "i686", 32, NULL, "qemu-system-i386",
+ arch_info_i686_flags, 4 },
{ "x86_64", 64, NULL, "qemu-system-x86_64",
- NULL, arch_info_x86_64_flags, 2 },
- { "arm", 32, NULL, "qemu-system-arm", NULL, NULL, 0 },
- { "microblaze", 32, NULL, "qemu-system-microblaze", NULL,
NULL, 0 },
- { "microblazeel", 32, NULL, "qemu-system-microblazeel", NULL,
NULL, 0 },
- { "mips", 32, NULL, "qemu-system-mips", NULL, NULL, 0 },
- { "mipsel", 32, NULL, "qemu-system-mipsel", NULL, NULL, 0 },
- { "sparc", 32, NULL, "qemu-system-sparc", NULL, NULL, 0 },
- { "ppc", 32, NULL, "qemu-system-ppc", NULL, NULL, 0 },
- { "ppc64", 64, NULL, "qemu-system-ppc64", NULL, NULL, 0
},
- { "itanium", 64, NULL, "qemu-system-ia64", NULL, NULL, 0 },
- { "s390x", 64, NULL, "qemu-system-s390x", NULL, NULL, 0 },
+ arch_info_x86_64_flags, 2 },
+ { "arm", 32, NULL, "qemu-system-arm", NULL, 0 },
+ { "microblaze", 32, NULL, "qemu-system-microblaze", NULL, 0 },
+ { "microblazeel", 32, NULL, "qemu-system-microblazeel", NULL, 0
},
+ { "mips", 32, NULL, "qemu-system-mips", NULL, 0 },
+ { "mipsel", 32, NULL, "qemu-system-mipsel", NULL, 0 },
+ { "sparc", 32, NULL, "qemu-system-sparc", NULL, 0 },
+ { "ppc", 32, NULL, "qemu-system-ppc", NULL, 0 },
+ { "ppc64", 64, NULL, "qemu-system-ppc64", NULL, 0 },
+ { "itanium", 64, NULL, "qemu-system-ia64", NULL, 0 },
+ { "s390x", 64, NULL, "qemu-system-s390x", NULL, 0 },
};
static const struct qemu_arch_info const arch_info_xen[] = {
- { "i686", 32, "xenner", "xenner", NULL,
arch_info_i686_flags, 4 },
- { "x86_64", 64, "xenner", "xenner", NULL,
arch_info_x86_64_flags, 2 },
+ { "i686", 32, "xenner", "xenner",
arch_info_i686_flags, 4 },
+ { "x86_64", 64, "xenner", "xenner",
arch_info_x86_64_flags, 2 },
};
@@ -643,10 +642,11 @@ qemuCapsInitGuest(virCapsPtr caps,
*/
binary = virFindFileInPath(info->binary);
- if (binary == NULL || !virFileIsExecutable(binary)) {
- VIR_FREE(binary);
- binary = virFindFileInPath(info->altbinary);
- }
+ /* If i386 binary is missing, we can trivially
+ * replace it with a qemu-system-x86_64 binary
+ */
+ if (binary == NULL && STREQ(info->binary, "qemu-system-i386"))
+ binary = virFindFileInPath("qemu-system-x86_64");
/* Can use acceleration for KVM/KQEMU if
* - host & guest arches match
@@ -668,6 +668,10 @@ qemuCapsInitGuest(virCapsPtr caps,
continue;
haskvm = 1;
+
+ /* We can use the KVM binary for the TCG case too
+ * (probably)
+ */
if (!binary)
binary = kvmbin;
@@ -679,6 +683,10 @@ qemuCapsInitGuest(virCapsPtr caps,
haskqemu = 1;
}
+ /* Another fallback for i386, try the old name now */
+ if (binary == NULL && STREQ(info->binary, "qemu-system-i386"))
+ binary = virFindFileInPath("qemu");
+
if (!binary)
return 0;
--
1.7.7.6