]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
migration: Disable hotplug/unplug during migration
authorJuan Quintela <quintela@redhat.com>
Wed, 22 Mar 2017 16:34:27 +0000 (17:34 +0100)
committerJuan Quintela <quintela@redhat.com>
Fri, 21 Apr 2017 10:25:40 +0000 (12:25 +0200)
Until we have reviewed what can/can't be hotplugged during migration,
disable it.  We can enable it later for the things that we know that
work.  For instance, memory hotplug during postcopy doesn't work
currently.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
--

- Fix typo.  Thanks Thomas.
- Delay migration check after we have checked that we can hotplug that
  device.
- more typos

qdev-monitor.c

index bb3d8ba36013153c4260a4cae0d2c45875d86c4e..e61d596ef7e366704fb6c43201706284d42c2027 100644 (file)
@@ -29,6 +29,7 @@
 #include "qemu/error-report.h"
 #include "qemu/help_option.h"
 #include "sysemu/block-backend.h"
+#include "migration/migration.h"
 
 /*
  * Aliases were a bad idea from the start.  Let's keep them
@@ -603,6 +604,11 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
         return NULL;
     }
 
+    if (!migration_is_idle()) {
+        error_setg(errp, "device_add not allowed while migrating");
+        return NULL;
+    }
+
     /* create device */
     dev = DEVICE(object_new(driver));
 
@@ -853,6 +859,11 @@ void qdev_unplug(DeviceState *dev, Error **errp)
         return;
     }
 
+    if (!migration_is_idle()) {
+        error_setg(errp, "device_del not allowed while migrating");
+        return;
+    }
+
     qdev_hot_removed = true;
 
     hotplug_ctrl = qdev_get_hotplug_handler(dev);