aboutsummaryrefslogtreecommitdiff
path: root/qdev-monitor.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2017-03-22 17:34:27 +0100
committerJuan Quintela <quintela@redhat.com>2017-04-21 12:25:40 +0200
commitb06424de62b362034e41ddf77eb8cfaa641d9009 (patch)
treedf820ca324310d0ccac271244788414d343d79b1 /qdev-monitor.c
parent329006799f93265bff5e10a4e1dd50b66fe09e6b (diff)
migration: Disable hotplug/unplug during migration
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
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r--qdev-monitor.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c
index bb3d8ba360..e61d596ef7 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -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);