From fe44dc91807eca59d0230fe828c1e2ee0c305a1e Mon Sep 17 00:00:00 2001 From: Ashijeet Acharya Date: Mon, 16 Jan 2017 17:01:53 +0530 Subject: migration: disallow migrate_add_blocker during migration If a migration is already in progress and somebody attempts to add a migration blocker, this should rightly fail. Add an errp parameter and a retcode return value to migrate_add_blocker. Signed-off-by: John Snow Signed-off-by: Ashijeet Acharya Message-Id: <1484566314-3987-5-git-send-email-ashijeetacharya@gmail.com> Reviewed-by: Dr. David Alan Gilbert Acked-by: Greg Kurz Signed-off-by: Dr. David Alan Gilbert Merged with recent 'Allow invtsc migration' change --- block/vdi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'block/vdi.c') diff --git a/block/vdi.c b/block/vdi.c index 96b78d5a43..0aeb940aa8 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -361,6 +361,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, VdiHeader header; size_t bmap_size; int ret; + Error *local_err = NULL; logout("\n"); @@ -471,7 +472,12 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, error_setg(&s->migration_blocker, "The vdi format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); - migrate_add_blocker(s->migration_blocker); + ret = migrate_add_blocker(s->migration_blocker, &local_err); + if (local_err) { + error_propagate(errp, local_err); + error_free(s->migration_blocker); + goto fail_free_bmap; + } qemu_co_mutex_init(&s->write_lock); -- cgit v1.2.3