1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Mon, 6 Apr 2020 12:16:56 +0200
4 Subject: [PATCH] PVE-Backup: modify job api
6 Introduce a pause_count parameter to start a backup in
7 paused mode. This way backups of multiple drives can be
8 started up sequentially via the completion callback while
9 having been started at the same point in time.
11 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 block/backup.c | 3 +++
14 block/replication.c | 2 +-
16 include/block/block_int.h | 1 +
18 5 files changed, 8 insertions(+), 3 deletions(-)
20 diff --git a/block/backup.c b/block/backup.c
21 index a7a7dcaf4c..ecd93e91e0 100644
24 @@ -338,6 +338,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
25 BlockdevOnError on_target_error,
27 BlockCompletionFunc *cb, void *opaque,
29 JobTxn *txn, Error **errp)
32 @@ -459,6 +460,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
33 block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
36 + job->common.job.pause_count += pause_count;
41 diff --git a/block/replication.c b/block/replication.c
42 index da013c2041..17246a822c 100644
43 --- a/block/replication.c
44 +++ b/block/replication.c
45 @@ -554,7 +554,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
46 0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, NULL,
47 BLOCKDEV_ON_ERROR_REPORT,
48 BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
49 - backup_job_completed, bs, NULL, &local_err);
50 + backup_job_completed, bs, 0, NULL, &local_err);
52 error_propagate(errp, local_err);
53 backup_job_cleanup(bs);
54 diff --git a/blockdev.c b/blockdev.c
55 index 5faddaa705..65c358e4ef 100644
58 @@ -3114,7 +3114,8 @@ static BlockJob *do_backup_common(BackupCommon *backup,
59 backup->filter_node_name,
60 backup->on_source_error,
61 backup->on_target_error,
62 - job_flags, NULL, NULL, txn, errp);
63 + job_flags, NULL, NULL, 0, txn, errp);
68 diff --git a/include/block/block_int.h b/include/block/block_int.h
69 index 4c3587ea19..336f71e69d 100644
70 --- a/include/block/block_int.h
71 +++ b/include/block/block_int.h
72 @@ -1219,6 +1219,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
73 BlockdevOnError on_target_error,
75 BlockCompletionFunc *cb, void *opaque,
77 JobTxn *txn, Error **errp);
79 BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
80 diff --git a/job.c b/job.c
81 index 53be57a3a0..e82253e041 100644
84 @@ -918,7 +918,7 @@ void job_start(Job *job)
85 job->co = qemu_coroutine_create(job_co_entry, job);
88 - job->paused = false;
89 + job->paused = job->pause_count > 0;
90 job_state_transition(job, JOB_STATUS_RUNNING);
91 aio_co_enter(job->aio_context, job->co);