From b6c1bae5df8abbed73c4c0bd92e9963df8829c74 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for block-stream In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts block-stream to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- qmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 6866264e64..48b7fdcfb8 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1120,7 +1120,7 @@ Arguments: - "job-id": Identifier for the newly-created block job. If omitted, the device name will be used. (json-string, optional) -- "device": The device's ID, must be unique (json-string) +- "device": The device name or node-name of a root node (json-string) - "base": The file name of the backing image above which copying starts (json-string, optional) - "backing-file": The backing file string to write into the active layer. This -- cgit v1.2.3 From 1d13b167fd40c0ac8dfd779f150d8643afd508dc Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for block-commit In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts block-commit to accept a node-name without lifting the restriction that we're operating at a root node. As libvirt makes use of the DeviceNotFound error class, we must add explicit code to retain this behaviour because qmp_get_root_bs() only returns GenericErrors. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- qmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 48b7fdcfb8..b53466039a 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1166,7 +1166,7 @@ Arguments: - "job-id": Identifier for the newly-created block job. If omitted, the device name will be used. (json-string, optional) -- "device": The device's ID, must be unique (json-string) +- "device": The device name or node-name of a root node (json-string) - "base": The file name of the backing image to write data into. If not specified, this is the deepest backing image (json-string, optional) -- cgit v1.2.3 From cef34eebf3d0f252a3b3e9a2a459b6c3ecc56f68 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for blockdev-backup In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts blockdev-backup and the corresponding transaction action to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- qmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index b53466039a..2077585dd3 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1288,7 +1288,7 @@ Arguments: - "job-id": Identifier for the newly-created block job. If omitted, the device name will be used. (json-string, optional) -- "device": the name of the device which should be copied. +- "device": the device name or node-name of a root node which should be copied. (json-string) - "target": the name of the backup target device. (json-string) - "sync": what parts of the disk image should be copied to the destination; -- cgit v1.2.3 From 07eec652722f3d12b07c5b28d0671ddfc22fe6a5 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for blockdev-mirror In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts blockdev-mirror to accept a node-name without lifting the restriction that we're operating at a root node. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- qmp-commands.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 2077585dd3..034d51718c 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1747,7 +1747,8 @@ Arguments: - "job-id": Identifier for the newly-created block job. If omitted, the device name will be used. (json-string, optional) -- "device": device name to operate on (json-string) +- "device": The device name or node-name of a root node whose writes should be + mirrored (json-string) - "target": device name to mirror to (json-string) - "replaces": the block driver node name to replace when finished (json-string, optional) -- cgit v1.2.3 From 2dfb4c033f2f8fbad252bed1ba3e0fed112cbb7c Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for blockdev-snapshot-delete-internal-sync In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts blockdev-snapshot-delete-internal-sync to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- qmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 034d51718c..6793c8d36b 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1639,7 +1639,7 @@ fail. Arguments: -- "device": device name (json-string) +- "device": the device name or node-name of a root node (json-string) - "id": ID of the snapshot (json-string, optional) - "name": name of the snapshot (json-string, optional) -- cgit v1.2.3 From 75dfd402a734e8080fa77a1bcf60ecc46e0e6158 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for blockdev-snapshot-internal-sync In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts blockdev-snapshot-internal-sync to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- qmp-commands.hx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 6793c8d36b..eb2736009f 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1407,7 +1407,8 @@ actions array: - "mode": whether and how QEMU should create the snapshot file (NewImageMode, optional, default "absolute-paths") When "type" is "blockdev-snapshot-internal-sync": - - "device": device name to snapshot (json-string) + - "device": the device name or node-name of a root node to snapshot + (json-string) - "name": name of the new snapshot (json-string) Example: @@ -1608,7 +1609,8 @@ name already exists, the operation will fail. Arguments: -- "device": device name to snapshot (json-string) +- "device": the device name or node-name of a root node to snapshot + (json-string) - "name": name of the new snapshot (json-string) Example: -- cgit v1.2.3 From 7b5dca3f0215ec6484473631928a36c3eb8da0ef Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for change-backing-file In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts change-backing-file to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- qmp-commands.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index eb2736009f..c4ca603c5d 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1806,7 +1806,8 @@ Arguments: "device". (json-string, optional) -- "device": The name of the device. +- "device": The device name or node-name of the root node that owns + image-node-name. (json-string) - "backing-file": The string to write as the backing file. This string is -- cgit v1.2.3 From b7e4fa224200ec87b9599a1d72b16ada35a3d113 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for drive-backup In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts drive-backup and the corresponding transaction action to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- qmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index c4ca603c5d..c5e6cd57aa 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1235,7 +1235,7 @@ Arguments: - "job-id": Identifier for the newly-created block job. If omitted, the device name will be used. (json-string, optional) -- "device": the name of the device which should be copied. +- "device": the device name or node-name of a root node which should be copied. (json-string) - "target": the target of the new image. If the file exists, or if it is a device, the existing file/device will be used as the new -- cgit v1.2.3 From 0524e93a3fd7bff5bb4a584c372f2632ab7c0e0f Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 23 Jun 2016 14:20:24 +0200 Subject: block: Accept node-name for drive-mirror In order to remove the necessity to use BlockBackend names in the external API, we want to allow node-names everywhere. This converts drive-mirror to accept a node-name without lifting the restriction that we're operating at a root node. In case of an invalid device name, the command returns the GenericError error class now instead of DeviceNotFound, because this is what qmp_get_root_bs() returns. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- qmp-commands.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index c5e6cd57aa..956f1b0f47 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1689,7 +1689,8 @@ Arguments: - "job-id": Identifier for the newly-created block job. If omitted, the device name will be used. (json-string, optional) -- "device": device name to operate on (json-string) +- "device": the device name or node-name of a root node whose writes should be + mirrored. (json-string) - "target": name of new image file (json-string) - "format": format of new image (json-string, optional) - "node-name": the name of the new block driver state in the node graph -- cgit v1.2.3 From 13b9414b5798539e2dbb87a570d96184fe21edf4 Mon Sep 17 00:00:00 2001 From: Pavel Butsykin Date: Fri, 22 Jul 2016 11:17:52 +0300 Subject: drive-backup: added support for data compression The idea is simple - backup is "written-once" data. It is written block by block and it is large enough. It would be nice to save storage space and compress it. The patch adds a flag to the qmp/hmp drive-backup command which enables block compression. Compression should be implemented in the format driver to enable this feature. There are some limitations of the format driver to allow compressed writes. We can write data only once. Though for backup this is perfectly fine. These limitations are maintained by the driver and the error will be reported if we are doing something wrong. Signed-off-by: Pavel Butsykin Reviewed-by: Stefan Hajnoczi Signed-off-by: Denis V. Lunev CC: Jeff Cody CC: Markus Armbruster CC: Eric Blake CC: John Snow CC: Stefan Hajnoczi CC: Kevin Wolf Signed-off-by: Kevin Wolf --- qmp-commands.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index 956f1b0f47..d1593c91ff 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1217,7 +1217,8 @@ EQMP { .name = "drive-backup", .args_type = "job-id:s?,sync:s,device:B,target:s,speed:i?,mode:s?," - "format:s?,bitmap:s?,on-source-error:s?,on-target-error:s?", + "format:s?,bitmap:s?,compress:b?," + "on-source-error:s?,on-target-error:s?", .mhandler.cmd_new = qmp_marshal_drive_backup, }, @@ -1253,6 +1254,8 @@ Arguments: - "mode": whether and how QEMU should create a new image (NewImageMode, optional, default 'absolute-paths') - "speed": the maximum speed, in bytes per second (json-int, optional) +- "compress": true to compress data, 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. -- cgit v1.2.3 From 3b7b12365953c507d50b52fbd3f1b46574c6946f Mon Sep 17 00:00:00 2001 From: Pavel Butsykin Date: Fri, 22 Jul 2016 11:17:53 +0300 Subject: blockdev-backup: added support for data compression The idea is simple - backup is "written-once" data. It is written block by block and it is large enough. It would be nice to save storage space and compress it. Signed-off-by: Pavel Butsykin Reviewed-by: Stefan Hajnoczi Signed-off-by: Denis V. Lunev CC: Jeff Cody CC: Markus Armbruster CC: Eric Blake CC: John Snow CC: Stefan Hajnoczi CC: Kevin Wolf Signed-off-by: Kevin Wolf --- qmp-commands.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'qmp-commands.hx') diff --git a/qmp-commands.hx b/qmp-commands.hx index d1593c91ff..ba2a916f69 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1275,7 +1275,7 @@ EQMP { .name = "blockdev-backup", - .args_type = "job-id:s?,sync:s,device:B,target:B,speed:i?," + .args_type = "job-id:s?,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, }, @@ -1299,6 +1299,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": true to compress data, 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. -- cgit v1.2.3