[pve-devel] [PATCH v8 qemu 10/10] PVE backup: backup-access-api: explicit bitmap-mode parameter
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Apr 3 14:30:50 CEST 2025
This allows to explicitly request to re-create a bitmap under the same
name.
Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
New in v8
pve-backup.c | 17 ++++++++++++++++-
qapi/block-core.json | 20 +++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
index 8909842292..18bcf29533 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -1043,7 +1043,16 @@ BackupAccessInfoList *coroutine_fn qmp_backup_access_setup(
error_propagate(errp, local_err);
goto err;
}
- di->requested_bitmap_name = g_strdup(it->value->bitmap_name);
+ if (it->value->bitmap_mode == BACKUP_ACCESS_SETUP_BITMAP_MODE_NONE) {
+ di->bitmap_action = PBS_BITMAP_ACTION_NOT_USED;
+ } else {
+ di->requested_bitmap_name = g_strdup(it->value->bitmap_name);
+ if (it->value->bitmap_mode == BACKUP_ACCESS_SETUP_BITMAP_MODE_NEW) {
+ di->bitmap_action = PBS_BITMAP_ACTION_NEW;
+ } else if (it->value->bitmap_mode == BACKUP_ACCESS_SETUP_BITMAP_MODE_USE) {
+ di->bitmap_action = PBS_BITMAP_ACTION_USED;
+ }
+ }
di_list = g_list_append(di_list, di);
}
bdrv_graph_co_rdunlock();
@@ -1096,6 +1105,12 @@ BackupAccessInfoList *coroutine_fn qmp_backup_access_setup(
&& di->requested_bitmap_name
&& strcmp(di->requested_bitmap_name, old_bitmap_name) == 0;
+ /* special case: if we explicitly requested a *new* bitmap, treat an
+ * existing bitmap as having a different name */
+ if (di->bitmap_action == PBS_BITMAP_ACTION_NEW) {
+ same_bitmap_name = false;
+ }
+
if (old_bitmap_name && !same_bitmap_name) {
BdrvDirtyBitmap *old_bitmap = bdrv_find_dirty_bitmap(di->bs, old_bitmap_name);
if (!old_bitmap) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 58586170d9..e1c79649fb 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1145,9 +1145,27 @@
# in the result to see if you can actually re-use the bitmap or if it had to
# be newly created.
#
+# @bitmap-mode: used to control whether the bitmap should be reused or
+# recreated.
+#
##
{ 'struct': 'BackupAccessSourceDevice',
- 'data': { 'device': 'str', '*bitmap-name': 'str' } }
+ 'data': { 'device': 'str', '*bitmap-name': 'str',
+ '*bitmap-mode': 'BackupAccessSetupBitmapMode' } }
+
+##
+# @BackupAccessSetupBitmapMode:
+#
+# How to setup a bitmap for a device for @backup-access-setup.
+#
+# @none: do not use a bitmap. Removes an existing bitmap if present.
+#
+# @new: create and use a new bitmap.
+#
+# @use: try to re-use an existing bitmap. Create a new one if it doesn't exist.
+##
+{ 'enum': 'BackupAccessSetupBitmapMode',
+ 'data': ['none', 'new', 'use' ] }
##
# @backup-access-setup:
--
2.39.5
More information about the pve-devel
mailing list