mirror of https://github.com/proxmox/mirror_qemu
failover: Remove primary_device_opts
It was really only used once, in failover_add_primary(). Just search for it on global opts when it is needed. Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20201118083748.1328-11-quintela@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>master
parent
518eda9fda
commit
19e49bc2e9
|
@ -791,17 +791,17 @@ static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n)
|
||||||
static void failover_add_primary(VirtIONet *n, Error **errp)
|
static void failover_add_primary(VirtIONet *n, Error **errp)
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
QemuOpts *opts;
|
||||||
|
|
||||||
if (n->primary_dev) {
|
if (n->primary_dev) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
n->primary_device_opts = qemu_opts_find(qemu_find_opts("device"),
|
opts = qemu_opts_find(qemu_find_opts("device"), n->primary_device_id);
|
||||||
n->primary_device_id);
|
if (opts) {
|
||||||
if (n->primary_device_opts) {
|
n->primary_dev = qdev_device_add(opts, &err);
|
||||||
n->primary_dev = qdev_device_add(n->primary_device_opts, &err);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
qemu_opts_del(n->primary_device_opts);
|
qemu_opts_del(opts);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_setg(errp, "Primary device not found");
|
error_setg(errp, "Primary device not found");
|
||||||
|
@ -856,7 +856,6 @@ static DeviceState *virtio_connect_failover_devices(VirtIONet *n, Error **errp)
|
||||||
prim_dev = virtio_net_find_primary(n, &err);
|
prim_dev = virtio_net_find_primary(n, &err);
|
||||||
if (prim_dev) {
|
if (prim_dev) {
|
||||||
n->primary_device_id = g_strdup(prim_dev->id);
|
n->primary_device_id = g_strdup(prim_dev->id);
|
||||||
n->primary_device_opts = prim_dev->opts;
|
|
||||||
} else {
|
} else {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
}
|
}
|
||||||
|
@ -3113,14 +3112,6 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)
|
||||||
if (!pdev->partially_hotplugged) {
|
if (!pdev->partially_hotplugged) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!n->primary_device_opts) {
|
|
||||||
n->primary_device_opts = qemu_opts_from_qdict(qemu_find_opts("device"),
|
|
||||||
n->primary_device_dict,
|
|
||||||
errp);
|
|
||||||
if (!n->primary_device_opts) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
primary_bus = n->primary_dev->parent_bus;
|
primary_bus = n->primary_dev->parent_bus;
|
||||||
if (!primary_bus) {
|
if (!primary_bus) {
|
||||||
error_setg(errp, "virtio_net: couldn't find primary bus");
|
error_setg(errp, "virtio_net: couldn't find primary bus");
|
||||||
|
@ -3211,8 +3202,6 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
n->primary_device_opts = device_opts;
|
|
||||||
|
|
||||||
/* failover_primary_hidden is set during feature negotiation */
|
/* failover_primary_hidden is set during feature negotiation */
|
||||||
hide = qatomic_read(&n->failover_primary_hidden);
|
hide = qatomic_read(&n->failover_primary_hidden);
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,6 @@ struct VirtIONet {
|
||||||
AnnounceTimer announce_timer;
|
AnnounceTimer announce_timer;
|
||||||
bool needs_vnet_hdr_swap;
|
bool needs_vnet_hdr_swap;
|
||||||
bool mtu_bypass_backend;
|
bool mtu_bypass_backend;
|
||||||
QemuOpts *primary_device_opts;
|
|
||||||
QDict *primary_device_dict;
|
QDict *primary_device_dict;
|
||||||
DeviceState *primary_dev;
|
DeviceState *primary_dev;
|
||||||
char *primary_device_id;
|
char *primary_device_id;
|
||||||
|
|
Loading…
Reference in New Issue