Am 13.02.25 um 14:17 schrieb Dominik Csapak: > those should be able to migrate even for online vms. If the mapping does > not exist on the target node, that will be caught further down anyway. > > Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> > --- > no changes in v6 > PVE/API2/Nodes.pm | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm > index f504e1b1..f5484280 100644 > --- a/PVE/API2/Nodes.pm > +++ b/PVE/API2/Nodes.pm > @@ -2331,9 +2331,18 @@ my $create_migrate_worker = sub { > $invalidConditions .= join(', ', map { $_->{volid} } > @{$preconditions->{local_disks}}); > } > > + # for a live migration all local_resources must be marked as > live-migratable > if ($online && scalar($preconditions->{local_resources}->@*)) { > - $invalidConditions .= "\n Has local resources: "; > - $invalidConditions .= join(', ', > @{$preconditions->{local_resources}}); > + my $resource_not_live = []; > + for my $resource ($preconditions->{local_resources}->@*) { > + next if > $preconditions->{'mapped-resource-info'}->{$resource}->{'live-migration'}; > + push $resource_not_live->@*, $resource; > + } > + > + if (scalar($resource_not_live->@*)) { > + $invalidConditions .= "\n Has local resources not marked as > live migratable: "; > + $invalidConditions .= join(', ', $resource_not_live->@*); > + } > } > > if (my $not_allowed_nodes = $preconditions->{not_allowed_nodes}) {
Should we rather not add those to the "local_resources" result in the first place? I.e. in check_local_resources() we know whether it's a live migration or not based on the $state argument. And towards the end of that function we could... > if ($k =~ m/^hostpci/) { > my $entry = parse_property_string('pve-qm-hostpci', $conf->{$k}); > if (my $name = $entry->{mapping}) { > $add_missing_mapping->('pci', $k, $name); > my $mapped_device = { name => $name }; > $mapped_device->{'live-migration'} = 1 > if $pci_map->{ids}->{$name}->{'live-migration-capable'}; > $mapped_res->{$k} = $mapped_device; > } > } > # sockets are safe: they will recreated be on the target side > post-migrate > next if $k =~ m/^serial/ && ($conf->{$k} eq 'socket'); ...do "next if live-migration" and not even add it. > push @loc_res, $k if $k =~ m/^(usb|hostpci|serial|parallel)\d+$/; _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel