mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 13:49:50 +00:00
pci passthrough: enable live-migration for capable mapped-devices
Set the 'enable-migration' QEMU command-line flag to on for live-migration marked mapped devices, as the default is 'auto', but for those which are marked as capable for live-migration, we want to explicitly enable that, so that we get an early error on start if the driver does not support live-migration. With that we can drop such devices from being a migration blocker. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> [TL: squash and re-order similar changes together] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
0f55e8be84
commit
b86d32dcb2
@ -2519,6 +2519,12 @@ sub check_local_resources {
|
||||
my $mapped_device = { name => $name };
|
||||
$mapped_res->{$k} = $mapped_device;
|
||||
|
||||
if ($pci_map->{ids}->{$name}->{'live-migration-capable'}) {
|
||||
$mapped_device->{'live-migration'} = 1;
|
||||
# don't add mapped device with live migration as blocker
|
||||
next;
|
||||
}
|
||||
|
||||
# don't add mapped devices as blocker for offline migration but still iterate over
|
||||
# all mappings above to collect on which nodes they are available.
|
||||
next if !$state;
|
||||
|
@ -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}";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user