From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UE6ks-00009A-0o for qemu-devel@nongnu.org; Fri, 08 Mar 2013 18:31:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UE6km-0007Cw-I0 for qemu-devel@nongnu.org; Fri, 08 Mar 2013 18:31:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UE6km-0007Cp-Ad for qemu-devel@nongnu.org; Fri, 08 Mar 2013 18:31:08 -0500 Message-ID: <513A74AE.8030907@redhat.com> Date: Fri, 08 Mar 2013 16:30:54 -0700 From: Eric Blake MIME-Version: 1.0 References: <1362636445-7188-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1362636445-7188-11-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1362636445-7188-11-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2VBNEQHLQBQFUXUJOSDNE" Subject: Re: [Qemu-devel] [PATCH V8 10/20] qmp: add interface query-snapshots List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2VBNEQHLQBQFUXUJOSDNE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/06/2013 11:07 PM, Wenchao Xia wrote: > This interface now return valid internal snapshots for whole vm. s/now return/returns/ >=20 > Signed-off-by: Wenchao Xia > --- > block/qapi.c | 22 +++++++++++++++++++++ > qapi-schema.json | 14 +++++++++++++ > qmp-commands.hx | 55 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 91 insertions(+), 0 deletions(-) >=20 > + > +SnapshotInfoList *qmp_query_snapshots(Error **errp) > +{ > + BlockDriverState *bs; > + SnapshotInfoList *list =3D NULL; > + int ret; > + > + /* internal snapshot for whole vm */ > + bs =3D bdrv_snapshots(); > + if (!bs) { > + error_setg(errp, "No available block device supports snapshots= \n"); > + return NULL; > + } > + list is NULL here, > + ret =3D bdrv_query_snapshot_info_list(bs, &list, true, errp); > + if (ret < 0) { > + qapi_free_SnapshotInfoList(list); and you documented that bdrv_query_snapshot_info_list leaves list untouched on error, so why do you have to clean it up? > + list =3D NULL; > + } > + return list; In fact, you could write this as: bdrv_query_snapshot_info_list(bs, &list, true, errp); return list; without needing 'ret'. > ## > +# @query-snapshots: > +# > +# Get a list of internal snapshots for whole virtual machine, only val= id s/for/for the/; s/machine, only/machine. Only/ > +# internal snapshot will be returned, inconsistent ones will be ignore= d s/snapshot/snapshots/ > SQMP > +query-snapshots > +----------- Common practice is to make the divider line match the line length of the line above (you were short by '----') > + > +Show the internal consistent snapshot information > + > +Each snapshot is represented by a json-object. The returned value > +is a json-array of all snapshots > + > +Each json-object contain the following: > + > +- "id": unique snapshot id (json-string) > +- "name": internal snapshot name (json-string) > +- "vm-state-size": size of the VM state in bytes (json-int) > +- "date-sec": UTC date of the snapshot in seconds (json-int) > +- "date-nsec": fractional part in nano seconds to be used with s/nano seconds/nanoseconds/ > + date-sec(json-int) > +- "vm-clock-sec": VM clock relative to boot in seconds (json-int) > +- "vm-clock-nsec": fractional part in nano seconds to be used with and again --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2VBNEQHLQBQFUXUJOSDNE 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/ iQEcBAEBCAAGBQJROnSvAAoJEKeha0olJ0NqAdkIAIygcOgXG4mGfJ+Ch3weKKIP fh/80Rvzf92jZO1rj//GIXFMm7jyw9U7NbBo+3fiC+0CSnbnCG1xnG1PpwujWwkN TV6Y6RdeC/miE8/9kWf3JdTN0Y8gvy8vzTFPgja7dYVuCxru4evJCgz8hEw99XOr xa5R4iezsMkpe15xXnyfYwvGFTUsmP6CUhz8xzUkMshI6HaHDwNIat4miwQqVvVl M95d9mhxEsAUIM7mT6a/ITW1tk53ZgJW3mxHzIFgIQ84yG29W+w4BE8ebh7oz12v 6FkNVvJ8VYYMLDIc737Rkub7KuznBNQQX6s86Zt5nOFYcPZTfbszy+4IibHPm28= =LZN9 -----END PGP SIGNATURE----- ------enig2VBNEQHLQBQFUXUJOSDNE--