diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-02-22 10:21:15 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-02-22 10:21:15 +0100 |
commit | 9bd9c7f5b51447b073524a7ff280c3f8eefbd38a (patch) | |
tree | 4f9c8d5853fe214cd0866436fc0d9c1c3e4ea11b /migration/block.c | |
parent | a513416ecf86956757c82f030506f516fc015313 (diff) |
block migration: Activate image on destination before writing to it
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 09e0c771.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'migration/block.c')
-rw-r--r-- | migration/block.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/migration/block.c b/migration/block.c index a444058cf7..3a8330a4b3 100644 --- a/migration/block.c +++ b/migration/block.c @@ -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; @@ -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) { |