From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 manager 7/8] simplify get_included_vmids function
Date: Thu, 22 Oct 2020 12:30:16 +0200 [thread overview]
Message-ID: <20201022103017.19715-8-f.ebner@proxmox.com> (raw)
In-Reply-To: <20201022103017.19715-1-f.ebner@proxmox.com>
by collecting all the guest IDs first.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/API2/BackupInfo.pm | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/PVE/API2/BackupInfo.pm b/PVE/API2/BackupInfo.pm
index 909a5de1..4c461e59 100644
--- a/PVE/API2/BackupInfo.pm
+++ b/PVE/API2/BackupInfo.pm
@@ -17,30 +17,18 @@ use PVE::VZDump::Common;
use base qw(PVE::RESTHandler);
-sub map_job_vmids {
- my ($job_included_guests, $included_vmids) = @_;
-
- for my $node_vmids (values %{$job_included_guests}) {
- for my $vmid (@{$node_vmids}) {
- $included_vmids->{$vmid} = 1;
- }
- }
-
- return $included_vmids;
-}
-
sub get_included_vmids {
- my $included_vmids = {};
my $vzconf = cfs_read_file('vzdump.cron');
my $all_jobs = $vzconf->{jobs} || [];
+ my @all_vmids = ();
for my $job (@$all_jobs) {
my $job_included_guests = PVE::VZDump::get_included_guests($job);
- $included_vmids = map_job_vmids($job_included_guests, $included_vmids);
+ push @all_vmids, ( map { @{$_} } values %{$job_included_guests} );
}
- return $included_vmids;
+ return { map { $_ => 1 } @all_vmids };
}
__PACKAGE__->register_method({
--
2.20.1
next prev parent reply other threads:[~2020-10-22 10:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 10:30 [pve-devel] [PATCH-SERIES v2 manager] Make backup with IDs for non-existent guests visibly fail Fabian Ebner
2020-10-22 10:30 ` [pve-devel] [PATCH v2 manager 1/8] remove unused variable Fabian Ebner
2020-10-22 10:30 ` [pve-devel] [PATCH v2 manager 2/8] remove outdated comment Fabian Ebner
2020-10-22 10:30 ` [pve-devel] [PATCH v2 manager 3/8] only use plugin after truthiness check Fabian Ebner
2020-10-22 10:30 ` [pve-devel] [PATCH v2 manager 4/8] backup: include IDs for non-existent guests Fabian Ebner
2020-10-22 10:30 ` [pve-devel] [PATCH v2 manager 5/8] order guest IDs numerically in exec_backup Fabian Ebner
2020-10-22 10:30 ` [pve-devel] [PATCH v2 manager 6/8] sort the skip list numerically Fabian Ebner
2020-10-22 10:30 ` Fabian Ebner [this message]
2020-10-22 10:30 ` [pve-devel] [RFC/PATCH v2 manager 8/8] don't group by node in get_included_guests Fabian Ebner
2020-10-22 16:52 ` [pve-devel] applied-partially: [PATCH-SERIES v2 manager] Make backup with IDs for non-existent guests visibly fail 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=20201022103017.19715-8-f.ebner@proxmox.com \
--to=f.ebner@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