qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/1] blk: do not select PFLASH device for internal s


From: Denis V. Lunev
Subject: [Qemu-devel] [PATCH 1/1] blk: do not select PFLASH device for internal snapshot
Date: Tue, 12 Jan 2016 09:03:42 +0300

There is a long-long story. OVMF VMs can not be snapsotted using
'virsh snapshot' as they have "pflash" device which is configured as
"raw" image. There was a discussion in the past about that.

Good description has been provided on topic by Laszlo Ersek, see below:

"It is true that a pflash drive is "just a drive" *internally* to QEMU.
It is also true that it more or less takes the same -drive options as
any other *disk* drive. But those facts are just implementation details.

The relevant trait of pflash storage files is that they are not *disk
images*, on the libvirt domain XML level. They are not created in
storage pools, you cannot specify their caching attributes, you don't
specify their guest-visible frontend in separation (like virtio-blk /
    virtio-scsi / pflash). Those details are hidden (on purpose).

Consequently, pflash storage files are expected to be *small* in size
(in practice: identically sized to the varstore template they are
instantiated from). They are created under /var/lib/libvirt/qemu/nvram.
Although you can edit their path in the domain XML, they are not
considered disks."

Thus we should avoid selection of "pflash" drives for VM state saving.

For now "pflash" is read-write raw image as it configured by libvirt.
Thus there are no such images in the field and we could safely disable
ability to save state to those images inside QEMU.

Signed-off-by: Denis V. Lunev <address@hidden>
CC: Kevin Wolf <address@hidden>
CC: Paolo Bonzini <address@hidden>
CC: Laszlo Ersek <address@hidden>
CC: address@hidden
---
 block/snapshot.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/block/snapshot.c b/block/snapshot.c
index 2d86b88..1a03581 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -25,6 +25,7 @@
 #include "block/snapshot.h"
 #include "block/block_int.h"
 #include "qapi/qmp/qerror.h"
+#include "sysemu/blockdev.h"
 
 QemuOptsList internal_snapshot_opts = {
     .name = "snapshot",
@@ -481,8 +482,14 @@ BlockDriverState *bdrv_all_find_vmstate_bs(void)
     BlockDriverState *bs = NULL;
 
     while (not_found && (bs = bdrv_next(bs))) {
+        DriveInfo *dinfo;
         AioContext *ctx = bdrv_get_aio_context(bs);
 
+        dinfo = bs->blk != NULL ? blk_legacy_dinfo(bs->blk) : NULL;
+        if (dinfo != NULL && dinfo->type == IF_PFLASH) {
+            continue;
+        }
+
         aio_context_acquire(ctx);
         not_found = !bdrv_can_snapshot(bs);
         aio_context_release(ctx);
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]