104 lines
4.0 KiB
Diff
104 lines
4.0 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Dietmar Maurer <dietmar@proxmox.com>
|
||
|
Date: Thu, 9 Jul 2020 12:53:08 +0200
|
||
|
Subject: [PATCH] PVE: fixup pbs backup, add compress and encrypt options
|
||
|
|
||
|
---
|
||
|
block/monitor/block-hmp-cmds.c | 4 +++-
|
||
|
pve-backup.c | 13 ++++++++++++-
|
||
|
qapi/block-core.json | 6 ++++++
|
||
|
3 files changed, 21 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||
|
index fdc85a5c0e..43aa87487b 100644
|
||
|
--- a/block/monitor/block-hmp-cmds.c
|
||
|
+++ b/block/monitor/block-hmp-cmds.c
|
||
|
@@ -1038,7 +1038,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
|
||
|
false, NULL, // PBS fingerprint
|
||
|
false, NULL, // PBS backup-id
|
||
|
false, 0, // PBS backup-time
|
||
|
- false, false, // PBS incremental
|
||
|
+ false, false, // PBS use-dirty-bitmap
|
||
|
+ false, false, // PBS compress
|
||
|
+ false, false, // PBS encrypt
|
||
|
true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA,
|
||
|
false, NULL, false, NULL, !!devlist,
|
||
|
devlist, qdict_haskey(qdict, "speed"), speed, &error);
|
||
|
diff --git a/pve-backup.c b/pve-backup.c
|
||
|
index 46191bb328..3323b195a4 100644
|
||
|
--- a/pve-backup.c
|
||
|
+++ b/pve-backup.c
|
||
|
@@ -567,6 +567,10 @@ typedef struct QmpBackupTask {
|
||
|
const char *firewall_file;
|
||
|
bool has_devlist;
|
||
|
const char *devlist;
|
||
|
+ bool has_compress;
|
||
|
+ bool compress;
|
||
|
+ bool has_encrypt;
|
||
|
+ bool encrypt;
|
||
|
bool has_speed;
|
||
|
int64_t speed;
|
||
|
Error **errp;
|
||
|
@@ -694,6 +698,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
|
||
|
|
||
|
bool use_dirty_bitmap = task->has_use_dirty_bitmap && task->use_dirty_bitmap;
|
||
|
|
||
|
+
|
||
|
char *pbs_err = NULL;
|
||
|
pbs = proxmox_backup_new(
|
||
|
task->backup_file,
|
||
|
@@ -703,8 +708,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
|
||
|
task->has_password ? task->password : NULL,
|
||
|
task->has_keyfile ? task->keyfile : NULL,
|
||
|
task->has_key_password ? task->key_password : NULL,
|
||
|
+ task->has_compress ? task->compress : true,
|
||
|
+ task->has_encrypt ? task->encrypt : task->has_keyfile,
|
||
|
task->has_fingerprint ? task->fingerprint : NULL,
|
||
|
- &pbs_err);
|
||
|
+ &pbs_err);
|
||
|
|
||
|
if (!pbs) {
|
||
|
error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
|
||
|
@@ -943,6 +950,8 @@ UuidInfo *qmp_backup(
|
||
|
bool has_backup_id, const char *backup_id,
|
||
|
bool has_backup_time, int64_t backup_time,
|
||
|
bool has_use_dirty_bitmap, bool use_dirty_bitmap,
|
||
|
+ bool has_compress, bool compress,
|
||
|
+ bool has_encrypt, bool encrypt,
|
||
|
bool has_format, BackupFormat format,
|
||
|
bool has_config_file, const char *config_file,
|
||
|
bool has_firewall_file, const char *firewall_file,
|
||
|
@@ -971,6 +980,8 @@ UuidInfo *qmp_backup(
|
||
|
.firewall_file = firewall_file,
|
||
|
.has_devlist = has_devlist,
|
||
|
.devlist = devlist,
|
||
|
+ .has_compress = has_compress,
|
||
|
+ .has_encrypt = has_encrypt,
|
||
|
.has_speed = has_speed,
|
||
|
.speed = speed,
|
||
|
.errp = errp,
|
||
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||
|
index 4fe3d6f751..0bc15a5098 100644
|
||
|
--- a/qapi/block-core.json
|
||
|
+++ b/qapi/block-core.json
|
||
|
@@ -822,6 +822,10 @@
|
||
|
#
|
||
|
# @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs')
|
||
|
#
|
||
|
+# @compress: use compression (optional for format 'pbs', defaults to true)
|
||
|
+#
|
||
|
+# @encrypt: use encryption ((optional for format 'pbs', defaults to true if there is a keyfile)
|
||
|
+#
|
||
|
# Returns: the uuid of the backup job
|
||
|
#
|
||
|
##
|
||
|
@@ -833,6 +837,8 @@
|
||
|
'*backup-id': 'str',
|
||
|
'*backup-time': 'int',
|
||
|
'*use-dirty-bitmap': 'bool',
|
||
|
+ '*compress': 'bool',
|
||
|
+ '*encrypt': 'bool',
|
||
|
'*format': 'BackupFormat',
|
||
|
'*config-file': 'str',
|
||
|
'*firewall-file': 'str',
|