From fba30411fbdf3f8a1661d88c450c24d5b35e632c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 6 Mar 2019 07:02:52 +0100 Subject: [PATCH] src/bin/proxmox-backup-client.rs: allow to set backup-id --- src/bin/proxmox-backup-client.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index c05d0f13..ec804a07 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -32,6 +32,7 @@ fn backup_directory>( repo: &BackupRepository, dir_path: P, archive_name: &str, + backup_id: &str, backup_time: DateTime, chunk_size: Option, verbose: bool, @@ -40,7 +41,7 @@ fn backup_directory>( let mut param = json!({ "archive-name": archive_name, "backup-type": "host", - "backup-id": &tools::nodename(), + "backup-id": backup_id, "backup-time": backup_time.timestamp(), }); @@ -291,6 +292,8 @@ fn create_backup( verify_chunk_size(size)?; } + let backup_id = param["host-id"].as_str().unwrap_or(&tools::nodename()); + let mut upload_list = vec![]; for backupspec in backupspec_list { @@ -335,7 +338,7 @@ fn create_backup( for (filename, target) in upload_list { println!("Upload '{}' to '{:?}' as {}", filename, repo, target); - backup_directory(&mut client, &repo, &filename, &target, backup_time, chunk_size_opt, verbose)?; + backup_directory(&mut client, &repo, &filename, &target, backup_id, backup_time, chunk_size_opt, verbose)?; } let end_time = Local.timestamp(Local::now().timestamp(), 0); @@ -414,6 +417,9 @@ fn main() { .optional( "verbose", BooleanSchema::new("Verbose output.").default(false)) + .optional( + "host-id", + StringSchema::new("Use specified ID for the backup group name ('host/'). The default is the system hostname.")) .optional( "chunk-size", IntegerSchema::new("Chunk size in KB. Must be a power of 2.")