@@ -1924,6 +1924,7 @@ typedef struct BlockdevBackupState {
static void do_blockdev_backup(const char *device, const char *target,
enum MirrorSyncMode sync,
bool has_speed, int64_t speed,
+ bool has_compress, bool compress,
bool has_on_source_error,
BlockdevOnError on_source_error,
bool has_on_target_error,
@@ -1971,6 +1972,7 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
do_blockdev_backup(backup->device, backup->target,
backup->sync,
backup->has_speed, backup->speed,
+ backup->has_compress, backup->compress,
backup->has_on_source_error, backup->on_source_error,
backup->has_on_target_error, backup->on_target_error,
common->block_job_txn, &local_err);
@@ -3337,6 +3339,7 @@ BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp)
void do_blockdev_backup(const char *device, const char *target,
enum MirrorSyncMode sync,
bool has_speed, int64_t speed,
+ bool has_compress, bool compress,
bool has_on_source_error,
BlockdevOnError on_source_error,
bool has_on_target_error,
@@ -3358,6 +3361,9 @@ void do_blockdev_backup(const char *device, const char *target,
if (!has_on_target_error) {
on_target_error = BLOCKDEV_ON_ERROR_REPORT;
}
+ if (!has_compress) {
+ compress = false;
+ }
blk = blk_by_name(device);
if (!blk) {
@@ -3387,7 +3393,7 @@ void do_blockdev_backup(const char *device, const char *target,
target_bs = blk_bs(target_blk);
bdrv_set_aio_context(target_bs, aio_context);
- backup_start(bs, target_bs, speed, sync, NULL, false, on_source_error,
+ backup_start(bs, target_bs, speed, sync, NULL, compress, on_source_error,
on_target_error, block_job_cb, bs, txn, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
@@ -3399,6 +3405,7 @@ out:
void qmp_blockdev_backup(const char *device, const char *target,
enum MirrorSyncMode sync,
bool has_speed, int64_t speed,
+ bool has_compress, bool compress,
bool has_on_source_error,
BlockdevOnError on_source_error,
bool has_on_target_error,
@@ -3406,6 +3413,7 @@ void qmp_blockdev_backup(const char *device, const char *target,
Error **errp)
{
do_blockdev_backup(device, target, sync, has_speed, speed,
+ has_compress, compress,
has_on_source_error, on_source_error,
has_on_target_error, on_target_error,
NULL, errp);
@@ -926,6 +926,9 @@
# @speed: #optional the maximum speed, in bytes per second. The default is 0,
# for unlimited.
#
+# @compress: #optional the compression data blocks (if the target format
+# supports it; default: false).
+#
# @on-source-error: #optional the action to take on an error on the source,
# default 'report'. 'stop' and 'enospc' can only be used
# if the block device supports io-status (see BlockInfo).
@@ -944,6 +947,7 @@
'data': { 'device': 'str', 'target': 'str',
'sync': 'MirrorSyncMode',
'*speed': 'int',
+ '*compress': 'bool',
'*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError' } }
@@ -1242,7 +1242,7 @@ EQMP
{
.name = "blockdev-backup",
- .args_type = "sync:s,device:B,target:B,speed:i?,"
+ .args_type = "sync:s,device:B,target:B,speed:i?,compress:b?,"
"on-source-error:s?,on-target-error:s?",
.mhandler.cmd_new = qmp_marshal_blockdev_backup,
},
@@ -1264,6 +1264,8 @@ Arguments:
sectors allocated in the topmost image, or "none" to only replicate
new I/O (MirrorSyncMode).
- "speed": the maximum speed, in bytes per second (json-int, optional)
+- "compress": the compression data blocks (if the target format supports it).
+ (json-bool, optional, default false)
- "on-source-error": the action to take on an error on the source, default
'report'. 'stop' and 'enospc' can only be used
if the block device supports io-status.