[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 3/4] savevm: fix savevm after migration
From: |
Denis V. Lunev |
Subject: |
Re: [Qemu-block] [PATCH 3/4] savevm: fix savevm after migration |
Date: |
Mon, 27 Feb 2017 12:42:26 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 02/25/2017 10:31 PM, Vladimir Sementsov-Ogievskiy wrote:
> After migration all drives are inactive and savevm will fail with
>
> qemu-kvm: block/io.c:1406: bdrv_co_do_pwritev:
> Assertion `!(bs->open_flags & 0x0800)' failed.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> ---
> block/snapshot.c | 3 ++-
> migration/savevm.c | 11 +++++++++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/block/snapshot.c b/block/snapshot.c
> index bf5c2ca5e1..256d06ac9f 100644
> --- a/block/snapshot.c
> +++ b/block/snapshot.c
> @@ -145,7 +145,8 @@ bool bdrv_snapshot_find_by_id_and_name(BlockDriverState
> *bs,
> int bdrv_can_snapshot(BlockDriverState *bs)
> {
> BlockDriver *drv = bs->drv;
> - if (!drv || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
> + if (!drv || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
> + (bs->open_flags & BDRV_O_INACTIVE)) {
> return 0;
> }
>
at my opinion we do not need this hunk. It will result in a wrong
thing.
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 5ecd264134..75e56d2d07 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2068,6 +2068,17 @@ int save_vmstate(Monitor *mon, const char *name)
> Error *local_err = NULL;
> AioContext *aio_context;
>
> + if (runstate_check(RUN_STATE_FINISH_MIGRATE) ||
> + runstate_check(RUN_STATE_POSTMIGRATE) ||
> + runstate_check(RUN_STATE_PRELAUNCH))
> + {
> + bdrv_invalidate_cache_all(&local_err);
> + if (local_err) {
> + error_report_err(local_err);
> + return -EINVAL;
> + }
> + }
> +
> if (!bdrv_all_can_snapshot(&bs)) {
> monitor_printf(mon, "Device '%s' is writable but does not "
> "support snapshots.\n", bdrv_get_device_name(bs));