]> git.proxmox.com Git - qemu-server.git/commitdiff
Fix #1125. Check for KVM support before starting VM
authorPhilip Abernethy <p.abernethy@proxmox.com>
Mon, 21 Aug 2017 09:47:18 +0000 (11:47 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 21 Aug 2017 14:19:20 +0000 (16:19 +0200)
Moved the check to the beginning of the function.
VMs configured to use KVM won't start if KVM is not available.
VMs not configured to use KVM will start regardless.

PVE/QemuServer.pm

index d6ddb1d77f96651c628bf844a3f3f6a104ed70b4..2aafc4289053e355c7a86f12d0c96686cd8c1e1a 100644 (file)
@@ -2837,6 +2837,8 @@ sub config_to_command {
     my $winversion = windows_version($ostype);
     my $kvm = $conf->{kvm} // 1;
 
+    die "KVM virtualisation configured, but not available. Either disable in VM configuration or enable in BIOS.\n" if (!$cpuinfo->{hvm} && $kvm);
+
     if ($kvmver =~ m/^(\d+)\.(\d+)$/) {
        $vernum = $1*1000000+$2*1000;
     } elsif ($kvmver =~ m/^(\d+)\.(\d+)\.(\d+)$/) {
@@ -3106,8 +3108,6 @@ sub config_to_command {
 
     if (!$kvm) {
        push @$machineFlags, 'accel=tcg';
-    } else {
-       die "No accelerator found!\n" if !$cpuinfo->{hvm};
     }
 
     if ($machine_type) {