failover: Remove primary_device_dict
It was only used once. And we have there opts->id, so no need for it. Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20201118083748.1328-13-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
4f0303aed8
commit
9673a88e97
|
@ -3186,28 +3186,21 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,
|
||||||
if (!device_opts) {
|
if (!device_opts) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
n->primary_device_dict = qemu_opts_to_qdict(device_opts,
|
|
||||||
n->primary_device_dict);
|
|
||||||
standby_id = qemu_opt_get(device_opts, "failover_pair_id");
|
standby_id = qemu_opt_get(device_opts, "failover_pair_id");
|
||||||
if (g_strcmp0(standby_id, n->netclient_name) == 0) {
|
if (g_strcmp0(standby_id, n->netclient_name) == 0) {
|
||||||
match_found = true;
|
match_found = true;
|
||||||
} else {
|
} else {
|
||||||
match_found = false;
|
match_found = false;
|
||||||
hide = false;
|
hide = false;
|
||||||
n->primary_device_dict = NULL;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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);
|
||||||
|
g_free(n->primary_device_id);
|
||||||
if (n->primary_device_dict) {
|
n->primary_device_id = g_strdup(device_opts->id);
|
||||||
g_free(n->primary_device_id);
|
if (!n->primary_device_id) {
|
||||||
n->primary_device_id = g_strdup(qdict_get_try_str(
|
warn_report("primary_device_id not set");
|
||||||
n->primary_device_dict, "id"));
|
|
||||||
if (!n->primary_device_id) {
|
|
||||||
warn_report("primary_device_id not set");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -3396,8 +3389,6 @@ static void virtio_net_device_unrealize(DeviceState *dev)
|
||||||
if (n->failover) {
|
if (n->failover) {
|
||||||
device_listener_unregister(&n->primary_listener);
|
device_listener_unregister(&n->primary_listener);
|
||||||
g_free(n->primary_device_id);
|
g_free(n->primary_device_id);
|
||||||
qobject_unref(n->primary_device_dict);
|
|
||||||
n->primary_device_dict = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
max_queues = n->multiqueue ? n->max_queues : 1;
|
max_queues = n->multiqueue ? n->max_queues : 1;
|
||||||
|
|
|
@ -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;
|
||||||
QDict *primary_device_dict;
|
|
||||||
DeviceState *primary_dev;
|
DeviceState *primary_dev;
|
||||||
char *primary_device_id;
|
char *primary_device_id;
|
||||||
/* primary failover device is hidden*/
|
/* primary failover device is hidden*/
|
||||||
|
|
Loading…
Reference in a new issue