summaryrefslogtreecommitdiffstats
path: root/hw/virtio/vhost.c
diff options
context:
space:
mode:
authorAshijeet Acharya2017-01-16 12:31:53 +0100
committerDr. David Alan Gilbert2017-01-24 19:00:30 +0100
commitfe44dc91807eca59d0230fe828c1e2ee0c305a1e (patch)
treeecbc1e1fd3a3052910eff44f0f6e8a84b626b199 /hw/virtio/vhost.c
parentmigration: Allow "device add" options to only add migratable devices (diff)
downloadqemu-fe44dc91807eca59d0230fe828c1e2ee0c305a1e.tar.gz
qemu-fe44dc91807eca59d0230fe828c1e2ee0c305a1e.tar.xz
qemu-fe44dc91807eca59d0230fe828c1e2ee0c305a1e.zip
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 'hw/virtio/vhost.c')
-rw-r--r--hw/virtio/vhost.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 9cacf557f2..b124d97d7c 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1176,6 +1176,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
{
uint64_t features;
int i, r, n_initialized_vqs = 0;
+ Error *local_err = NULL;
hdev->vdev = NULL;
hdev->migration_blocker = NULL;
@@ -1256,7 +1257,12 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
}
if (hdev->migration_blocker != NULL) {
- migrate_add_blocker(hdev->migration_blocker);
+ r = migrate_add_blocker(hdev->migration_blocker, &local_err);
+ if (local_err) {
+ error_report_err(local_err);
+ error_free(hdev->migration_blocker);
+ goto fail_busyloop;
+ }
}
hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));