[pve-devel] [PATCH 2/3] add qemu_use_old_bios_files sub

Alexandre Derumier aderumier at odiso.com
Fri Nov 6 10:27:05 CET 2015


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0aa1ff4..d0345a7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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 = {};
-- 
2.1.4




More information about the pve-devel mailing list