[pve-devel] [PATCH qemu-server 05/13] use qemu-system-aarch64 for arm machines

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Oct 24 10:56:41 CEST 2018


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 PVE/QemuServer.pm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0d8ec06..76bd275 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2739,7 +2739,7 @@ sub check_cmdline {
 	my @param = split(/\0/, $line);
 
 	my $cmd = $param[0];
-	return if !$cmd || ($cmd !~ m|kvm$| && $cmd !~ m|qemu-system-x86_64$|);
+	return if !$cmd || ($cmd !~ m|kvm$| && $cmd !~ m@(?:^|/)qemu-system-[^/]+$@);
 
 	for (my $i = 0; $i < scalar (@param); $i++) {
 	    my $p = $param[$i];
@@ -3195,6 +3195,19 @@ sub get_ovmf_files($) {
     return @$ovmf;
 }
 
+my %Arch2Qemu = (
+    arm64 => '/usr/bin/qemu-system-aarch64',
+    amd64 => '/usr/bin/qemu-system-x86_64',
+);
+sub get_command_for_arch($) {
+    my ($arch) = @_;
+    return '/usr/bin/kvm' if is_native($arch);
+
+    my $cmd = $Arch2Qemu{$arch}
+	or die "don't know how to emulate architecture '$arch'\n";
+    return $cmd;
+}
+
 sub config_to_command {
     my ($storecfg, $vmid, $conf, $defaults, $forcemachine) = @_;
 
@@ -3239,7 +3252,7 @@ sub config_to_command {
     my $cpuunits = defined($conf->{cpuunits}) ?
             $conf->{cpuunits} : $defaults->{cpuunits};
 
-    push @$cmd, '/usr/bin/kvm';
+    push @$cmd, get_command_for_arch($arch);
 
     push @$cmd, '-id', $vmid;
 
-- 
2.11.0





More information about the pve-devel mailing list