the default is 'auto', but for those which are marked as capable for
live migration, we want to explicitly enable that, so we get an early
error on start if the driver does not support that.

Reviewed-by: Christoph Heiss <c.he...@proxmox.com>
Reviewed-by: Fiona Ebner <f.eb...@proxmox.com>
Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
changes from v6:
* renamed $cfg to $mapping_cfg
* added missing semicolon

 PVE/QemuServer/PCI.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index a0d99692..afb60ad2 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -433,9 +433,11 @@ sub parse_hostpci {
        die "PCI device mapping not found for '$mapping'\n" if !$devices || 
!scalar($devices->@*);
 
        my $config = PVE::Mapping::PCI::config();
+       my $mapping_cfg = $config->{ids}->{$mapping};
+       $res->{'live-migration-capable'} = 1 if 
$mapping_cfg->{'live-migration-capable'};
 
        for my $device ($devices->@*) {
-           eval { PVE::Mapping::PCI::assert_valid($mapping, $device, 
$config->{ids}->{$mapping}) };
+           eval { PVE::Mapping::PCI::assert_valid($mapping, $device, 
$mapping_cfg) };
            die "PCI device mapping invalid (hardware probably changed): $@\n" 
if $@;
            push $alternatives->@*, [split(/;/, $device->{path})];
        }
@@ -692,6 +694,10 @@ sub print_hostpci_devices {
                $devicestr .= ",host=$pcidevice->{id}";
            }
 
+           if ($d->{'live-migration-capable'}) {
+               $devicestr .= ",enable-migration=on";
+           }
+
            my $mf_addr = $multifunction ? ".$j" : '';
            $devicestr .= ",id=${id}${mf_addr}${pciaddr}${mf_addr}";
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to