From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, fsimonce@redhat.com, jcody@redhat.com,
qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 4/6] add reuse field
Date: Wed, 29 Feb 2012 11:50:54 -0700 [thread overview]
Message-ID: <4F4E738E.8000706@redhat.com> (raw)
In-Reply-To: <1330522650-15357-5-git-send-email-pbonzini@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2854 bytes --]
On 02/29/2012 06:37 AM, Paolo Bonzini wrote:
> In some cases it can be useful to use an existing file as the new image
> in a snapshot. Add this capability to blockdev-transaction.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> blockdev.c | 18 +++++++++++-------
> qapi-schema.json | 3 ++-
> qmp-commands.hx | 7 +++++++
> 3 files changed, 20 insertions(+), 8 deletions(-)
> @@ -805,13 +807,15 @@ void qmp_blockdev_transaction(BlockdevActionList *dev_list,
> }
>
> /* create new image w/backing file */
> - ret = bdrv_img_create(new_image_file, format,
> - states->old_bs->filename,
> - states->old_bs->drv->format_name,
> - NULL, -1, flags);
> - if (ret) {
> - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
> - goto delete_and_fail;
> + if (do_snapshot) {
> + ret = bdrv_img_create(new_image_file, format,
> + states->old_bs->filename,
> + states->old_bs->drv->format_name,
> + NULL, -1, flags);
> + if (ret) {
> + error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
> + goto delete_and_fail;
> + }
Is there any sanity checking that we should be doing if the 'reuse' flag
was provided, or is this a case of 'the user better be giving us the
right information, and it's their fault if things break'?
> +++ b/qapi-schema.json
> @@ -1127,7 +1127,8 @@
> # @format: #optional the format of the snapshot image, default is 'qcow2'.
> ##
> { 'type': 'BlockdevSnapshot',
> - 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str' } }
> + 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str',
> + '*reuse': 'bool' } }
>
> ##
> # @BlockdevAction
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index ee05ec2..6728495 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -704,6 +704,10 @@ the original disks pre-snapshot attempt are used.
> A list of dictionaries is accepted, that contains the actions to be performed.
> For snapshots this is the device, the file to use for the new snapshot,
> and the format. The default format, if not specified, is qcow2.
> +Image files can be created by QEMU, or it can be created externally.
'files' is plural, 'it' is singular. Perhaps this wording is better?
Each new snapshot defaults to being created by QEMU (wiping any contents
if the file already exists), but it is also possible to reuse an
externally-created file.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
next prev parent reply other threads:[~2012-02-29 18:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 13:37 [Qemu-devel] [PATCH 0/6] Mirrored writes using blockdev-transaction Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 1/6] fix format name for backing file Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 2/6] qapi: complete implementation of unions Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 3/6] rename blockdev-group-snapshot-sync Paolo Bonzini
2012-02-29 14:25 ` Paolo Bonzini
2012-02-29 15:08 ` Luiz Capitulino
2012-02-29 15:23 ` Paolo Bonzini
2012-03-01 13:30 ` Luiz Capitulino
2012-03-01 13:33 ` Paolo Bonzini
2012-02-29 18:41 ` Eric Blake
2012-03-01 10:18 ` Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 4/6] add reuse field Paolo Bonzini
2012-02-29 18:50 ` Eric Blake [this message]
2012-03-01 10:22 ` Kevin Wolf
2012-02-29 13:37 ` [Qemu-devel] [PATCH 5/6] Add blkmirror block driver Paolo Bonzini
2012-02-29 14:37 ` Stefan Hajnoczi
2012-02-29 14:56 ` Paolo Bonzini
2012-02-29 19:36 ` Eric Blake
2012-02-29 13:37 ` [Qemu-devel] [PATCH 6/6] add mirroring to blockdev-transaction Paolo Bonzini
2012-02-29 19:47 ` Eric Blake
2012-03-01 6:46 ` Paolo Bonzini
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=4F4E738E.8000706@redhat.com \
--to=eblake@redhat.com \
--cc=fsimonce@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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).