diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-02-19 16:48:10 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-02-22 09:49:46 +0100 |
commit | 12d5ee3a7e83a42ba75a79b220a9db4dacd70a6e (patch) | |
tree | 213170f7769782df87cc56ed9bef124bf04efcd5 /blockdev.c | |
parent | bca5a8f4624f1859ad1a2b078e6b685456e6befd (diff) |
block: Fix -incoming with snapshot=on
The BDRV_O_INACTIVE flag should only be set for images explicitly opened
by the user. snapshot=on needs to create a new qcow2 image and write
some metadata to it. This is not a problem because it can't come from
the source, so there's no reason to mark it as BDRV_O_INACTIVE, even
though it is opened while waiting for the migration to complete.
This fixes an assertion failure when -incoming and snapshot=on are
combined.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c index 1f7347821c..ed97d8a7ba 100644 --- a/blockdev.c +++ b/blockdev.c @@ -610,6 +610,10 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, qdict_put(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, qstring_from_str("on")); } + if (runstate_check(RUN_STATE_INMIGRATE)) { + bdrv_flags |= BDRV_O_INACTIVE; + } + blk = blk_new_open(qemu_opts_id(opts), file, NULL, bs_opts, bdrv_flags, errp); if (!blk) { @@ -688,6 +692,10 @@ static BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp) goto fail; } + if (runstate_check(RUN_STATE_INMIGRATE)) { + bdrv_flags |= BDRV_O_INACTIVE; + } + bs = NULL; ret = bdrv_open(&bs, NULL, NULL, bs_opts, bdrv_flags, errp); if (ret < 0) { |