]> git.proxmox.com Git - qemu-server.git/commitdiff
add qemu_use_old_bios_files sub
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 6 Nov 2015 09:27:05 +0000 (10:27 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 6 Nov 2015 09:51:48 +0000 (10:51 +0100)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index 0aa1ff4763fa81f67a52d5efa4cfa8f69a0884ee..d0345a7cabee6d028bc56df31c45985cb2aab3e0 100644 (file)
@@ -2643,6 +2643,8 @@ sub config_to_command {
     my $q35 = machine_type_is_q35($conf);
     my $hotplug_features = parse_hotplug_features(defined($conf->{hotplug}) ? $conf->{hotplug} : '1');
     my $machine_type = $forcemachine || $conf->{machine};
+    my $use_old_bios_files = undef;
+    ($use_old_bios_files, $machine_type) = qemu_use_old_bios_files($machine_type);
 
     my $cpuunits = defined($conf->{cpuunits}) ?
             $conf->{cpuunits} : $defaults->{cpuunits};
@@ -2657,20 +2659,6 @@ sub config_to_command {
        push @$cmd, '-p', "CPUQuota=$cpulimit\%";
     }
 
-
-    my $use_old_bios_files = undef;
-
-    if ($machine_type && $machine_type =~ m/^(\S+)\.pxe$/){
-       $machine_type = $1;
-       $use_old_bios_files = 1;
-    } else {
-       # Note: kvm version < 2.4 use non-efi pxe files, and have problems when we
-       # load new efi bios files on migration. So this hack is required to allow
-       # live migration from qemu-2.2 to qemu-2.4, which is sometimes used when
-       # updrading from proxmox-ve-3.X to proxmox-ve 4.0
-       $use_old_bios_files = !qemu_machine_feature_enabled ($machine_type, $kvmver, 2, 4);
-    }
-
     push @$cmd, '/usr/bin/kvm';
 
     push @$cmd, '-id', $vmid;
@@ -6381,6 +6369,27 @@ sub qemu_machine_pxe {
 
 }
 
+sub qemu_use_old_bios_files {
+    my ($machine_type) = @_;
+
+    return if !$machine_type;
+
+    my $use_old_bios_files = undef;
+
+    if ($machine_type =~ m/^(\S+)\.pxe$/) {
+        $machine_type = $1;
+        $use_old_bios_files = 1;
+    } else {
+        # Note: kvm version < 2.4 use non-efi pxe files, and have problems when we
+        # load new efi bios files on migration. So this hack is required to allow
+        # live migration from qemu-2.2 to qemu-2.4, which is sometimes used when
+        # updrading from proxmox-ve-3.X to proxmox-ve 4.0
+        $use_old_bios_files = !qemu_machine_feature_enabled ($machine_type, undef, 2, 4);
+    }
+
+    return ($use_old_bios_files, $machine_type);
+}
+
 sub lspci {
 
     my $devices = {};