qapi: Rename 'dirty-bitmap' mode to 'incremental'

If we wish to make differential backups a feature that's easy to access,
it might be pertinent to rename the "dirty-bitmap" mode to "incremental"
to make it clear what /type/ of backup the dirty-bitmap is helping us
perform.

This is an API breaking change, but 2.4 has not yet gone live,
so we have this flexibility.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1433463642-21840-2-git-send-email-jsnow@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
John Snow 2015-06-04 20:20:34 -04:00 committed by Stefan Hajnoczi
parent 3e5feb6202
commit 4b80ab2b7d
7 changed files with 22 additions and 22 deletions

View File

@ -38,7 +38,7 @@ typedef struct CowRequest {
typedef struct BackupBlockJob { typedef struct BackupBlockJob {
BlockJob common; BlockJob common;
BlockDriverState *target; BlockDriverState *target;
/* bitmap for sync=dirty-bitmap */ /* bitmap for sync=incremental */
BdrvDirtyBitmap *sync_bitmap; BdrvDirtyBitmap *sync_bitmap;
MirrorSyncMode sync_mode; MirrorSyncMode sync_mode;
RateLimit limit; RateLimit limit;
@ -365,7 +365,7 @@ static void coroutine_fn backup_run(void *opaque)
qemu_coroutine_yield(); qemu_coroutine_yield();
job->common.busy = true; job->common.busy = true;
} }
} else if (job->sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) { } else if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
ret = backup_run_incremental(job); ret = backup_run_incremental(job);
} else { } else {
/* Both FULL and TOP SYNC_MODE's require copying.. */ /* Both FULL and TOP SYNC_MODE's require copying.. */
@ -497,10 +497,10 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
return; return;
} }
if (sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) { if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
if (!sync_bitmap) { if (!sync_bitmap) {
error_setg(errp, "must provide a valid bitmap name for " error_setg(errp, "must provide a valid bitmap name for "
"\"dirty-bitmap\" sync mode"); "\"incremental\" sync mode");
return; return;
} }
@ -535,7 +535,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
job->on_target_error = on_target_error; job->on_target_error = on_target_error;
job->target = target; job->target = target;
job->sync_mode = sync_mode; job->sync_mode = sync_mode;
job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_DIRTY_BITMAP ? job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ?
sync_bitmap : NULL; sync_bitmap : NULL;
job->common.len = len; job->common.len = len;
job->common.co = qemu_coroutine_create(backup_run); job->common.co = qemu_coroutine_create(backup_run);

View File

@ -710,8 +710,8 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target,
bool is_none_mode; bool is_none_mode;
BlockDriverState *base; BlockDriverState *base;
if (mode == MIRROR_SYNC_MODE_DIRTY_BITMAP) { if (mode == MIRROR_SYNC_MODE_INCREMENTAL) {
error_setg(errp, "Sync mode 'dirty-bitmap' not supported"); error_setg(errp, "Sync mode 'incremental' not supported");
return; return;
} }
is_none_mode = mode == MIRROR_SYNC_MODE_NONE; is_none_mode = mode == MIRROR_SYNC_MODE_NONE;

View File

@ -210,7 +210,7 @@ full backup as a backing image.
"bitmap": "bitmap0", "bitmap": "bitmap0",
"target": "incremental.0.img", "target": "incremental.0.img",
"format": "qcow2", "format": "qcow2",
"sync": "dirty-bitmap", "sync": "incremental",
"mode": "existing" "mode": "existing"
} }
} }
@ -235,7 +235,7 @@ full backup as a backing image.
"bitmap": "bitmap0", "bitmap": "bitmap0",
"target": "incremental.1.img", "target": "incremental.1.img",
"format": "qcow2", "format": "qcow2",
"sync": "dirty-bitmap", "sync": "incremental",
"mode": "existing" "mode": "existing"
} }
} }
@ -275,7 +275,7 @@ full backup as a backing image.
"bitmap": "bitmap0", "bitmap": "bitmap0",
"target": "incremental.0.img", "target": "incremental.0.img",
"format": "qcow2", "format": "qcow2",
"sync": "dirty-bitmap", "sync": "incremental",
"mode": "existing" "mode": "existing"
} }
} }
@ -308,7 +308,7 @@ full backup as a backing image.
"bitmap": "bitmap0", "bitmap": "bitmap0",
"target": "incremental.0.img", "target": "incremental.0.img",
"format": "qcow2", "format": "qcow2",
"sync": "dirty-bitmap", "sync": "incremental",
"mode": "existing" "mode": "existing"
} }
} }

View File

