public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] vzdump: included_guest: return empty hash if no guests selected
Date: Thu,  9 Jul 2020 13:21:28 +0200	[thread overview]
Message-ID: <20200709112128.27030-1-a.lauterer@proxmox.com> (raw)

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@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





             reply	other threads:[~2020-07-09 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 11:21 Aaron Lauterer [this message]
2020-07-09 11:34 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200709112128.27030-1-a.lauterer@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal