]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: detect arch correctly for KVM
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 27 Jan 2012 13:49:48 +0000 (14:49 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 27 Jan 2012 15:51:49 +0000 (16:51 +0100)
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>
src/qemu/qemu_command.c

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