]> git.proxmox.com Git - mirror_qemu.git/commitdiff
migration: allow unplug during migration for failover devices
authorJens Freimann <jfreimann@redhat.com>
Tue, 29 Oct 2019 11:49:01 +0000 (12:49 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 29 Oct 2019 22:55:26 +0000 (18:55 -0400)
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 <jfreimann@redhat.com>
Message-Id: <20191029114905.6856-8-jfreimann@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/core/qdev.c
hw/pci/pci.c
include/hw/qdev-core.h
qdev-monitor.c

index 3b8d43d0fd93dba6b1a7c4925b09e63515f278b4..cf1ba28fe35346618cb71120576c0de8e1e9f6ea 100644 (file)
@@ -996,6 +996,7 @@ static void device_initfn(Object *obj)
 
     dev->instance_id_alias = -1;
     dev->realized = false;
+    dev->allow_unplug_during_migration = false;
 
     object_property_add_bool(obj, "realized",
                              device_get_realized, device_set_realized, NULL);
index 824ab4ed7bf396d1988d37db5c44364968fedde5..c68498c0de9907f4b0ddd97d1601f4b09fc7caeb 100644 (file)
@@ -2130,6 +2130,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
             pci_qdev_unrealize(DEVICE(pci_dev), NULL);
             return;
         }
+        qdev->allow_unplug_during_migration = true;
     }
 
     /* rom loading */
index 710981af36398681355b2760b0f75ecd55314cd1..1518495b1e0a953fa1547889f5dcf3da16de35c6 100644 (file)
@@ -156,6 +156,7 @@ struct DeviceState {
     bool pending_deleted_event;
     QemuOpts *opts;
     int hotplugged;
+    bool allow_unplug_during_migration;
     BusState *parent_bus;
     QLIST_HEAD(, NamedGPIOList) gpios;
     QLIST_HEAD(, BusState) child_bus;
index ffa08c670fac549af6e0471bf2198741ad09376a..e6b112eb0ab0252ecb1d585d3784f858f1adc8ab 100644 (file)
@@ -851,7 +851,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
         return;
     }
 
-    if (!migration_is_idle()) {
+    if (!migration_is_idle() && !dev->allow_unplug_during_migration) {
         error_setg(errp, "device_del not allowed while migrating");
         return;
     }