Skip to content

Commit

Permalink
block migration: Activate image on destination before writing to it
Browse files Browse the repository at this point in the history
When using 'migrate -b', we must make sure to take ownership of the
image before writing to it. Otherwise metadata would be thrown away on
migration completion; this was caught by the assertions introduced in
commit 09e0c77.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
kevmw committed Feb 22, 2016
1 parent a513416 commit 9bd9c7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions migration/block.c
Expand Up @@ -786,6 +786,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
int64_t addr;
BlockDriverState *bs, *bs_prev = NULL;
BlockBackend *blk;
Error *local_err = NULL;
uint8_t *buf;
int64_t total_sectors = 0;
int nr_sectors;
Expand Down Expand Up @@ -824,6 +825,12 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
device_name);
return -EINVAL;
}

bdrv_invalidate_cache(bs, &local_err);
if (local_err) {
error_report_err(local_err);
return -EINVAL;
}
}

if (total_sectors - addr < BDRV_SECTORS_PER_DIRTY_CHUNK) {
Expand Down

0 comments on commit 9bd9c7f

Please sign in to comment.