@ -635,7 +635,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target,
* @target: Block device to write to. * @target: Block device to write to.
* @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @speed: The maximum speed, in bytes per second, or 0 for unlimited.
* @sync_mode: What parts of the disk image should be copied to the destination. * @sync_mode: What parts of the disk image should be copied to the destination.
* @sync_bitmap: The dirty bitmap if sync_mode is MIRROR_SYNC_MODE_DIRTY_BITMAP. * @sync_bitmap: The dirty bitmap if sync_mode is MIRROR_SYNC_MODE_INCREMENTAL.
* @on_source_error: The action to take upon error reading from the source. * @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. * @on_target_error: The action to take upon error writing to the target.
* @cb: Completion function for the job. * @cb: Completion function for the job.

View File

@ -536,12 +536,12 @@
# #
# @none: only copy data written from now on # @none: only copy data written from now on
# #
# @dirty-bitmap: only copy data described by the dirty bitmap. Since: 2.4 # @incremental: only copy data described by the dirty bitmap. Since: 2.4
# #
# Since: 1.3 # Since: 1.3
## ##
{ 'enum': 'MirrorSyncMode', { 'enum': 'MirrorSyncMode',
'data': ['top', 'full', 'none', 'dirty-bitmap'] } 'data': ['top', 'full', 'none', 'incremental'] }
## ##
# @BlockJobType: # @BlockJobType:
@ -724,8 +724,8 @@
# #
# @speed: #optional the maximum speed, in bytes per second # @speed: #optional the maximum speed, in bytes per second
# #
# @bitmap: #optional the name of dirty bitmap if sync is "dirty-bitmap". # @bitmap: #optional the name of dirty bitmap if sync is "incremental".
# Must be present if sync is "dirty-bitmap", must NOT be present # Must be present if sync is "incremental", must NOT be present
# otherwise. (Since 2.4) # otherwise. (Since 2.4)
# #
# @on-source-error: #optional the action to take on an error on the source, # @on-source-error: #optional the action to take on an error on the source,

View File

@ -1137,10 +1137,10 @@ Arguments:
(json-string, optional) (json-string, optional)
- "sync": what parts of the disk image should be copied to the destination; - "sync": what parts of the disk image should be copied to the destination;
possibilities include "full" for all the disk, "top" for only the sectors possibilities include "full" for all the disk, "top" for only the sectors
allocated in the topmost image, "dirty-bitmap" for only the dirty sectors in allocated in the topmost image, "incremental" for only the dirty sectors in
the bitmap, or "none" to only replicate new I/O (MirrorSyncMode). the bitmap, or "none" to only replicate new I/O (MirrorSyncMode).
- "bitmap": dirty bitmap name for sync==dirty-bitmap. Must be present if sync - "bitmap": dirty bitmap name for sync==incremental. Must be present if sync
is "dirty-bitmap", must NOT be present otherwise. is "incremental", must NOT be present otherwise.
- "mode": whether and how QEMU should create a new image - "mode": whether and how QEMU should create a new image
(NewImageMode, optional, default 'absolute-paths') (NewImageMode, optional, default 'absolute-paths')
- "speed": the maximum speed, in bytes per second (json-int, optional) - "speed": the maximum speed, in bytes per second (json-int, optional)

View File

@ -187,7 +187,7 @@ class TestIncrementalBackup(iotests.QMPTestCase):
target = self.prepare_backup(bitmap, parent) target = self.prepare_backup(bitmap, parent)
res = self.do_qmp_backup(device=bitmap.drive['id'], res = self.do_qmp_backup(device=bitmap.drive['id'],
sync='dirty-bitmap', bitmap=bitmap.name, sync='incremental', bitmap=bitmap.name,
format=bitmap.drive['fmt'], target=target, format=bitmap.drive['fmt'], target=target,
mode='existing') mode='existing')
if not res: if not res:
@ -325,7 +325,7 @@ class TestIncrementalBackup(iotests.QMPTestCase):
self.assert_no_active_block_jobs() self.assert_no_active_block_jobs()
self.files.append(self.err_img) self.files.append(self.err_img)
result = self.vm.qmp('drive-backup', device=self.drives[0]['id'], result = self.vm.qmp('drive-backup', device=self.drives[0]['id'],
sync='dirty-bitmap', format=self.drives[0]['fmt'], sync='incremental', format=self.drives[0]['fmt'],
target=self.err_img) target=self.err_img)
self.assert_qmp(result, 'error/class', 'GenericError') self.assert_qmp(result, 'error/class', 'GenericError')
@ -334,7 +334,7 @@ class TestIncrementalBackup(iotests.QMPTestCase):
self.assert_no_active_block_jobs() self.assert_no_active_block_jobs()
self.files.append(self.err_img) self.files.append(self.err_img)
result = self.vm.qmp('drive-backup', device=self.drives[0]['id'], result = self.vm.qmp('drive-backup', device=self.drives[0]['id'],
sync='dirty-bitmap', bitmap='unknown', sync='incremental', bitmap='unknown',
format=self.drives[0]['fmt'], target=self.err_img) format=self.drives[0]['fmt'], target=self.err_img)
self.assert_qmp(result, 'error/class', 'GenericError') self.assert_qmp(result, 'error/class', 'GenericError')