From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, obarenbo@redhat.com,
roliveri@redhat.com, hbrock@redhat.com, rjones@redhat.com,
armbru@redhat.com, pmyers@redhat.com, imain@redhat.com,
stefanha@redhat.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 6/7] block: add target-id option to drive-backup QMP command
Date: Tue, 2 Jul 2013 13:59:48 +0800 [thread overview]
Message-ID: <1372744789-997-7-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1372744789-997-1-git-send-email-famz@redhat.com>
Add target-id (optional) to drive-backup command, to make the target bs
a named drive so that we can operate on it (e.g. export with NBD).
Signed-off-by: Fam Zheng <famz@redhat.com>
---
blockdev.c | 4 +++-
qapi-schema.json | 7 +++++--
qmp-commands.hx | 3 ++-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index d02d99a..a297eaf 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -936,6 +936,7 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp)
backup = common->action->drive_backup;
qmp_drive_backup(backup->device, backup->target,
+ backup->has_target_id, backup->target_id,
backup->has_format, backup->format,
backup->has_mode, backup->mode,
backup->has_speed, backup->speed,
@@ -1421,6 +1422,7 @@ void qmp_block_commit(const char *device,
}
void qmp_drive_backup(const char *device, const char *target,
+ bool has_target_id, const char *target_id,
bool has_format, const char *format,
bool has_mode, enum NewImageMode mode,
bool has_speed, int64_t speed,
@@ -1495,7 +1497,7 @@ void qmp_drive_backup(const char *device, const char *target,
return;
}
- target_bs = bdrv_new("");
+ target_bs = bdrv_new(has_target_id ? target_id : "");
ret = bdrv_open(target_bs, target, NULL, flags, drv);
if (ret < 0) {
bdrv_delete(target_bs);
diff --git a/qapi-schema.json b/qapi-schema.json
index 5c32528..2f2a87f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1654,7 +1654,8 @@
# Since: 1.6
##
{ 'type': 'DriveBackup',
- 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
+ 'data': { 'device': 'str', 'target': 'str',
+ '*target-id': 'str', '*format': 'str',
'*mode': 'NewImageMode', '*speed': 'int',
'*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError' } }
@@ -1807,6 +1808,7 @@
# is a device, the existing file/device will be used as the new
# destination. If it does not exist, a new file will be created.
#
+# @target-id: #optional the drive id of the target.
# @format: #optional the format of the new destination, default is to
# probe if @mode is 'existing', else the format of the source
#
@@ -1833,7 +1835,8 @@
# Since 1.6
##
{ 'command': 'drive-backup',
- 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
+ 'data': { 'device': 'str', 'target': 'str',
+ '*target-id': 'str', '*format': 'str',
'*mode': 'NewImageMode', '*speed': 'int',
'*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 362f0e1..3ed03de 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -913,7 +913,7 @@ EQMP
{
.name = "drive-backup",
- .args_type = "device:B,target:s,speed:i?,mode:s?,format:s?,"
+ .args_type = "device:B,target:s,target-id:s?,speed:i?,mode:s?,format:s?,"
"on-source-error:s?,on-target-error:s?",
.mhandler.cmd_new = qmp_marshal_input_drive_backup,
},
@@ -936,6 +936,7 @@ Arguments:
device, the existing file/device will be used as the new
destination. If it does not exist, a new file will be created.
(json-string)
+- "target-id": the drive id of the target image.
- "format": the format of the new destination, default is to probe if 'mode' is
'existing', else the format of the source
(json-string, optional)
--
1.8.3.1
next prev parent reply other threads:[~2013-07-02 6:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 5:59 [Qemu-devel] [PATCH 0/7] Point-in-time snapshot exporting over NBD Fam Zheng
2013-07-02 5:59 ` [Qemu-devel] [PATCH 1/7] block: Convert BlockDriverState.in_use to refcount Fam Zheng
2013-07-02 10:21 ` Paolo Bonzini
2013-07-08 8:37 ` Fam Zheng
2013-07-02 19:41 ` Eric Blake
2013-07-03 0:59 ` Fam Zheng
2013-07-02 5:59 ` [Qemu-devel] [PATCH 2/7] block: use refcount to manage BlockDriverState lifecycle Fam Zheng
2013-07-02 5:59 ` [Qemu-devel] [PATCH 3/7] nbd: use BDS refcount Fam Zheng
2013-07-02 10:16 ` Paolo Bonzini
2013-07-03 1:10 ` Fam Zheng
2013-07-03 5:58 ` Paolo Bonzini
2013-07-03 6:30 ` Fam Zheng
2013-07-03 7:28 ` Paolo Bonzini
2013-07-02 5:59 ` [Qemu-devel] [PATCH 4/7] block: simplify bdrv_drop_intermediate Fam Zheng
2013-07-04 14:02 ` Stefan Hajnoczi
2013-07-05 1:00 ` Fam Zheng
2013-07-02 5:59 ` [Qemu-devel] [PATCH 5/7] block: rename bdrv_in_use to bdrv_is_shared Fam Zheng
2013-07-02 5:59 ` Fam Zheng [this message]
2013-07-02 19:59 ` [Qemu-devel] [PATCH 6/7] block: add target-id option to drive-backup QMP command Eric Blake
2013-07-02 5:59 ` [Qemu-devel] [PATCH 7/7] block: assign backing relationship in drive-backup Fam Zheng
2013-07-04 14:32 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372744789-997-7-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=armbru@redhat.com \
--cc=hbrock@redhat.com \
--cc=imain@redhat.com \
--cc=kwolf@redhat.com \
--cc=obarenbo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pmyers@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=roliveri@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).