mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-30 13:31:52 -06:00
failover: make sure that id always exist
We check that it exist at device creation time, so we don't have to check anywhere else. Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20201118083748.1328-22-quintela@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
2e28095369
commit
fec037c1e2
2 changed files with 4 additions and 3 deletions
|
@ -3173,9 +3173,6 @@ static bool failover_hide_primary_device(DeviceListener *listener,
|
||||||
hide = qatomic_read(&n->failover_primary_hidden);
|
hide = qatomic_read(&n->failover_primary_hidden);
|
||||||
g_free(n->primary_device_id);
|
g_free(n->primary_device_id);
|
||||||
n->primary_device_id = g_strdup(device_opts->id);
|
n->primary_device_id = g_strdup(device_opts->id);
|
||||||
if (!n->primary_device_id) {
|
|
||||||
warn_report("primary_device_id not set");
|
|
||||||
}
|
|
||||||
return hide;
|
return hide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -613,6 +613,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_opt_get(opts, "failover_pair_id")) {
|
if (qemu_opt_get(opts, "failover_pair_id")) {
|
||||||
|
if (!opts->id) {
|
||||||
|
error_setg(errp, "Device with failover_pair_id don't have id");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (qdev_should_hide_device(opts)) {
|
if (qdev_should_hide_device(opts)) {
|
||||||
if (bus && !qbus_is_hotpluggable(bus)) {
|
if (bus && !qbus_is_hotpluggable(bus)) {
|
||||||
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue