aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/net/virtio-net.c12
-rw-r--r--softmmu/qdev-monitor.c18
2 files changed, 17 insertions, 13 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 83642c8..3dd2896 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3299,7 +3299,17 @@ static bool failover_hide_primary_device(DeviceListener *listener,
if (!device_opts) {
return false;
}
- standby_id = qdict_get_try_str(device_opts, "failover_pair_id");
+
+ if (!qdict_haskey(device_opts, "failover_pair_id")) {
+ return false;
+ }
+
+ if (!qdict_haskey(device_opts, "id")) {
+ error_setg(errp, "Device with failover_pair_id needs to have id");
+ return false;
+ }
+
+ standby_id = qdict_get_str(device_opts, "failover_pair_id");
if (g_strcmp0(standby_id, n->netclient_name) != 0) {
return false;
}
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 89c473c..4851de5 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -639,19 +639,13 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts,
}
}
- if (qdict_haskey(opts, "failover_pair_id")) {
- if (!qdict_haskey(opts, "id")) {
- error_setg(errp, "Device with failover_pair_id don't have id");
- return NULL;
- }
- if (qdev_should_hide_device(opts, from_json, errp)) {
- if (bus && !qbus_is_hotpluggable(bus)) {
- error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
- }
- return NULL;
- } else if (*errp) {
- return NULL;
+ if (qdev_should_hide_device(opts, from_json, errp)) {
+ if (bus && !qbus_is_hotpluggable(bus)) {
+ error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
}
+ return NULL;
+ } else if (*errp) {
+ return NULL;
}
if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) {