Skip to content

Commit a1190ab

Browse files
jensfrmstsirkin
authored andcommitted
migration: allow unplug during migration for failover devices
In "b06424de62 migration: Disable hotplug/unplug during migration" we added a check to disable unplug for all devices until we have figured out what works. For failover primary devices qdev_unplug() is called from the migration handler, i.e. during migration. This patch adds a flag to DeviceState which is set to false for all devices and makes an exception for PCI devices that are also primary devices in a failover pair. Signed-off-by: Jens Freimann <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 70d0497 commit a1190ab

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

hw/core/qdev.c

+1
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@ static void device_initfn(Object *obj)
996996

997997
dev->instance_id_alias = -1;
998998
dev->realized = false;
999+
dev->allow_unplug_during_migration = false;
9991000

10001001
object_property_add_bool(obj, "realized",
10011002
device_get_realized, device_set_realized, NULL);

hw/pci/pci.c

+1
Original file line numberDiff line numberDiff line change
@@ -2130,6 +2130,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
21302130
pci_qdev_unrealize(DEVICE(pci_dev), NULL);
21312131
return;
21322132
}
2133+
qdev->allow_unplug_during_migration = true;
21332134
}
21342135

21352136
/* rom loading */

include/hw/qdev-core.h

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct DeviceState {
156156
bool pending_deleted_event;
157157
QemuOpts *opts;
158158
int hotplugged;
159+
bool allow_unplug_during_migration;
159160
BusState *parent_bus;
160161
QLIST_HEAD(, NamedGPIOList) gpios;
161162
QLIST_HEAD(, BusState) child_bus;

qdev-monitor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
851851
return;
852852
}
853853

854-
if (!migration_is_idle()) {
854+
if (!migration_is_idle() && !dev->allow_unplug_during_migration) {
855855
error_setg(errp, "device_del not allowed while migrating");
856856
return;
857857
}

0 commit comments

Comments
 (0)