+sub qemu_machine_pxe {
+ my ($vmid, $conf, $machine) = @_;
+
+ $machine = PVE::QemuServer::get_current_qemu_machine($vmid) if !$machine;
+
+ foreach my $opt (keys %$conf) {
+ next if $opt !~ m/^net(\d+)$/;
+ my $net = PVE::QemuServer::parse_net($conf->{$opt});
+ next if !$net;
+ my $romfile = PVE::QemuServer::vm_mon_cmd_nocheck($vmid, 'qom-get', path => $opt, property => 'romfile');
+ return $machine.".pxe" if $romfile =~ m/pxe/;
+ last;
+ }
+
+}
+
+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);
+}
+