From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC qemu 3/7] block/backup: allow passing additional options for copy-before-write upon job creation
Date: Mon, 10 Jun 2024 14:59:38 +0200 [thread overview]
Message-ID: <20240610125942.116985-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20240610125942.116985-1-f.ebner@proxmox.com>
In particular, useful for setting the 'on-cbw-error' and 'cbw-timeout'
options (see BlockdevOptionsCbw in QAPI).
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
block/backup.c | 10 +++++++---
block/replication.c | 2 +-
blockdev.c | 2 +-
include/block/block_int-global-state.h | 2 ++
pve-backup.c | 2 +-
5 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index e0acfe6758..82fedf1680 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -336,6 +336,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
bool compress, bool discard_source,
const char *filter_node_name,
BackupPerf *perf,
+ QDict *cbw_opts,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
int creation_flags,
@@ -347,7 +348,6 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
int64_t cluster_size;
BlockDriverState *cbw = NULL;
BlockCopyState *bcs = NULL;
- QDict *cbw_opts = NULL;
assert(bs);
assert(target);
@@ -436,8 +436,12 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
}
if (perf->has_min_cluster_size) {
- cbw_opts = qdict_new();
- qdict_put_int(cbw_opts, "min-cluster-size", perf->min_cluster_size);
+ if (!cbw_opts) {
+ cbw_opts = qdict_new();
+ }
+ if (!qdict_haskey(cbw_opts, "min-cluster-size")) {
+ qdict_put_int(cbw_opts, "min-cluster-size", perf->min_cluster_size);
+ }
}
cbw = bdrv_cbw_append(bs, target, filter_node_name, discard_source,
diff --git a/block/replication.c b/block/replication.c
index 0415a5e8b7..c5a27f593e 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -583,7 +583,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
s->backup_job = backup_job_create(
NULL, s->secondary_disk->bs, s->hidden_disk->bs,
0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, false,
- NULL, &perf,
+ NULL, &perf, NULL,
BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
backup_job_completed, bs, NULL, &local_err);
diff --git a/blockdev.c b/blockdev.c
index cbe224387b..55ca967430 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2732,7 +2732,7 @@ static BlockJob *do_backup_common(BackupCommon *backup,
backup->sync, bmap, backup->bitmap_mode,
backup->compress, backup->discard_source,
backup->filter_node_name,
- &perf,
+ &perf, NULL,
backup->on_source_error,
backup->on_target_error,
job_flags, NULL, NULL, txn, errp);
diff --git a/include/block/block_int-global-state.h b/include/block/block_int-global-state.h
index f0c642b194..7332680087 100644
--- a/include/block/block_int-global-state.h
+++ b/include/block/block_int-global-state.h
@@ -179,6 +179,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
* @bitmap_mode: The bitmap synchronization policy to use.
* @perf: Performance options. All actual fields assumed to be present,
* all ".has_*" fields are ignored.
+ * @cbw_opts: Additional options to configure cbw filter with.
* @on_source_error: The action to take upon error reading from the source.
* @on_target_error: The action to take upon error writing to the target.
* @creation_flags: Flags that control the behavior of the Job lifetime.
@@ -198,6 +199,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
bool compress, bool discard_source,
const char *filter_node_name,
BackupPerf *perf,
+ QDict *cbw_opts,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
int creation_flags,
diff --git a/pve-backup.c b/pve-backup.c
index 4e80a9f283..108e185a20 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -635,7 +635,7 @@ static void create_backup_jobs_bh(void *opaque) {
BlockJob *job = backup_job_create(
job_id, source_bs, di->target, backup_state.speed, sync_mode, di->bitmap,
- bitmap_mode, false, discard_source, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT,
+ bitmap_mode, false, discard_source, NULL, &perf, NULL, BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT, JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn,
&local_err);
--
2.39.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-06-10 12:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 12:59 [pve-devel] [RFC qemu] fix #3231+#3631: PVE backup: fail backup rather than guest write when backup target cannot be reached or is too slow Fiona Ebner
2024-06-10 12:59 ` [pve-devel] [PATCH qemu 1/7] PVE backup: fleecing: properly set minimum cluster size Fiona Ebner
2024-06-10 12:59 ` [pve-devel] [RFC qemu 2/7] block/copy-before-write: allow passing additional options for bdrv_cbw_append() Fiona Ebner
2024-06-10 12:59 ` Fiona Ebner [this message]
2024-07-05 9:30 ` [pve-devel] [RFC qemu 3/7] block/backup: allow passing additional options for copy-before-write upon job creation Fabian Grünbichler
2024-06-10 12:59 ` [pve-devel] [RFC qemu 4/7] block/backup: make cbw error also fail backup that does not use fleecing Fiona Ebner
2024-06-10 12:59 ` [pve-devel] [RFC qemu 5/7] fix #3231+#3631: PVE backup: add timeout for copy-before-write operations and fail backup instead of guest writes Fiona Ebner
2024-06-10 12:59 ` [pve-devel] [RFC qemu 6/7] block/copy-before-write: allow specifying error callback Fiona Ebner
2024-06-10 12:59 ` [pve-devel] [RFC qemu 7/7] block/backup: set callback for cbw errors Fiona Ebner
2024-07-05 9:37 ` Fabian Grünbichler
2024-07-05 9:41 ` [pve-devel] [RFC qemu] fix #3231+#3631: PVE backup: fail backup rather than guest write when backup target cannot be reached or is too slow Fabian Grünbichler
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=20240610125942.116985-4-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-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