qemu: detect arch correctly for KVM

When running under KVM, the arch is usually set to i686 because
the name of the emulator is not qemu-system-x86_64.  Use the host
arch instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2012-01-27 14:49:48 +01:00 committed by Jiri Denemark
parent ef00a05e51
commit 4be541a6d9

View File

@ -7003,8 +7003,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
path = def->emulator; path = def->emulator;
else else
path = strstr(def->emulator, "qemu"); path = strstr(def->emulator, "qemu");
if (path && if (def->virtType == VIR_DOMAIN_VIRT_KVM)
STRPREFIX(path, "qemu-system-")) def->os.arch = strdup(caps->host.cpu->arch);
else if (path &&
STRPREFIX(path, "qemu-system-"))
def->os.arch = strdup(path + strlen("qemu-system-")); def->os.arch = strdup(path + strlen("qemu-system-"));
else else
def->os.arch = strdup("i686"); def->os.arch = strdup("i686");