From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 3/5] fix #3533: tape backup: filter groups according to config
Date: Thu, 4 Nov 2021 10:56:20 +0100 [thread overview]
Message-ID: <20211104095622.2207427-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20211104095622.2207427-1-d.csapak@proxmox.com>
this fixes bug #3533, since now a user can backup a single datastore
on multiple tape media pools in parallel, e.g. vms on one pool, ct on
another.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/api2/tape/backup.rs | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/api2/tape/backup.rs b/src/api2/tape/backup.rs
index a0578391..1d775459 100644
--- a/src/api2/tape/backup.rs
+++ b/src/api2/tape/backup.rs
@@ -11,10 +11,11 @@ use proxmox_schema::api;
use pbs_api_types::{
Authid, Userid, TapeBackupJobConfig, TapeBackupJobSetup, TapeBackupJobStatus, MediaPoolConfig,
UPID_SCHEMA, JOB_ID_SCHEMA, PRIV_DATASTORE_READ, PRIV_TAPE_AUDIT, PRIV_TAPE_WRITE,
+ GroupFilter,
};
use pbs_datastore::{DataStore, StoreProgress, SnapshotReader};
-use pbs_datastore::backup_info::{BackupDir, BackupInfo};
+use pbs_datastore::backup_info::{BackupDir, BackupInfo, BackupGroup};
use pbs_tools::{task_log, task_warn, task::WorkerTaskContext};
use pbs_config::CachedUserInfo;
use proxmox_rest_server::WorkerTask;
@@ -436,8 +437,21 @@ fn backup_worker(
group_list.sort_unstable();
- let group_count = group_list.len();
- task_log!(worker, "found {} groups", group_count);
+ let (group_list, group_count) = if let Some(group_filters) = &setup.groups {
+ let filter_fn = |group: &BackupGroup, group_filters: &[GroupFilter]| {
+ group_filters.iter().any(|filter| group.matches(filter))
+ };
+
+ let group_count_full = group_list.len();
+ let list: Vec<BackupGroup> = group_list.into_iter().filter(|group| filter_fn(group, &group_filters)).collect();
+ let group_count = list.len();
+ task_log!(worker, "found {} groups (out of {} total)", group_count, group_count_full);
+ (list, group_count)
+ } else {
+ let group_count = group_list.len();
+ task_log!(worker, "found {} groups", group_count);
+ (group_list, group_count)
+ };
let mut progress = StoreProgress::new(group_count as u64);
--
2.30.2
next prev parent reply other threads:[~2021-11-04 9:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 9:56 [pbs-devel] [PATCH proxmox-backup 0/5] add group filters to tape backup (jobs) Dominik Csapak
2021-11-04 9:56 ` [pbs-devel] [PATCH proxmox-backup 1/5] proxmox-tape: add missing 'notify-user' option to backup command Dominik Csapak
2021-11-04 9:56 ` [pbs-devel] [PATCH proxmox-backup 2/5] tape backup jobs: add group filters to config/api Dominik Csapak
2021-11-04 9:56 ` Dominik Csapak [this message]
2021-11-04 9:56 ` [pbs-devel] [PATCH proxmox-backup 4/5] ui: tape: show configred group filters Dominik Csapak
2021-11-04 9:56 ` [pbs-devel] [PATCH proxmox-backup 5/5] proxmox-tape: add groups filter to backup command Dominik Csapak
2021-11-18 10:13 ` [pbs-devel] applied-series: [PATCH proxmox-backup 0/5] add group filters to tape backup (jobs) 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=20211104095622.2207427-4-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal