Am 13.02.25 um 14:17 schrieb Dominik Csapak:
> this now takes into account the 'not_allowed_nodes' hash we get from the
> api call. With that, we can now limit the 'local_resources' check for
> online vms only, as for offline guests, the 'unavailable-resources' hash
> already includes mapped devices that don't exist on the target node.
>
> This now also includes unavailable storages on target nodes.
>
> Signed-off-by: Dominik Csapak <[email protected]>
> ---
> changes in v6:
> * added missing colon in log output
> PVE/API2/Nodes.pm | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> index 9cdf19db..f504e1b1 100644
> --- a/PVE/API2/Nodes.pm
> +++ b/PVE/API2/Nodes.pm
> @@ -2331,11 +2331,23 @@ my $create_migrate_worker = sub {
> $invalidConditions .= join(', ', map { $_->{volid} }
> @{$preconditions->{local_disks}});
> }
>
> - if (@{$preconditions->{local_resources}}) {
> + if ($online && scalar($preconditions->{local_resources}->@*)) {
Hmm, what about non-usb/pci local devices that are not covered by the
'unavailable-resources' below? I.e. ivshmem/serial/parallel. You break
the check for offline migration against those.
> $invalidConditions .= "\n Has local resources: ";
> $invalidConditions .= join(', ',
> @{$preconditions->{local_resources}});
> }
>
> + if (my $not_allowed_nodes = $preconditions->{not_allowed_nodes}) {
> + if (my $unavail_storages =
> $not_allowed_nodes->{$target}->{unavailable_storages}) {
> + $invalidConditions .= "\n Has unavailable storages: ";
> + $invalidConditions .= join(', ', $unavail_storages->@*);
> + }
> +
> + if (my $unavail_resources =
> $not_allowed_nodes->{$target}->{'unavailable-resources'}) {
> + $invalidConditions .= "\n Has unavailable resources: ";
> + $invalidConditions .= join(', ', $unavail_resources->@*);
> + }
> + }
> +
> if ($invalidConditions && $invalidConditions ne '') {
> print STDERR "skip VM $vmid - precondition check failed:";
> die "$invalidConditions\n";
_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel