From 8aecfcd2d4a36a641aca46cf5f489af24b775b28 Mon Sep 17 00:00:00 2001 Message-Id: <8aecfcd2d4a36a641aca46cf5f489af24b775b28.1335361915.git.minovotn@redhat.com> In-Reply-To: References: From: Paolo Bonzini Date: Tue, 24 Apr 2012 14:01:33 +0200 Subject: [PATCH 6/8] block: drive-mirror fixes RH-Author: Paolo Bonzini Message-id: <1335276095-25813-7-git-send-email-pbonzini@redhat.com> Patchwork-id: 39431 O-Subject: [RHEL 6.3 qemu-kvm PATCH 6/8] block: drive-mirror fixes Bugzilla: 813862 RH-Acked-by: Marcelo Tosatti RH-Acked-by: Kevin Wolf RH-Acked-by: Jeffrey Cody Bugzilla: 813862 - documentation fixes (Eric) - Use current image format as the default when no format is specified (Eric) RHEL-only. --- blockdev.c | 10 +++++++--- qapi-schema.json | 3 ++- qemu-monitor.hx | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) Signed-off-by: Michal Novotny --- blockdev.c | 10 +++++++--- qapi-schema.json | 3 ++- qemu-monitor.hx | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index 466bef5..1634a2d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -883,6 +883,9 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) format = dev_info->blockdev_snapshot_sync->format; } mode = dev_info->blockdev_snapshot_sync->mode; + if (!format && mode != NEW_IMAGE_MODE_EXISTING) { + format = "qcow2"; + } source = states->old_bs; full = false; break; @@ -905,9 +908,6 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) abort(); } - if (!format && mode != NEW_IMAGE_MODE_EXISTING) { - format = "qcow2"; - } if (format) { drv = bdrv_find_format(format); if (!drv) { @@ -932,6 +932,10 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) goto delete_and_fail; } + if (!format && mode != NEW_IMAGE_MODE_EXISTING) { + format = states->old_bs->drv->format_name; + drv = states->old_bs->drv; + } if (dev_info->kind == BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) { if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { diff --git a/qapi-schema.json b/qapi-schema.json index d37ee94..14e7394 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -163,7 +163,8 @@ # 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. # -# @format: #optional the format of the new destination, default is 'qcow2'. +# @format: #optional the format of the new destination, default is the +# format of the source # # @mode: #optional whether and how QEMU should create a new image, default is # 'absolute-paths'. diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 8ee4cb7..4326879 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -1621,6 +1621,8 @@ Arguments: - "format": format of new image (json-string, optional) - "mode": how an image file should be created into the target file/device (NewImageMode, optional, default 'absolute-paths') +- "full": whether the whole disk should be copied to the destination, + or only the topmost image (json-bool) Example: -- 1.7.7.6