[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/6] add reuse field
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 4/6] add reuse field |
Date: |
Wed, 29 Feb 2012 11:50:54 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 |
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 <address@hidden>
> ---
> 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 address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature