[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/27] failover: simplify qdev_device_add() failover case
From: |
Juan Quintela |
Subject: |
[PATCH v2 19/27] failover: simplify qdev_device_add() failover case |
Date: |
Wed, 18 Nov 2020 09:37:40 +0100 |
Just put allthe logic inside the same if.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
softmmu/qdev-monitor.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index a25f5d612c..12b7540f17 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -600,7 +600,6 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
const char *driver, *path;
DeviceState *dev = NULL;
BusState *bus = NULL;
- bool hide;
driver = qemu_opt_get(opts, "driver");
if (!driver) {
@@ -634,17 +633,19 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
return NULL;
}
}
- hide = should_hide_device(opts);
- if ((hide || qdev_hotplug) && bus && !qbus_is_hotpluggable(bus)) {
+ if (should_hide_device(opts)) {
+ if (bus && !qbus_is_hotpluggable(bus)) {
+ error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
+ }
+ return NULL;
+ }
+
+ if (qdev_hotplug && bus && !qbus_is_hotpluggable(bus)) {
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
return NULL;
}
- if (hide) {
- return NULL;
- }
-
if (!migration_is_idle()) {
error_setg(errp, "device_add not allowed while migrating");
return NULL;
--
2.26.2
- [PATCH v2 07/27] failover: qdev_device_add() returns err or dev set, (continued)
- [PATCH v2 07/27] failover: qdev_device_add() returns err or dev set, Juan Quintela, 2020/11/18
- [PATCH v2 10/27] failover: Remove primary_device_opts, Juan Quintela, 2020/11/18
- [PATCH v2 11/27] failover: remove standby_id variable, Juan Quintela, 2020/11/18
- [PATCH v2 13/27] failover: Remove memory leak, Juan Quintela, 2020/11/18
- [PATCH v2 12/27] failover: Remove primary_device_dict, Juan Quintela, 2020/11/18
- [PATCH v2 14/27] failover: simplify virtio_net_find_primary(), Juan Quintela, 2020/11/18
- [PATCH v2 15/27] failover: should_be_hidden() should take a bool, Juan Quintela, 2020/11/18
- [PATCH v2 16/27] failover: Rename function to hide_device(), Juan Quintela, 2020/11/18
- [PATCH v2 17/27] failover: virtio_net_connect_failover_devices() does nothing, Juan Quintela, 2020/11/18
- [PATCH v2 18/27] failover: Rename to failover_find_primary_device(), Juan Quintela, 2020/11/18
- [PATCH v2 19/27] failover: simplify qdev_device_add() failover case,
Juan Quintela <=
- [PATCH v2 20/27] failover: simplify qdev_device_add(), Juan Quintela, 2020/11/18
- [PATCH v2 21/27] failover: make sure that id always exist, Juan Quintela, 2020/11/18
- [PATCH v2 22/27] failover: remove failover_find_primary_device() error parameter, Juan Quintela, 2020/11/18
- [PATCH v2 23/27] failover: split failover_find_primary_device_id(), Juan Quintela, 2020/11/18
- [PATCH v2 24/27] failover: We don't need to cache primary_device_id anymore, Juan Quintela, 2020/11/18
- [PATCH v2 25/27] failover: Caller of this two functions already have primary_dev, Juan Quintela, 2020/11/18
- [PATCH v2 27/27] failover: Remove primary_dev member, Juan Quintela, 2020/11/18
- [PATCH v2 26/27] failover: simplify failover_unplug_primary, Juan Quintela, 2020/11/18
- Re: [PATCH v2 00/27] Virtio net failover fixes, Michael S. Tsirkin, 2020/11/18