tape: add namespaces/recursion depth to tape backup jobs
and manual api via TapeBackupJobSetup Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
9c65e6ab4a
commit
999293bbca
|
@ -277,6 +277,14 @@ pub struct VerificationJobStatus {
|
|||
schema: GROUP_FILTER_LIST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
ns: {
|
||||
type: BackupNamespace,
|
||||
optional: true,
|
||||
},
|
||||
"recursion-depth": {
|
||||
schema: crate::NS_MAX_DEPTH_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Clone, Updater)]
|
||||
|
@ -297,6 +305,10 @@ pub struct TapeBackupJobSetup {
|
|||
pub notify_user: Option<Userid>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub group_filter: Option<Vec<GroupFilter>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ns: Option<BackupNamespace>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub recursion_depth: Option<usize>,
|
||||
}
|
||||
|
||||
#[api(
|
||||
|
|
|
@ -409,7 +409,18 @@ fn backup_worker(
|
|||
let mut pool_writer = PoolWriter::new(pool, &setup.drive, worker, email, force_media_set)?;
|
||||
|
||||
// FIXME: Namespaces! Probably just recurse for now? Not sure about the usage here...
|
||||
let mut group_list = datastore.list_backup_groups(Default::default())?;
|
||||
|
||||
let mut group_list = Vec::new();
|
||||
let root_namespace = if let Some(ns) = &setup.ns {
|
||||
ns.clone()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
let namespaces =
|
||||
datastore.recursive_iter_backup_ns_ok(root_namespace, setup.recursion_depth)?;
|
||||
for ns in namespaces {
|
||||
group_list.extend(datastore.list_backup_groups(ns)?);
|
||||
}
|
||||
|
||||
group_list.sort_unstable_by(|a, b| a.group().cmp(b.group()));
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@ use pbs_config::drive::complete_drive_name;
|
|||
use pbs_config::media_pool::complete_pool_name;
|
||||
|
||||
use pbs_api_types::{
|
||||
Authid, GroupListItem, HumanByte, Userid, DATASTORE_MAP_LIST_SCHEMA, DATASTORE_SCHEMA,
|
||||
DRIVE_NAME_SCHEMA, GROUP_FILTER_LIST_SCHEMA, MEDIA_LABEL_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
|
||||
Authid, BackupNamespace, GroupListItem, HumanByte, Userid, DATASTORE_MAP_LIST_SCHEMA,
|
||||
DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA, GROUP_FILTER_LIST_SCHEMA, MEDIA_LABEL_SCHEMA,
|
||||
MEDIA_POOL_NAME_SCHEMA, NS_MAX_DEPTH_SCHEMA,
|
||||
TAPE_RESTORE_SNAPSHOT_SCHEMA,
|
||||
};
|
||||
use pbs_tape::{BlockReadError, MediaContentHeader, PROXMOX_BACKUP_CONTENT_HEADER_MAGIC_1_0};
|
||||
|
@ -840,6 +841,14 @@ async fn clean_drive(mut param: Value) -> Result<(), Error> {
|
|||
schema: GROUP_FILTER_LIST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
namespace: {
|
||||
type: BackupNamespace,
|
||||
optional: true,
|
||||
},
|
||||
"recursion-depth": {
|
||||
schema: NS_MAX_DEPTH_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
"force-media-set": {
|
||||
description: "Ignore the allocation policy and start a new media-set.",
|
||||
optional: true,
|
||||
|
|
Loading…
Reference in New Issue