From: "Denis V. Lunev" <den@openvz.org>
Cc: Kevin Wolf <kwolf@redhat.com>, "Denis V. Lunev" <den@openvz.org>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 8/8] block: allow to skip block driver in selection of one for VM state saving
Date: Thu, 14 Jan 2016 14:29:01 +0300 [thread overview]
Message-ID: <1452770941-21582-9-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1452770941-21582-1-git-send-email-den@openvz.org>
Some block drives like PFLASH ones in OVFM setup are not suitable for
VM state saving. Allow option to ban them in this selection.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
---
block.c | 7 +++++++
block/snapshot.c | 10 ++++++++++
include/block/block_int.h | 3 +++
3 files changed, 20 insertions(+)
diff --git a/block.c b/block.c
index 01655de..c36393f 100644
--- a/block.c
+++ b/block.c
@@ -895,6 +895,12 @@ static QemuOptsList bdrv_runtime_opts = {
.type = QEMU_OPT_BOOL,
.help = "Ignore flush requests",
},
+ {
+ .name = "vmstate",
+ .type = QEMU_OPT_BOOL,
+ .help = "Allow to select to save VM state",
+ .def_value_str = "on",
+ },
{ /* end of list */ }
},
};
@@ -957,6 +963,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
bs->zero_beyond_eof = true;
open_flags = bdrv_open_flags(bs, flags);
bs->read_only = !(open_flags & BDRV_O_RDWR);
+ bs->enable_vmstate = qemu_opt_get_bool(opts, "vmstate", true);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
error_setg(errp,
diff --git a/block/snapshot.c b/block/snapshot.c
index 237a015..eb73c76 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -498,6 +498,12 @@ BlockDriverState *bdrv_all_find_vmstate_bs(const char *device, Error **errp)
device);
return NULL;
}
+ if (!bs->enable_vmstate) {
+ error_setg(errp,
+ "It is not allowed to save VM state to the device '%s'",
+ device);
+ return NULL;
+ }
ctx = bdrv_get_aio_context(bs);
@@ -515,6 +521,10 @@ BlockDriverState *bdrv_all_find_vmstate_bs(const char *device, Error **errp)
while (not_found && (bs = bdrv_next(bs))) {
ctx = bdrv_get_aio_context(bs);
+ if (!bs->enable_vmstate) {
+ continue;
+ }
+
aio_context_acquire(ctx);
not_found = !bdrv_can_snapshot(bs);
aio_context_release(ctx);
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 256609d..a30b576 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -438,6 +438,9 @@ struct BlockDriverState {
/* do we need to tell the quest if we have a volatile write cache? */
int enable_write_cache;
+ /* allow to save VM state on snapshot here */
+ bool enable_vmstate;
+
/* the following member gives a name to every node on the bs graph. */
char node_name[32];
/* element of the list of named nodes building the graph */
--
2.5.0
next prev parent reply other threads:[~2016-01-14 11:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 11:28 [Qemu-devel] [PATCH v5 0/8] QMP wrappers for VM snapshot operations Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 1/8] migration: split hmp_savevm to migrate_savevm and hmp_savevm wrapper Denis V. Lunev
2016-01-18 15:47 ` Markus Armbruster
2016-01-18 16:00 ` Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 2/8] qmp: create qmp_savevm command Denis V. Lunev
2016-01-18 15:58 ` Markus Armbruster
2016-01-18 16:10 ` Denis V. Lunev
2016-01-19 18:11 ` Markus Armbruster
2016-01-22 8:01 ` Denis V. Lunev
2016-01-22 15:31 ` Markus Armbruster
2016-01-22 16:20 ` Denis V. Lunev
2016-01-26 12:56 ` Peter Krempa
2016-01-26 12:39 ` Peter Krempa
2016-01-14 11:28 ` [Qemu-devel] [PATCH 3/8] qmp: create qmp_delvm command Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 4/8] migration: improve error reporting for load_vmstate Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 5/8] qmp: create QMP implementation of loadvm command Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 6/8] migration, block: better select BDS for VM state loading Denis V. Lunev
2016-05-07 10:45 ` Denis V. Lunev
2016-01-14 11:29 ` [Qemu-devel] [PATCH 7/8] migration, qmp: add optional argument to specify BDS to save VM state to Denis V. Lunev
2016-01-14 11:29 ` Denis V. Lunev [this message]
2016-01-18 9:19 ` [Qemu-devel] [PATCH v6 8/8] block: allow to skip block driver in selection of one for VM state saving Denis V. Lunev
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=1452770941-21582-9-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=kwolf@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).