1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Tue, 10 Mar 2020 12:55:16 +0100
4 Subject: [PATCH 19/32] 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 cf62b1a38c..c155081de2 100644
24 @@ -347,6 +347,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 @@ -468,6 +469,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 99532ce521..ec8de7b427 100644
43 --- a/block/replication.c
44 +++ b/block/replication.c
45 @@ -546,7 +546,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 8e029e9c01..c7fa663ebf 100644
58 @@ -3583,7 +3583,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 dd033d0b37..b0d5eb9485 100644
70 --- a/include/block/block_int.h
71 +++ b/include/block/block_int.h
72 @@ -1215,6 +1215,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 void hmp_drive_add_node(Monitor *mon, const char *optstr);
80 diff --git a/job.c b/job.c
81 index 04409b40aa..7554f735e3 100644
84 @@ -888,7 +888,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);