From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1sC7-0006aa-Ss for qemu-devel@nongnu.org; Thu, 16 Aug 2012 01:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1sC6-0003Vv-Hx for qemu-devel@nongnu.org; Thu, 16 Aug 2012 01:00:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1sC6-0003Vr-9h for qemu-devel@nongnu.org; Thu, 16 Aug 2012 01:00:30 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7G50Svm006057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Aug 2012 01:00:29 -0400 Message-ID: <502C7E66.8040703@redhat.com> Date: Wed, 15 Aug 2012 23:00:22 -0600 From: Eric Blake MIME-Version: 1.0 References: <582c2debbce809a86fe62d6a998d42bee8ef274c.1345016001.git.phrdina@redhat.com> In-Reply-To: <582c2debbce809a86fe62d6a998d42bee8ef274c.1345016001.git.phrdina@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig29079FAF061187435A78D8C1" Subject: Re: [Qemu-devel] [PATCH 18/18] vm-snapshot-save: add force parameter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig29079FAF061187435A78D8C1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/15/2012 01:41 AM, Pavel Hrdina wrote: > HMP command "savevm" now takes extra optional force parameter to specif= i whether s/specifi/specify/ > replace existing snapshot or not. >=20 > QMP command "vm-snapshot-save" has also extra optional force parameter = and > name parameter isn't optional anymore. When HMP omits the name, what name are you using in it's place? Either a nameless snapshot is okay (and QMP must expose it), or it is an error (and HMP must now be passing a reasonable name). /me reads patch Oh, there was always a name; the default name was a timestamp, and you moved the timestamp creation into HMP. > +++ b/hmp-commands.hx > @@ -264,19 +264,19 @@ ETEXI > =20 > { > .name =3D "savevm", > - .args_type =3D "name:s?", > - .params =3D "[tag|id]", > - .help =3D "save a VM snapshot. If no tag or id are provi= ded, a new snapshot is created", > + .args_type =3D "name:s?,force:b?", > + .params =3D "[tag|id] [on|off]", Rather than sticking 'force' as an optional parameter at the end, instead you want to add '-f' as a flag at the beginning. =2Eargs_type =3D "force:-b,name:s?", =2Eparams =3D "[-f] name" By doing this, you no longer need 17/18. > + .help =3D "save a VM snapshot. To replace existing snaps= hot use force parameter.", > .mhandler.cmd =3D hmp_vm_snapshot_save, > }, > =20 > STEXI > @item savevm [@var{tag}|@var{id}] > @findex savevm > -Create a snapshot of the whole virtual machine. If @var{tag} is > -provided, it is used as human readable identifier. If there is already= > -a snapshot with the same tag or ID, it is replaced. More info at > -@ref{vm_snapshots}. > +Create a snapshot of the whole virtual machine. Parameter "name" is op= tional. > +If @var{tag} is provided, it is used as human readable identifier. If = there is > +already a snapshot with the same tag, force argument need to be "yes" = to s/force argument need/the force argument needs/ > +++ b/qapi-schema.json > @@ -2394,21 +2394,23 @@ > ## > # @vm-snapshot-save: > # > -# Create a snapshot of the whole virtual machine. If 'tag' is provided= , > -# it is used as human readable identifier. If there is already a snaps= hot > -# with the same tag or ID, it is replaced. > +# Create a snapshot of the whole virtual machine. Provided 'tag' is us= ed as > +# human readable identifier. If there is already a snapshot with the s= ame tag, > +# force argument need to be "yes" to replace it. s/need to be "yes"/needs to be 'true'/ > # > # The VM is automatically stopped and resumed and saving a snapshot ca= n take > # a long time. > # > -# @name: tag or id of new or existing snapshot > +# @name: tag of new or existing snapshot Given your new semantics, @name must be tag when @force is false; but the old HMP semantics allowed 'savevm 1' to rewrite snapshot id 1 regardless of the name, all while keeping the old tag. Does the new HMP code do an id lookup, and pass in the correct @name to the QMP code? Should the QMP code allow the same semantics of being able to pass @force=3Dtrue and @name=3Did instead of the normal creation of @name=3Dta= g? > +# > +# @force: specify whether existing snapshot is replaced or not Based on the JSON below, this needs an #optional marking, as well as mentioning that the default is false. > # > # Returns: Nothing on success > # If an error occurs, GenericError with error message Knowing that a creation failed due to a snapshot already existing by the same name or id might be worth a distinct error class (do we already have an error class that we could reuse?) --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig29079FAF061187435A78D8C1 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/ iQEcBAEBCAAGBQJQLH5mAAoJEKeha0olJ0NquE8IAJIzV9gdVEDqBrn6HKww+ZAH rzWHYp2bl4KZ90Lk9Xy5eJPbxzH4s9axLt/ru5yMkFvLKYIf7quZHFgKGYZk6VnZ Jrlk/GXT9Y/BLiFTE33KiJ/We6/FFKa6ciMmYCrH7HbLl7nS8rd1LxtCQ0RNVVTn LrqTam97K6KShOpTh3IIjR9UN6ufkEEQd6txRUZw7oMrfcYtwzRAheU4dRkBYQFO kVMawSJIc31iHqKTHuC4KYTbpbEDFy1WXZLFF31PeMfQ5KLGHCYDvMJyShX0TBPi zmybqNIVK6tOsjlGgXLGqnoOyGP+zLT8/J0jfxRjOzEF37KERCsxUA+dtB3/tu8= =/rYa -----END PGP SIGNATURE----- --------------enig29079FAF061187435A78D8C1--