2018-02-19 12:38:54 +03:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-08-07 10:10:07 +03:00
|
|
|
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
2020-04-07 17:53:19 +03:00
|
|
|
Date: Mon, 6 Apr 2020 12:16:56 +0200
|
|
|
|
Subject: [PATCH] PVE-Backup: modify job api
|
2017-08-07 10:10:07 +03:00
|
|
|
|
|
|
|
Introduce a pause_count parameter to start a backup in
|
|
|
|
paused mode. This way backups of multiple drives can be
|
|
|
|
started up sequentially via the completion callback while
|
|
|
|
having been started at the same point in time.
|
2019-06-06 13:58:15 +03:00
|
|
|
|
|
|
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
2017-08-07 10:10:07 +03:00
|
|
|
---
|
2020-03-10 17:12:50 +03:00
|
|
|
block/backup.c | 3 +++
|
2017-08-07 10:10:07 +03:00
|
|
|
block/replication.c | 2 +-
|
2020-03-10 17:12:50 +03:00
|
|
|
blockdev.c | 3 ++-
|
2017-08-07 10:10:07 +03:00
|
|
|
include/block/block_int.h | 1 +
|
2018-08-30 16:00:07 +03:00
|
|
|
job.c | 2 +-
|
2020-03-10 17:12:50 +03:00
|
|
|
5 files changed, 8 insertions(+), 3 deletions(-)
|
2017-08-07 10:10:07 +03:00
|
|
|
|
|
|
|
diff --git a/block/backup.c b/block/backup.c
|
2020-08-20 11:42:45 +03:00
|
|
|
index 4f13bb20a5..5f373a4f9b 100644
|
2017-08-07 10:10:07 +03:00
|
|
|
--- a/block/backup.c
|
|
|
|
+++ b/block/backup.c
|
2020-04-07 17:53:19 +03:00
|
|
|
@@ -338,6 +338,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
2017-08-07 10:10:07 +03:00
|
|
|
BlockdevOnError on_target_error,
|
|
|
|
int creation_flags,
|
|
|
|
BlockCompletionFunc *cb, void *opaque,
|
|
|
|
+ int pause_count,
|
2018-08-30 16:00:07 +03:00
|
|
|
JobTxn *txn, Error **errp)
|
2017-08-07 10:10:07 +03:00
|
|
|
{
|
2020-08-20 11:42:45 +03:00
|
|
|
int64_t len, target_len;
|
|
|
|
@@ -471,6 +472,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
2017-08-07 10:10:07 +03:00
|
|
|
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
|
|
|
|
&error_abort);
|
|
|
|
|
2020-03-10 17:12:50 +03:00
|
|
|
+ job->common.job.pause_count += pause_count;
|
|
|
|
+
|
2017-08-07 10:10:07 +03:00
|
|
|
return &job->common;
|
2018-08-30 16:00:07 +03:00
|
|
|
|
2020-03-10 17:12:50 +03:00
|
|
|
error:
|
2017-08-07 10:10:07 +03:00
|
|
|
diff --git a/block/replication.c b/block/replication.c
|
2020-08-20 11:42:45 +03:00
|
|
|
index 0c70215784..59270a0468 100644
|
2017-08-07 10:10:07 +03:00
|
|
|
--- a/block/replication.c
|
|
|
|
+++ b/block/replication.c
|
2020-08-20 11:42:45 +03:00
|
|
|
@@ -560,7 +560,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
|
2020-03-10 17:12:50 +03:00
|
|
|
0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, NULL,
|
2017-08-07 10:10:07 +03:00
|
|
|
BLOCKDEV_ON_ERROR_REPORT,
|
2018-08-30 16:00:07 +03:00
|
|
|
BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
|
2017-08-07 10:10:07 +03:00
|
|
|
- backup_job_completed, bs, NULL, &local_err);
|
|
|
|
+ backup_job_completed, bs, 0, NULL, &local_err);
|
|
|
|
if (local_err) {
|
|
|
|
error_propagate(errp, local_err);
|
|
|
|
backup_job_cleanup(bs);
|
|
|
|
diff --git a/blockdev.c b/blockdev.c
|
2020-08-20 11:42:45 +03:00
|
|
|
index 3848a9c8ab..5107c5445e 100644
|
2017-08-07 10:10:07 +03:00
|
|
|
--- a/blockdev.c
|
|
|
|
+++ b/blockdev.c
|
2020-08-20 11:42:45 +03:00
|
|
|
@@ -2832,7 +2832,8 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
2020-03-10 17:12:50 +03:00
|
|
|
backup->filter_node_name,
|
|
|
|
backup->on_source_error,
|
|
|
|
backup->on_target_error,
|
|
|
|
- job_flags, NULL, NULL, txn, errp);
|
|
|
|
+ job_flags, NULL, NULL, 0, txn, errp);
|
|
|
|
+
|
|
|
|
return job;
|
|
|
|
}
|
|
|
|
|
2017-08-07 10:10:07 +03:00
|
|
|
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
2020-08-20 11:42:45 +03:00
|
|
|
index 38dec0275b..5094ae1e95 100644
|
2017-08-07 10:10:07 +03:00
|
|
|
--- a/include/block/block_int.h
|
|
|
|
+++ b/include/block/block_int.h
|
2020-08-20 11:42:45 +03:00
|
|
|
@@ -1254,6 +1254,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
2017-08-07 10:10:07 +03:00
|
|
|
BlockdevOnError on_target_error,
|
|
|
|
int creation_flags,
|
|
|
|
BlockCompletionFunc *cb, void *opaque,
|
|
|
|
+ int pause_count,
|
2018-08-30 16:00:07 +03:00
|
|
|
JobTxn *txn, Error **errp);
|
2017-08-07 10:10:07 +03:00
|
|
|
|
2020-04-07 17:53:19 +03:00
|
|
|
BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
|
2018-08-30 16:00:07 +03:00
|
|
|
diff --git a/job.c b/job.c
|
2020-04-07 17:53:19 +03:00
|
|
|
index 53be57a3a0..e82253e041 100644
|
2018-08-30 16:00:07 +03:00
|
|
|
--- a/job.c
|
|
|
|
+++ b/job.c
|
2020-04-07 17:53:19 +03:00
|
|
|
@@ -918,7 +918,7 @@ void job_start(Job *job)
|
2018-08-30 16:00:07 +03:00
|
|
|
job->co = qemu_coroutine_create(job_co_entry, job);
|
|
|
|
job->pause_count--;
|
|
|
|
job->busy = true;
|
|
|
|
- job->paused = false;
|
|
|
|
+ job->paused = job->pause_count > 0;
|
|
|
|
job_state_transition(job, JOB_STATUS_RUNNING);
|
|
|
|
aio_co_enter(job->aio_context, job->co);
|
|
|
|
}
|