From: Filip Schauer <f.schauer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup-qemu 1/2] add support for notes
Date: Mon, 27 May 2024 15:07:14 +0200 [thread overview]
Message-ID: <20240527130715.189131-2-f.schauer@proxmox.com> (raw)
In-Reply-To: <20240527130715.189131-1-f.schauer@proxmox.com>
Allow adding a comment/notes to a new backup.
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
src/backup.rs | 6 +++++-
src/lib.rs | 9 +++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/backup.rs b/src/backup.rs
index bbe4f00..b7d383a 100644
--- a/src/backup.rs
+++ b/src/backup.rs
@@ -73,7 +73,11 @@ impl BackupTask {
let (abort, _) = tokio::sync::broadcast::channel(16);
- let manifest = Arc::new(Mutex::new(BackupManifest::new(setup.backup_dir.clone())));
+ let mut manifest = BackupManifest::new(setup.backup_dir.clone());
+ if let Some(notes) = &setup.notes {
+ manifest.unprotected["notes"] = serde_json::Value::String(notes.clone());
+ }
+ let manifest = Arc::new(Mutex::new(manifest));
let registry = Arc::new(Mutex::new(Registry::<ImageUploadInfo>::new()));
let known_chunks = Arc::new(Mutex::new(HashSet::new()));
diff --git a/src/lib.rs b/src/lib.rs
index 9067fc5..034b7ab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -140,6 +140,7 @@ pub(crate) struct BackupSetup {
pub key_password: Option<String>,
pub master_keyfile: Option<std::path::PathBuf>,
pub fingerprint: Option<String>,
+ pub notes: Option<String>,
}
// helper class to implement synchrounous interface
@@ -212,6 +213,7 @@ pub extern "C" fn proxmox_backup_new(
compress: bool,
encrypt: bool,
fingerprint: *const c_char,
+ notes: *const c_char,
error: *mut *mut c_char,
) -> *mut ProxmoxBackupHandle {
proxmox_backup_new_ns(
@@ -227,6 +229,7 @@ pub extern "C" fn proxmox_backup_new(
compress,
encrypt,
fingerprint,
+ notes,
error,
)
}
@@ -251,6 +254,7 @@ pub extern "C" fn proxmox_backup_new_ns(
compress: bool,
encrypt: bool,
fingerprint: *const c_char,
+ notes: *const c_char,
error: *mut *mut c_char,
) -> *mut ProxmoxBackupHandle {
let task: Result<_, Error> = try_block!({
@@ -277,6 +281,8 @@ pub extern "C" fn proxmox_backup_new_ns(
return Err(format_err!("can't use master keyfile without keyfile"));
}
+ let notes = tools::utf8_c_string(notes)?;
+
let crypt_mode = if keyfile.is_some() {
if encrypt {
CryptMode::Encrypt
@@ -304,6 +310,7 @@ pub extern "C" fn proxmox_backup_new_ns(
key_password,
master_keyfile,
fingerprint,
+ notes,
};
BackupTask::new(setup, compress, crypt_mode)
@@ -816,6 +823,7 @@ pub extern "C" fn proxmox_restore_new(
key_password,
master_keyfile: None,
fingerprint,
+ notes: None,
};
RestoreTask::new(setup)
@@ -876,6 +884,7 @@ pub extern "C" fn proxmox_restore_new_ns(
key_password,
master_keyfile: None,
fingerprint,
+ notes: None,
};
RestoreTask::new(setup)
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-05-27 13:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 13:07 [pbs-devel] [PATCH backup-qemu/vma-to-pbs 0/2] add support for notes and logs Filip Schauer
2024-05-27 13:07 ` Filip Schauer [this message]
2024-05-27 13:07 ` [pbs-devel] [PATCH vma-to-pbs 2/2] " Filip Schauer
2024-07-03 13:06 ` [pbs-devel] [PATCH backup-qemu/vma-to-pbs 0/2] " Fabian Grünbichler
2024-07-03 13:28 ` Filip Schauer
2024-07-03 14:24 ` Fabian Grünbichler
2024-07-10 9:20 ` Filip Schauer
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=20240527130715.189131-2-f.schauer@proxmox.com \
--to=f.schauer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox