71 lines
2.5 KiB
Diff
71 lines
2.5 KiB
Diff
|
From 24bd4b43c3f59c9c28f924da8ef7a9dacc0f2f52 Mon Sep 17 00:00:00 2001
|
||
|
From: Laurent Vivier <lvivier@redhat.com>
|
||
|
Date: Thu, 25 Feb 2021 23:14:33 -0500
|
||
|
Subject: [PATCH 36/54] failover: simplify virtio_net_find_primary()
|
||
|
|
||
|
RH-Author: Laurent Vivier <lvivier@redhat.com>
|
||
|
Message-id: <20210225231447.2187738-14-lvivier@redhat.com>
|
||
|
Patchwork-id: 101253
|
||
|
O-Subject: [RHEL-AV-8.4.0 qemu-kvm PATCH v2 13/27] failover: simplify virtio_net_find_primary()
|
||
|
Bugzilla: 1819991
|
||
|
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
||
|
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||
|
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
|
||
|
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
||
|
|
||
|
From: Juan Quintela <quintela@redhat.com>
|
||
|
|
||
|
BZ: https://bugzilla.redhat.com/1819991
|
||
|
BRANCH: rhel-av-8.4.0
|
||
|
UPSTREAM: Merged
|
||
|
|
||
|
a - is_my_primary() never sets one error
|
||
|
b - If we return 1, primary_device_id is always set
|
||
|
|
||
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
||
|
Message-Id: <20201118083748.1328-15-quintela@redhat.com>
|
||
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||
|
(cherry picked from commit 7cf05b7ed8e84e89b873701e3dfcd56aa81b2d13)
|
||
|
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
||
|
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||
|
---
|
||
|
hw/net/virtio-net.c | 18 +++---------------
|
||
|
1 file changed, 3 insertions(+), 15 deletions(-)
|
||
|
|
||
|
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
|
||
|
index 70fa372c08..881907d1bd 100644
|
||
|
--- a/hw/net/virtio-net.c
|
||
|
+++ b/hw/net/virtio-net.c
|
||
|
@@ -828,24 +828,12 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)
|
||
|
|
||
|
static DeviceState *virtio_net_find_primary(VirtIONet *n, Error **errp)
|
||
|
{
|
||
|
- DeviceState *dev = NULL;
|
||
|
Error *err = NULL;
|
||
|
|
||
|
- if (qemu_opts_foreach(qemu_find_opts("device"),
|
||
|
- is_my_primary, n, &err)) {
|
||
|
- if (err) {
|
||
|
- error_propagate(errp, err);
|
||
|
- return NULL;
|
||
|
- }
|
||
|
- if (n->primary_device_id) {
|
||
|
- dev = qdev_find_recursive(sysbus_get_default(),
|
||
|
- n->primary_device_id);
|
||
|
- } else {
|
||
|
- error_setg(errp, "Primary device id not found");
|
||
|
- return NULL;
|
||
|
- }
|
||
|
+ if (!qemu_opts_foreach(qemu_find_opts("device"), is_my_primary, n, &err)) {
|
||
|
+ return NULL;
|
||
|
}
|
||
|
- return dev;
|
||
|
+ return qdev_find_recursive(sysbus_get_default(), n->primary_device_id);
|
||
|
}
|
||
|
|
||
|
static DeviceState *virtio_connect_failover_devices(VirtIONet *n, Error **errp)
|
||
|
--
|
||
|
2.27.0
|
||
|
|