diff options
author | Ashijeet Acharya <ashijeetacharya@gmail.com> | 2017-01-16 17:01:53 +0530 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-01-24 18:00:30 +0000 |
commit | fe44dc91807eca59d0230fe828c1e2ee0c305a1e (patch) | |
tree | ecbc1e1fd3a3052910eff44f0f6e8a84b626b199 /block/vhdx.c | |
parent | a3a3d8c73889282eb696535f1b5345d88b4dc58c (diff) |
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 <jsnow@redhat.com>
Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
Message-Id: <1484566314-3987-5-git-send-email-ashijeetacharya@gmail.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Acked-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Merged with recent 'Allow invtsc migration' change
Diffstat (limited to 'block/vhdx.c')
-rw-r--r-- | block/vhdx.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/block/vhdx.c b/block/vhdx.c index 0ba2f0a2f9..68db9e074e 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -991,6 +991,17 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, } } + /* Disable migration when VHDX images are used */ + error_setg(&s->migration_blocker, "The vhdx format used by node '%s' " + "does not support live migration", + bdrv_get_device_or_node_name(bs)); + ret = migrate_add_blocker(s->migration_blocker, &local_err); + if (local_err) { + error_propagate(errp, local_err); + error_free(s->migration_blocker); + goto fail; + } + if (flags & BDRV_O_RDWR) { ret = vhdx_update_headers(bs, s, false, NULL); if (ret < 0) { @@ -1000,12 +1011,6 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, /* TODO: differencing files */ - /* Disable migration when VHDX images are used */ - error_setg(&s->migration_blocker, "The vhdx format used by node '%s' " - "does not support live migration", - bdrv_get_device_or_node_name(bs)); - migrate_add_blocker(s->migration_blocker); - return 0; fail: vhdx_close(bs); |