@@ -37,7 +37,7 @@ typedef struct BackupBlockJob {
BdrvDirtyBitmap *sync_bitmap;
- MirrorSyncMode sync_mode;
+ BackupSyncMode sync_mode;
BitmapSyncMode bitmap_mode;
BlockdevOnError on_source_error;
BlockdevOnError on_target_error;
@@ -111,7 +111,7 @@ void backup_do_checkpoint(BlockJob *job, Error **errp)
assert(block_job_driver(job) == &backup_job_driver);
- if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) {
+ if (backup_job->sync_mode != BACKUP_SYNC_MODE_NONE) {
error_setg(errp, "The backup job only supports block checkpoint in"
" sync=none mode");
return;
@@ -231,11 +231,11 @@ static void backup_init_bcs_bitmap(BackupBlockJob *job)
uint64_t estimate;
BdrvDirtyBitmap *bcs_bitmap = block_copy_dirty_bitmap(job->bcs);
- if (job->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
+ if (job->sync_mode == BACKUP_SYNC_MODE_BITMAP) {
bdrv_clear_dirty_bitmap(bcs_bitmap, NULL);
bdrv_dirty_bitmap_merge_internal(bcs_bitmap, job->sync_bitmap, NULL,
true);
- } else if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
+ } else if (job->sync_mode == BACKUP_SYNC_MODE_TOP) {
/*
* We can't hog the coroutine to initialize this thoroughly.
* Set a flag and resume work when we are able to yield safely.
@@ -254,7 +254,7 @@ static int coroutine_fn backup_run(Job *job, Error **errp)
backup_init_bcs_bitmap(s);
- if (s->sync_mode == MIRROR_SYNC_MODE_TOP) {
+ if (s->sync_mode == BACKUP_SYNC_MODE_TOP) {
int64_t offset = 0;
int64_t count;
@@ -282,7 +282,7 @@ static int coroutine_fn backup_run(Job *job, Error **errp)
block_copy_set_skip_unallocated(s->bcs, false);
}
- if (s->sync_mode == MIRROR_SYNC_MODE_NONE) {
+ if (s->sync_mode == BACKUP_SYNC_MODE_NONE) {
/*
* All bits are set in bcs bitmap to allow any cluster to be copied.
* This does not actually require them to be copied.
@@ -354,7 +354,7 @@ static const BlockJobDriver backup_job_driver = {
BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, int64_t speed,
- MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap,
+ BackupSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap,
BitmapSyncMode bitmap_mode,
bool compress,
const char *filter_node_name,
@@ -376,8 +376,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
GLOBAL_STATE_CODE();
/* QMP interface protects us from these cases */
- assert(sync_mode != MIRROR_SYNC_MODE_INCREMENTAL);
- assert(sync_bitmap || sync_mode != MIRROR_SYNC_MODE_BITMAP);
+ assert(sync_mode != BACKUP_SYNC_MODE_INCREMENTAL);
+ assert(sync_bitmap || sync_mode != BACKUP_SYNC_MODE_BITMAP);
if (bs == target) {
error_setg(errp, "Source and target cannot be the same");
@@ -2013,13 +2013,6 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
GLOBAL_STATE_CODE();
- if ((mode == MIRROR_SYNC_MODE_INCREMENTAL) ||
- (mode == MIRROR_SYNC_MODE_BITMAP)) {
- error_setg(errp, "Sync mode '%s' not supported",
- MirrorSyncMode_str(mode));
- return;
- }
-
bdrv_graph_rdlock_main_loop();
is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
base = mode == MIRROR_SYNC_MODE_TOP ? bdrv_backing_chain_next(bs) : NULL;
@@ -266,7 +266,7 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)
.device = (char *)device,
.target = (char *)filename,
.format = (char *)format,
- .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
+ .sync = full ? BACKUP_SYNC_MODE_FULL : BACKUP_SYNC_MODE_TOP,
.has_mode = true,
.mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS,
.has_compress = !!compress,
@@ -582,7 +582,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, NULL,
+ 0, BACKUP_SYNC_MODE_NONE, NULL, 0, false, NULL,
&perf,
BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
@@ -1643,7 +1643,7 @@ static void drive_backup_action(DriveBackup *backup,
* See if we have a backing HD we can use to create our new image
* on top of.
*/
- if (backup->sync == MIRROR_SYNC_MODE_TOP) {
+ if (backup->sync == BACKUP_SYNC_MODE_TOP) {
/*
* Backup will not replace the source by the target, so none
* of the filters skipped here will be removed (in contrast to
@@ -1652,10 +1652,10 @@ static void drive_backup_action(DriveBackup *backup,
*/
source = bdrv_cow_bs(bdrv_skip_filters(bs));
if (!source) {
- backup->sync = MIRROR_SYNC_MODE_FULL;
+ backup->sync = BACKUP_SYNC_MODE_FULL;
}
}
- if (backup->sync == MIRROR_SYNC_MODE_NONE) {
+ if (backup->sync == BACKUP_SYNC_MODE_NONE) {
source = bs;
flags |= BDRV_O_NO_BACKING;
set_backing_hd = true;
@@ -2655,27 +2655,27 @@ static BlockJob *do_backup_common(BackupCommon *backup,
}
}
- if ((backup->sync == MIRROR_SYNC_MODE_BITMAP) ||
- (backup->sync == MIRROR_SYNC_MODE_INCREMENTAL)) {
+ if ((backup->sync == BACKUP_SYNC_MODE_BITMAP) ||
+ (backup->sync == BACKUP_SYNC_MODE_INCREMENTAL)) {
/* done before desugaring 'incremental' to print the right message */
if (!backup->bitmap) {
error_setg(errp, "must provide a valid bitmap name for "
- "'%s' sync mode", MirrorSyncMode_str(backup->sync));
+ "'%s' sync mode", BackupSyncMode_str(backup->sync));
return NULL;
}
}
- if (backup->sync == MIRROR_SYNC_MODE_INCREMENTAL) {
+ if (backup->sync == BACKUP_SYNC_MODE_INCREMENTAL) {
if (backup->has_bitmap_mode &&
backup->bitmap_mode != BITMAP_SYNC_MODE_ON_SUCCESS) {
error_setg(errp, "Bitmap sync mode must be '%s' "
"when using sync mode '%s'",
BitmapSyncMode_str(BITMAP_SYNC_MODE_ON_SUCCESS),
- MirrorSyncMode_str(backup->sync));
+ BackupSyncMode_str(backup->sync));
return NULL;
}
backup->has_bitmap_mode = true;
- backup->sync = MIRROR_SYNC_MODE_BITMAP;
+ backup->sync = BACKUP_SYNC_MODE_BITMAP;
backup->bitmap_mode = BITMAP_SYNC_MODE_ON_SUCCESS;
}
@@ -2695,19 +2695,19 @@ static BlockJob *do_backup_common(BackupCommon *backup,
}
/* This does not produce a useful bitmap artifact: */
- if (backup->sync == MIRROR_SYNC_MODE_NONE) {
+ if (backup->sync == BACKUP_SYNC_MODE_NONE) {
error_setg(errp, "sync mode '%s' does not produce meaningful bitmap"
- " outputs", MirrorSyncMode_str(backup->sync));
+ " outputs", BackupSyncMode_str(backup->sync));
return NULL;
}
/* If the bitmap isn't used for input or output, this is useless: */
if (backup->bitmap_mode == BITMAP_SYNC_MODE_NEVER &&
- backup->sync != MIRROR_SYNC_MODE_BITMAP) {
+ backup->sync != BACKUP_SYNC_MODE_BITMAP) {
error_setg(errp, "Bitmap sync mode '%s' has no meaningful effect"
" when combined with sync mode '%s'",
BitmapSyncMode_str(backup->bitmap_mode),
- MirrorSyncMode_str(backup->sync));
+ BackupSyncMode_str(backup->sync));
return NULL;
}
}
@@ -190,7 +190,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
*/
BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, int64_t speed,
- MirrorSyncMode sync_mode,
+ BackupSyncMode sync_mode,
BdrvDirtyBitmap *sync_bitmap,
BitmapSyncMode bitmap_mode,
bool compress,
@@ -1304,10 +1304,10 @@
'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] }
##
-# @MirrorSyncMode:
+# @BackupSyncMode:
#
-# An enumeration of possible behaviors for the initial synchronization
-# phase of storage mirroring.
+# An enumeration of possible behaviors for image synchronization used
+# by backup jobs.
#
# @top: copies data in the topmost image to the destination
#
@@ -1323,7 +1323,7 @@
#
# Since: 1.3
##
-{ 'enum': 'MirrorSyncMode',
+{ 'enum': 'BackupSyncMode',
'data': ['top', 'full', 'none', 'incremental', 'bitmap'] }
##
@@ -1347,6 +1347,23 @@
{ 'enum': 'BitmapSyncMode',
'data': ['on-success', 'never', 'always'] }
+##
+# @MirrorSyncMode:
+#
+# An enumeration of possible behaviors for the initial synchronization
+# phase of storage mirroring.
+#
+# @top: copies data in the topmost image to the destination
+#
+# @full: copies data from all images to the destination
+#
+# @none: only copy data written from now on
+#
+# Since: 1.3
+##
+{ 'enum': 'MirrorSyncMode',
+ 'data': ['top', 'full', 'none'] }
+
##
# @MirrorCopyMode:
#
@@ -1624,7 +1641,7 @@
##
{ 'struct': 'BackupCommon',
'data': { '*job-id': 'str', 'device': 'str',
- 'sync': 'MirrorSyncMode', '*speed': 'int',
+ 'sync': 'BackupSyncMode', '*speed': 'int',
'*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode',
'*compress': 'bool',
'*on-source-error': 'BlockdevOnError',