From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULKTa-0005SG-Gr for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:35:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULKTY-0006DX-8l for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:35:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULKTY-0006DT-0l for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:35:12 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2SLZAPJ011633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Mar 2013 17:35:10 -0400 Message-ID: <5154B78D.5030308@redhat.com> Date: Thu, 28 Mar 2013 15:35:09 -0600 From: Eric Blake MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2EVTAULXCDECTIAXKPEUV" Subject: Re: [Qemu-devel] [PATCH v3 07/11] qapi: Convert savevm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2EVTAULXCDECTIAXKPEUV Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/28/2013 10:47 AM, Pavel Hrdina wrote: > QMP command "vm-snapshot-save" has also extra optional force parameter > and name parameter isn't optional anymore. It also returns information > about created snapshot. Commit message is a bit stale from an earlier version of the series, since name is still optional in this patch. > +++ b/qapi-schema.json > @@ -3453,3 +3453,25 @@ > # Since: 1.5 > ## > { 'command': 'query-tpm', 'returns': ['TPMInfo'] } > + > +## > +# @vm-snapshot-save: > +# > +# Create a snapshot of the whole virtual machine. If tag is provided a= s @name, > +# it is used as human readable identifier. If there is already a snaps= hot > +# with the same tag or id, the force argument needs to be true to repl= ace it. > +# > +# The VM is automatically stopped and resumed and saving a snapshot ca= n take > +# a long time. > +# > +# @name: #optional tag of new snapshot or tag|id of existing snapshot > +# > +# @force: #optional specify whether existing snapshot is replaced or n= ot, > +# default is false > +# > +# Returns: Nothing on success Comment is stale, now that you return the SnapshotInfo of the newly-created snapshot. > +# > +# Since: 1.5 > +## > +{ 'command': 'vm-snapshot-save', 'data': {'*name': 'str', '*force': 'b= ool'}, > + 'returns': 'SnapshotInfo' } > +++ b/savevm.c > @@ -2249,17 +2249,18 @@ static int del_existing_snapshots(const char *n= ame, Error **errp) > return 0; > } > =20 > -void do_savevm(Monitor *mon, const QDict *qdict) > +SnapshotInfo *qmp_vm_snapshot_save(bool has_name, const char *name, > + bool has_force, bool force, Error **= errp) Indentation is off by one (the two "bool has_" should be aligned). > @@ -2271,16 +2272,16 @@ void do_savevm(Monitor *mon, const QDict *qdict= ) > } > =20 > if (!bdrv_can_snapshot(bs)) { > - monitor_printf(mon, "Device '%s' is writable but does not = support snapshots.\n", > - bdrv_get_device_name(bs)); > - return; > + error_setg(errp, "Device '%s' is writable but does not sup= port " > + "snapshots.", bdrv_get_device_name(bs)); Missed a removal of a trailing '.' in the error message. > + return NULL; > } > } > =20 > bs =3D bdrv_snapshots(); > if (!bs) { > - monitor_printf(mon, "No block device can accept snapshots\n");= > - return; > + error_setg(errp, "No block device can accept snapshots."); And completely added a trailing '.' here. > + if (has_force && force) { > + pstrcpy(sn->name, sizeof(sn->name), old_sn->name); > + pstrcpy(sn->id_str, sizeof(sn->id_str), old_sn->id_str= ); > + > + /* Delete old snapshots of the same name */ > + if (del_existing_snapshots(name, &local_err) < 0) { > + error_propagate(errp, local_err); > + goto the_end; > + } > + } else { > + error_setg(errp, "Snapshot '%s' exists. For override u= se " > + "'force' parameter.", name); New message with trailing '.'; maybe: "cannot override existing snapshot '%s' without 'force' parameter" > /* save the VM state */ > f =3D qemu_fopen_bdrv(bs, 1); > if (!f) { > - monitor_printf(mon, "Could not open VM state file\n"); > + error_setg(errp, "Failed to open '%s' file.", bdrv_get_device_= name(bs)); don't add a trailing '.' --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2EVTAULXCDECTIAXKPEUV 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.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRVLeNAAoJEKeha0olJ0NqiA4H/RfAtqvqz1d1sVrrS0TEXmcX VSHC7zRQR8hZFUy7hOqBkhSHjk4bXjAPxpwxZNjrlvk3KiIoZTefGHlgd4TdABag UaTfz+oXsdj2fTSOkTJpVRyyyR996/gW0QkBT//Hz/64YmrY9IHVvSwUg3oi53sS gQygrJozwTXQCF96oCZP2pCDhpGrG8GEv1LfhIqiq+8ojLhci+mzaD0YWM9sZSTb 80Dhre5JzaYdNrEYPLiY3LgNoqw8iIF7hCwb5K0EF6n0s2bkuqHBkAzA3C1thvHF /pCSKhFYn4OWHiUs12jzFZNTdFVQUVNMttF/2oDBJ96DFhQ/FJduo4wLJcxWW3g= =8FmV -----END PGP SIGNATURE----- ------enig2EVTAULXCDECTIAXKPEUV--