From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJL45-0008Jn-RT for qemu-devel@nongnu.org; Sat, 02 Jul 2016 09:34:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJL40-0002Ni-Rc for qemu-devel@nongnu.org; Sat, 02 Jul 2016 09:34:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJL40-0002Ne-KE for qemu-devel@nongnu.org; Sat, 02 Jul 2016 09:34:28 -0400 References: <1467186193-24964-1-git-send-email-lma@suse.com> <1467186193-24964-3-git-send-email-lma@suse.com> From: Max Reitz Message-ID: <7e9ff7c1-78de-e3a7-b5fc-40ad1be9dfe7@redhat.com> Date: Sat, 2 Jul 2016 15:34:24 +0200 MIME-Version: 1.0 In-Reply-To: <1467186193-24964-3-git-send-email-lma@suse.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n6lxTpuMJ13Bb3XFqUEi7rCUV42hJ9Wei" Subject: Re: [Qemu-devel] [PATCH 2/2 V3] hmp: show all of snapshot info on every block dev in output of 'info snapshots' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lin Ma , qemu-devel@nongnu.org Cc: kwolf@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --n6lxTpuMJ13Bb3XFqUEi7rCUV42hJ9Wei From: Max Reitz To: Lin Ma , qemu-devel@nongnu.org Cc: kwolf@redhat.com Message-ID: <7e9ff7c1-78de-e3a7-b5fc-40ad1be9dfe7@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2 V3] hmp: show all of snapshot info on every block dev in output of 'info snapshots' References: <1467186193-24964-1-git-send-email-lma@suse.com> <1467186193-24964-3-git-send-email-lma@suse.com> In-Reply-To: <1467186193-24964-3-git-send-email-lma@suse.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 29.06.2016 09:43, Lin Ma wrote: > Currently, the output of 'info snapshots' shows fully available snapsho= ts. > It's opaque, hides some snapshot information to users. It's not conveni= ent > if users want to know more about all of snapshot information on every b= lock > device via monitor. >=20 > Follow Kevin's and Max's proposals, The patch makes the output more det= ailed: > (qemu) info snapshots > List of snapshots present on all disks: > ID TAG VM SIZE DATE VM CLO= CK > -- checkpoint-1 165M 2016-05-22 16:58:07 00:02:06.8= 13 >=20 > List of partial (non-loadable) snapshots on 'drive_image1': > ID TAG VM SIZE DATE VM CLO= CK > 1 snap1 0 2016-05-22 16:57:31 00:01:30.5= 67 >=20 > Signed-off-by: Lin Ma > --- > migration/savevm.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++= ++++---- > 1 file changed, 88 insertions(+), 7 deletions(-) >=20 > diff --git a/migration/savevm.c b/migration/savevm.c > index a8f22da..e5a5536 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c [...] > @@ -2249,11 +2308,33 @@ void hmp_info_snapshots(Monitor *mon, const QDi= ct *qdict) > monitor_printf(mon, "\n"); > } > } else { > - monitor_printf(mon, "There is no suitable snapshot available\n= "); > + monitor_printf(mon, "None\n"); > } > =20 > + QTAILQ_FOREACH(image_entry, &image_list, next) { > + if (QTAILQ_EMPTY(&image_entry->snapshots)) { > + continue; > + } > + monitor_printf(mon, > + "\nList of partial (non-loadable) snapshots on = '%s':\n", > + image_entry->imagename); > + bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL= ); > + monitor_printf(mon, "\n"); > + QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) = { > + bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, > + &snapshot_entry->sn); > + monitor_printf(mon, "\n"); > + } > + } > + > + QTAILQ_FOREACH(image_entry, &image_list, next) { > + QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) = { > + g_free(snapshot_entry); > + } > + g_free(image_entry); > + } Just as in the for loop removing snapshot entries that are available on all images, you need to use QTAILQ_FOREACH_SAFE() if you free list elements inside of the loop (so both of these QTAILQ_FOREACH() need to be QTAILQ_FOREACH_SAFE()). Looks good apart from that, though. Max > g_free(sn_tab); > - g_free(available_snapshots); > + g_free(global_snapshots); > =20 > } > =20 >=20 --n6lxTpuMJ13Bb3XFqUEi7rCUV42hJ9Wei 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 iQEvBAEBCAAZBQJXd8LhEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisreV2 B/kBs8N9r7+dsiMAH67cmrXhSe86SON4cYVYF3gnwj8F+olJqm0OrDR3P+0/TJjm lYi1/6LQgOk7VJ42aY8OCVyOofXrgGvFNBbWYdNZw2C+r+/qwu8pR3GdXDnkhWdQ FcOCRMdK8pQaRDnEiI9FeypXHZG19lUKiK9RROVO4ydGoBIkOuViqPETPAEArKM3 EVvAbW/AoAvd2mRbpGpXDZEFu0onrf1LyzMcalAbEbV7pPqG7dWTOJY8qI3TaKU3 L7h3TlqDiZ2MBwJOBECnf1MkhAh9s2DASYck1Sef1ztDysTlV0YKP8KlyPY0U6sq +sygCDzb43s2C+5hu31QWOzl =ruDB -----END PGP SIGNATURE----- --n6lxTpuMJ13Bb3XFqUEi7rCUV42hJ9Wei--