* [Qemu-devel] [PATCH] monitor: Really show snapshot information about all devices
@ 2010-06-16 1:53 Miguel Di Ciurcio Filho
2010-06-16 12:40 ` [Qemu-devel] " Kevin Wolf
0 siblings, 1 reply; 7+ messages in thread
From: Miguel Di Ciurcio Filho @ 2010-06-16 1:53 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Miguel Di Ciurcio Filho, armbru, lcapitulino
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:
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
Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
---
savevm.c | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/savevm.c b/savevm.c
index 20354a8..0eacb9f 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1858,8 +1858,8 @@ void do_delvm(Monitor *mon, const QDict *qdict)
void do_info_snapshots(Monitor *mon)
{
- BlockDriverState *bs, *bs1;
- QEMUSnapshotInfo *sn_tab, *sn;
+ BlockDriverState *bs;
+ QEMUSnapshotInfo *sn_tab;
int nb_sns, i;
char buf[256];
@@ -1868,27 +1868,27 @@ void do_info_snapshots(Monitor *mon)
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:\n",
+ bdrv_get_device_name(bs));
+ 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] monitor: Really show snapshot information about all devices
2010-06-16 1:53 [Qemu-devel] [PATCH] monitor: Really show snapshot information about all devices Miguel Di Ciurcio Filho
@ 2010-06-16 12:40 ` Kevin Wolf
2010-06-16 12:59 ` Miguel Di Ciurcio Filho
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2010-06-16 12:40 UTC (permalink / raw)
To: Miguel Di Ciurcio Filho; +Cc: armbru, qemu-devel, lcapitulino
Am 16.06.2010 03:53, schrieb Miguel Di Ciurcio Filho:
> 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:
> 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
>
> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
If the human monitor was exactly what its name says, I'd happily apply
this one (though I think it should be made clear from which image the VM
state would be loaded). However, it isn't and I'm not sure if this
wouldn't break libvirt. Dan, can you help?
If we can't change the info snapshots output, a possible alternative
would be to introduce another info command for this.
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] monitor: Really show snapshot information about all devices
2010-06-16 12:40 ` [Qemu-devel] " Kevin Wolf
@ 2010-06-16 12:59 ` Miguel Di Ciurcio Filho
2010-06-16 13:15 ` Kevin Wolf
0 siblings, 1 reply; 7+ messages in thread
From: Miguel Di Ciurcio Filho @ 2010-06-16 12:59 UTC (permalink / raw)
To: Kevin Wolf; +Cc: armbru, qemu-devel, lcapitulino
On Wed, Jun 16, 2010 at 9:40 AM, Kevin Wolf <kwolf@redhat.com> wrote:
>
> If the human monitor was exactly what its name says, I'd happily apply
> this one (though I think it should be made clear from which image the VM
> state would be loaded). However, it isn't and I'm not sure if this
> wouldn't break libvirt. Dan, can you help?
>
I didn't mention in the commit, but I've looked at libvirt's source
and it is not using 'info snapshots' AFAIK.
At the present time, the VM state is always saved in the first block
device that supports snapshots. I could update the patch to make it
clear on the output somehow. From savevm.c:get_bs_snapshot():
static BlockDriverState *get_bs_snapshots(void)
{
BlockDriverState *bs;
if (bs_snapshots)
return bs_snapshots;
/* FIXME what if bs_snapshots gets hot-unplugged? */
bs = NULL;
while ((bs = bdrv_next(bs))) {
if (bdrv_can_snapshot(bs)) {
goto ok;
}
}
return NULL;
ok:
bs_snapshots = bs;
return bs;
}
Regards,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] monitor: Really show snapshot information about all devices
2010-06-16 12:59 ` Miguel Di Ciurcio Filho
@ 2010-06-16 13:15 ` Kevin Wolf
[not found] ` <20100616152249.GB2835@localhost.localdomain>
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2010-06-16 13:15 UTC (permalink / raw)
To: Miguel Di Ciurcio Filho; +Cc: armbru, qemu-devel, lcapitulino
Am 16.06.2010 14:59, schrieb Miguel Di Ciurcio Filho:
> On Wed, Jun 16, 2010 at 9:40 AM, Kevin Wolf <kwolf@redhat.com> wrote:
>>
>> If the human monitor was exactly what its name says, I'd happily apply
>> this one (though I think it should be made clear from which image the VM
>> state would be loaded). However, it isn't and I'm not sure if this
>> wouldn't break libvirt. Dan, can you help?
>>
>
> I didn't mention in the commit, but I've looked at libvirt's source
> and it is not using 'info snapshots' AFAIK.
Anthony, Dan, are you okay with the change then?
> At the present time, the VM state is always saved in the first block
> device that supports snapshots. I could update the patch to make it
> clear on the output somehow.
Would be nice to make it clear. Something like this maybe:
Snapshot list from ide0-hd0 (VM state image):
[...]
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-06-17 8:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-16 1:53 [Qemu-devel] [PATCH] monitor: Really show snapshot information about all devices Miguel Di Ciurcio Filho
2010-06-16 12:40 ` [Qemu-devel] " Kevin Wolf
2010-06-16 12:59 ` Miguel Di Ciurcio Filho
2010-06-16 13:15 ` Kevin Wolf
[not found] ` <20100616152249.GB2835@localhost.localdomain>
2010-06-16 15:32 ` Kevin Wolf
[not found] ` <20100616155710.GC2835@localhost.localdomain>
2010-06-17 7:48 ` Kevin Wolf
2010-06-16 22:12 ` Miguel Di Ciurcio Filho
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).