From: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, armbru@redhat.com, lcapitulino@redhat.com,
clalance@redhat.com,
Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Subject: [Qemu-devel] [PATCH v2] monitor: Really show snapshot information about all devices
Date: Thu, 17 Jun 2010 09:58:37 -0300 [thread overview]
Message-ID: <1276779517-2974-1-git-send-email-miguel.filho@gmail.com> (raw)
The 'info snapshots' monitor command does not show snapshot information from all
available block devices.
Usage example:
$ qemu -hda disk1.qcow2 -hdb disk2.qcow2
(qemu) info snapshots
Snapshot devices: ide0-hd0
Snapshot list (from ide0-hd0):
ID TAG VM SIZE DATE VM CLOCK
1 1.5M 2010-05-26 21:51:02 00:00:03.263
2 1.5M 2010-05-26 21:51:09 00:00:08.844
3 1.5M 2010-05-26 21:51:24 00:00:23.274
4 1.5M 2010-05-26 21:53:17 00:00:03.595
In the above case, disk2.qcow2 has snapshot information, but it is not being
shown. Only the first device is always shown.
This patch updates the do_info_snapshots() function do correctly show snapshot
information about all available block devices.
New output:
(qemu) info snapshots
Snapshot list from ide0-hd0 (VM state image):
ID TAG VM SIZE DATE VM CLOCK
1 1.5M 2010-05-26 21:51:02 00:00:03.263
2 1.5M 2010-05-26 21:51:09 00:00:08.844
3 1.5M 2010-05-26 21:51:24 00:00:23.274
4 1.5M 2010-05-26 21:53:17 00:00:03.595
Snapshot list from ide0-hd1:
ID TAG VM SIZE DATE VM CLOCK
1 0 2010-05-26 21:51:02 00:00:03.263
2 0 2010-05-26 21:51:09 00:00:08.844
3 0 2010-05-26 21:51:24 00:00:23.274
4 0 2010-05-26 21:53:17 00:00:03.595
changelog
---------
v1 -> v2
- Added support to identify the device elected to save the VM's state.
Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
---
savevm.c | 57 ++++++++++++++++++++++++++++++++-------------------------
1 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/savevm.c b/savevm.c
index 20354a8..5bc5fcd 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1858,37 +1858,44 @@ void do_delvm(Monitor *mon, const QDict *qdict)
void do_info_snapshots(Monitor *mon)
{
- BlockDriverState *bs, *bs1;
- QEMUSnapshotInfo *sn_tab, *sn;
+ BlockDriverState *bs, *bs_vm_state;
+ QEMUSnapshotInfo *sn_tab;
int nb_sns, i;
char buf[256];
- bs = get_bs_snapshots();
- if (!bs) {
+ bs_vm_state = get_bs_snapshots();
+ if (!bs_vm_state) {
monitor_printf(mon, "No available block device supports snapshots\n");
return;
}
- monitor_printf(mon, "Snapshot devices:");
- bs1 = NULL;
- while ((bs1 = bdrv_next(bs1))) {
- if (bdrv_can_snapshot(bs1)) {
- if (bs == bs1)
- monitor_printf(mon, " %s", bdrv_get_device_name(bs1));
- }
- }
- monitor_printf(mon, "\n");
- nb_sns = bdrv_snapshot_list(bs, &sn_tab);
- if (nb_sns < 0) {
- monitor_printf(mon, "bdrv_snapshot_list: error %d\n", nb_sns);
- return;
- }
- monitor_printf(mon, "Snapshot list (from %s):\n",
- bdrv_get_device_name(bs));
- monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));
- for(i = 0; i < nb_sns; i++) {
- sn = &sn_tab[i];
- monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn));
+ bs = NULL;
+ while ((bs = bdrv_next(bs))) {
+ if (bdrv_can_snapshot(bs)) {
+ monitor_printf(mon, "Snapshot list from %s",
+ bdrv_get_device_name(bs));
+
+ if (bs == bs_vm_state) {
+ monitor_printf(mon, " (VM state image):\n");
+ } else {
+ monitor_printf(mon, ":\n");
+ }
+
+ monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));
+
+ nb_sns = bdrv_snapshot_list(bs, &sn_tab);
+ if (nb_sns < 0) {
+ monitor_printf(mon, "bdrv_snapshot_list: error %d\n", nb_sns);
+ continue;
+ }
+
+ for (i = 0; i < nb_sns; i++) {
+ monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf),
+ &sn_tab[i]));
+ }
+
+ qemu_free(sn_tab);
+ monitor_printf(mon, "\n");
+ }
}
- qemu_free(sn_tab);
}
--
1.7.1
next reply other threads:[~2010-06-17 13:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 12:58 Miguel Di Ciurcio Filho [this message]
2010-06-17 14:40 ` [Qemu-devel] Re: [PATCH v2] monitor: Really show snapshot information about all devices Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276779517-2974-1-git-send-email-miguel.filho@gmail.com \
--to=miguel.filho@gmail.com \
--cc=armbru@redhat.com \
--cc=clalance@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).