OSDN Git Service

net/virtio: return early when failover primary alread added
authorJens Freimann <jfreimann@redhat.com>
Wed, 20 Nov 2019 15:49:49 +0000 (16:49 +0100)
committerJason Wang <jasowang@redhat.com>
Mon, 25 Nov 2019 15:30:28 +0000 (23:30 +0800)
Bail out when primary device was already added before.
This avoids printing a wrong warning message during reboot.

Fixes: 9711cd0dfc3f ("net/virtio: add failover support")
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/virtio-net.c

index 946039c..ac4d191 100644 (file)
@@ -759,6 +759,10 @@ static void failover_add_primary(VirtIONet *n, Error **errp)
 {
     Error *err = NULL;
 
+    if (n->primary_dev) {
+        return;
+    }
+
     n->primary_device_opts = qemu_opts_find(qemu_find_opts("device"),
             n->primary_device_id);
     if (n->primary_device_opts) {