From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2ocJ-00011R-Tr for qemu-devel@nongnu.org; Wed, 29 Feb 2012 13:51:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2ocH-0003Bp-OJ for qemu-devel@nongnu.org; Wed, 29 Feb 2012 13:51:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2ocH-0003Bc-FT for qemu-devel@nongnu.org; Wed, 29 Feb 2012 13:51:09 -0500 Message-ID: <4F4E738E.8000706@redhat.com> Date: Wed, 29 Feb 2012 11:50:54 -0700 From: Eric Blake MIME-Version: 1.0 References: <1330522650-15357-1-git-send-email-pbonzini@redhat.com> <1330522650-15357-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1330522650-15357-5-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBC44A3E531114C53B89DD73A" Subject: Re: [Qemu-devel] [PATCH 4/6] add reuse field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, fsimonce@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBC44A3E531114C53B89DD73A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Paolo Bonzini > --- > 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, > } > =20 > /* create new image w/backing file */ > - ret =3D 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 =3D 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 'qco= w2'. > ## > { 'type': 'BlockdevSnapshot', > - 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str' = } } > + 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str',= > + '*reuse': 'bool' } } > =20 > ## > # @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 pe= rformed. > 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. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigBC44A3E531114C53B89DD73A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPTnOOAAoJEKeha0olJ0NqIucH/Ro7c0Lii3G9NeP1DznSbaP7 DW/0wG5XuIMm7iYuqopJoMut29+DYb+tjwm4oBTQmVmzWKNQ7xeppDLrWHNxzIpR CiOWhlXNMFV7wynYAo2zsXEA54yF6XlmeMozWVBbQubgfgueaybxuCZYZnBanleF LyRv/dpXeQnM405Kq+opTjH+4VPLBuCSlTCS+ixDTh2vGn/hvcfsktsWId4g4yzd o7gHqeztN+3zbPdqS+rD7KYjhJ3fceQmt/91QYk4tyMcy8tLQFf1uBlS1V9UzvUQ XHtqblh4ETFkhZQxcnVIoS/QLQugMHtlJB6Zk9pKlCOCWeTHzW2WcNYPPc6DlBQ= =GTIZ -----END PGP SIGNATURE----- --------------enigBC44A3E531114C53B89DD73A--