[pve-devel] [PATCH manager] vzdump: included_guest: return empty hash if no guests selected
Aaron Lauterer
a.lauterer at proxmox.com
Thu Jul 9 13:21:28 CEST 2020
This will fix the behaviour when calling `vzdump --stop` to cause all
local guests to be backed up.
When refactoring this logic in commit be308647, the assumption was that
every call will have one of the following parameters set: pool, list of
VMIDs or all (intentional or when exclude is used).
There is an addtional possibility, that vzdump is called with only
--stop. Thus there are no other parameters that would indicate which
VMIDs to include.
In this case we want to return the empty hash.
Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
PVE/VZDump.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 1f0eb246..601cd56e 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -1170,7 +1170,7 @@ sub get_included_guests {
$vmids = PVE::API2Tools::get_resource_pool_guest_members($job->{pool});
} elsif ($job->{vmid}) {
$vmids = [ split_list($job->{vmid}) ];
- } else {
+ } elsif ($job->{all}) {
# all or exclude
my $exclude = check_vmids(split_list($job->{exclude}));
my $excludehash = { map { $_ => 1 } @$exclude };
@@ -1179,6 +1179,8 @@ sub get_included_guests {
next if $excludehash->{$id};
push @$vmids, $id;
}
+ } else {
+ return $vmids_per_node;
}
$vmids = check_vmids(@$vmids);
--
2.20.1
More information about the pve-devel
mailing list