[cowdancer] 04/05: qemubuilder: Enable KVM via -machine (kvm binary is deprecated)

James Clarke jrtc27 at moszumanska.debian.org
Wed Jan 18 18:50:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

jrtc27 pushed a commit to branch master
in repository cowdancer.

commit da98bc396aa45a059268ef2c1a7b4cc0879eef29
Author: James Clarke <jrtc27 at debian.org>
Date:   Wed Jan 18 18:17:25 2017 +0000

    qemubuilder: Enable KVM via -machine (kvm binary is deprecated)
---
 qemuarch.c    | 20 +-------------------
 qemubuilder.c |  8 ++++++--
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/qemuarch.c b/qemuarch.c
index b5bcaaa..2779eba 100644
--- a/qemuarch.c
+++ b/qemuarch.c
@@ -123,25 +123,7 @@ const char *qemu_arch_qemu(const char *arch) {
 		return "qemu-system-mipsel";
 	} else if (!strcmp(arch, "i386") || !strcmp(arch, "hurd-i386") ||
 			   !strcmp(arch, "amd64") || !strcmp(arch, "x32")) {
-		/* we're leaking this memory, but don't care too much */
-		char *host_arch = get_host_dpkg_arch();
-
-		/* special-case
-		 * use kvm if possible
-		 * use qemu if i386/i386
-		 * use qemu-system-x86_64 otherwise
-		 */
-		int kvm_exists = !system("which kvm");
-
-		if (!strcmp(host_arch, arch) && kvm_exists) {
-			return "kvm";
-		} else if (!strcmp(host_arch, "amd64") && kvm_exists) {
-			return "kvm";
-		} else if ((!strcmp(host_arch, "i386")) && (!strcmp(arch, "i386"))) {
-			return "qemu";
-		} else {
-			return "qemu-system-x86_64";
-		}
+		return "qemu-system-x86_64";
 	} else if (!strcmp(arch, "hurd-i386")) {
 		return "qemu";
 	} else if (!strcmp(arch, "powerpc")) {
diff --git a/qemubuilder.c b/qemubuilder.c
index c6e81bf..229f5a7 100644
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -564,8 +564,12 @@ fork_qemu(const char *hda, const char *hdb, const struct pbuilderconfig *pc) {
 		argv[argc++] = "-nodefaults";
 		argv[argc++] = "-nographic";
 		argv[argc++] = "-no-reboot"; /* halt instead of rebooting */
-		argv[argc++] = "-M";
-		argv[argc++] = strdupa(machine);
+		argv[argc++] = "-machine";
+		asprintf(
+			&argv[argc++],
+			"type=%s,accel=kvm:xen:tcg",
+			strdupa(machine));
+
 		if (cpu) {
 			argv[argc++] = "-cpu";
 			argv[argc++] = strdupa(cpu);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/cowdancer.git



More information about the Pbuilder-maint mailing list