From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcwyS-0004WT-2u for qemu-devel@nongnu.org; Fri, 18 Sep 2015 10:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcwyQ-0006yL-Ss for qemu-devel@nongnu.org; Fri, 18 Sep 2015 10:49:16 -0400 References: <0feb7566cff42d8625ed7263de73fc59225e125f.1442245236.git.berto@igalia.com> From: Eric Blake Message-ID: <55FC2462.9080000@redhat.com> Date: Fri, 18 Sep 2015 08:49:06 -0600 MIME-Version: 1.0 In-Reply-To: <0feb7566cff42d8625ed7263de73fc59225e125f.1442245236.git.berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="44EW36iXMRrvqHDnvVcu2WqUeOwqjpsQ3" Subject: Re: [Qemu-devel] [PATCH v4 3/4] block: add a 'blockdev-snapshot' QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --44EW36iXMRrvqHDnvVcu2WqUeOwqjpsQ3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/14/2015 10:01 AM, Alberto Garcia wrote: > One of the limitations of the 'blockdev-snapshot-sync' command is that > it does not allow passing BlockdevOptions to the newly created > snapshots, so they are always opened using the default values. >=20 > Extending the command to allow passing options is not a practical > solution because there is overlap between those options and some of > the existing parameters of the command. >=20 > This patch introduces a new 'blockdev-snapshot' command with a simpler > interface: it just takes two references to existing block devices that > will be used as the source and target for the snapshot. >=20 > Since the main difference between the two commands is that one of them > creates and opens the target image, while the other uses an already > opened one, the bulk of the implementation is shared. >=20 > Signed-off-by: Alberto Garcia > Reviewed-by: Eric Blake > Cc: Max Reitz > --- > +++ b/qapi/block-core.json > @@ -705,6 +705,21 @@ > '*format': 'str', '*mode': 'NewImageMode' } } > =20 > ## > +# @BlockdevSnapshot > +# > +# @device: device or node name to generate the snapshot from. I'm still wondering if 'node' is a better name than 'device' here. > +# > +# @snapshot: reference to the existing block device that will be used > +# for the snapshot. It must not have a current backing file= > +# (this can be achieved by passing "backing": "" to > +# blockdev-add). Possibly confusing terminology. Let's consider: the act of creating a snapshot says to go from: image1 [read-write] to image1 [read-only] <- image2 [read-write] that is, image1 is now the snapshot of the state in time we executed the command, and image2 is the delta from what happened since the snapshot. Therefore, image2 is NOT the snapshot. Naming the command 'blockdev-snapshot' is fine, but I think we can have better names for the arguments. Better wording might be: @device: device or node that will have a snapshot created @overlay: reference to existing block device that will become the overlay of device, as part of creating the snapshot. It must not have a current backing file... > +Example: > + > +-> { "execute": "blockdev-add", > + "arguments": { "options": { "driver": "qcow2", > + "node-name": "node1534", > + "file": { "driver": "file"= , > + "filename": "hd1= =2Eqcow2" }, > + "backing": "" } } } > + > +<- { "return": {} } > + > +-> { "execute": "blockdev-snapshot", "arguments": { "device": "ide-hd0= ", > + "snapshot": "node1= 534" } } > +<- { "return": {} } The example would need tweaking if we rename members of the command, but it definitely helps. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --44EW36iXMRrvqHDnvVcu2WqUeOwqjpsQ3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV/CRiAAoJEKeha0olJ0NqACoIAJwfWtOUhaLHGTK5Ydh9RT9V 0ZL/Wv/l4euPy4n6f0yYpTP51cHlJ796yyduYCgh8OZTbb9rvWpfBa9g/4N+C1kr f8ALRqVmbotDnGxgJ5WSa/RjjWLGh6VrHlyykeMPQ5aacUCfQatSX45j1zkzXhNd NgL6kffthSa4r+SUK2fbWPc37+FpICP0zUEBzZWkfE0Q8UNzOjyYbCuiJAxJ/kHZ cuZh8pe+rt8LNl31/HhZSF03FqovOuWqLW/veNhpHGchOb4mjRJMrh+WtMV+2xK9 OihbxDLlL1OB8mFrr5RBTGvxkAOn+vQy1sviMWb85QJwbhsJc8I+jxs4nwOCRx8= =+UTN -----END PGP SIGNATURE----- --44EW36iXMRrvqHDnvVcu2WqUeOwqjpsQ3--