mirror of
https://git.proxmox.com/git/qemu-server
synced 2026-02-01 19:07:54 +00:00
api/migration: fix autocomplete for targetstorage
Show storages configured for the target node and not for the current one because they can be different. Duplicated the `complete_storage` sub and extended it to extract the targetnode from the parameters to pass it into the storage_check_enabled function. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
parent
340d8b7510
commit
255e9c546c
@ -3302,7 +3302,7 @@ __PACKAGE__->register_method({
|
||||
targetstorage => get_standard_option('pve-storage-id', {
|
||||
description => "Default target storage.",
|
||||
optional => 1,
|
||||
completion => \&PVE::QemuServer::complete_storage,
|
||||
completion => \&PVE::QemuServer::complete_migration_storage,
|
||||
}),
|
||||
bwlimit => {
|
||||
description => "Override I/O bandwidth limit (in KiB/s).",
|
||||
|
||||
@ -7482,4 +7482,22 @@ sub complete_storage {
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub complete_migration_storage {
|
||||
my ($cmd, $param, $current_value, $all_args) = @_;
|
||||
|
||||
my $targetnode = @$all_args[1];
|
||||
|
||||
my $cfg = PVE::Storage::config();
|
||||
my $ids = $cfg->{ids};
|
||||
|
||||
my $res = [];
|
||||
foreach my $sid (keys %$ids) {
|
||||
next if !PVE::Storage::storage_check_enabled($cfg, $sid, $targetnode, 1);
|
||||
next if !$ids->{$sid}->{content}->{images};
|
||||
push @$res, $sid;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user