This function will help to inform the block layer that an incoming live migration is coming in order to make proper usage of the BDRV_O_INCOMING flag.
Signed-off-by: Benoit Canet <benoit.ca...@gmail.com> --- block.c | 8 ++++++++ block.h | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 52ffe14..3e2260d 100644 --- a/block.c +++ b/block.c @@ -100,6 +100,8 @@ static BlockDriverState *bs_snapshots; /* If non-zero, use only whitelisted block drivers */ static int use_bdrv_whitelist; +static bool incoming_migration; + #ifdef _WIN32 static int is_windows_drive_prefix(const char *filename) { @@ -3580,6 +3582,12 @@ void bdrv_invalidate_cache_all(void) } } +void bdrv_set_incoming_migration(void) +{ + assert(incoming_migration == false); + incoming_migration = true; +} + int bdrv_flush(BlockDriverState *bs) { Coroutine *co; diff --git a/block.h b/block.h index e320d8f..23af1cc 100644 --- a/block.h +++ b/block.h @@ -223,6 +223,8 @@ BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, void bdrv_invalidate_cache(BlockDriverState *bs); void bdrv_invalidate_cache_all(void); +void bdrv_set_incoming_migration(void); + /* Ensure contents are flushed to disk. */ int bdrv_flush(BlockDriverState *bs); int coroutine_fn bdrv_co_flush(BlockDriverState *bs); -- 1.7.7.6