net/virtio: return early when failover primary alread added

Bail out when primary device was already added before.
This avoids printing a wrong warning message during reboot.

Fixes: 9711cd0dfc ("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>
master
Jens Freimann 2019-11-20 16:49:49 +01:00 committed by Jason Wang
parent 284f42a520
commit 117378bf03
1 changed files with 4 additions and 0 deletions

View 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) {