]> xenbits.xensource.com Git - libvirt.git/commitdiff
virnetdevbridge: Ignore EEXIST when adding an entry to fdb
authorJiri Denemark <jdenemar@redhat.com>
Fri, 30 Apr 2021 15:25:29 +0000 (17:25 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 3 May 2021 09:12:58 +0000 (11:12 +0200)
When updating entries in a bridge forwarding database (i.e., when
macTableManager='libvirt' is configured for the bridge), we may end up
in a situation when the entry we want to add is already present. Let's
just ignore the error in such a case.

This fixes an error to resume a domain when fdb entries were not
properly removed when the domain was paused:

    virsh # resume test
    error: Failed to resume domain test
    error: error adding fdb entry for vnet2: File exists

For some reason, fdb entries are only removed when libvirt explicitly
stops CPUs, but nothing happens when we just get STOP event from QEMU.
An alternative approach would be to make sure we always remove the
entries regardless on why a domain was paused (e.g., during migration),
but that would be a significantly more disruptive change with possible
side effects.

https://bugzilla.redhat.com/show_bug.cgi?id=1603155

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/util/virnetdevbridge.c

index 7b5ea4fe1d071ac6e44faedbb223bfd58e8e8000..4fe84cc162293196b4e7ddf46c742511389b9e18 100644 (file)
@@ -1063,9 +1063,13 @@ virNetDevBridgeFDBAddDel(const virMacAddr *mac, const char *ifname,
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
         if (err->error) {
-            virReportSystemError(-err->error,
-                                 _("error adding fdb entry for %s"), ifname);
-            return -1;
+            if (isAdd && -err->error == EEXIST) {
+                VIR_DEBUG("fdb entry for %s already exists", ifname);
+            } else {
+                virReportSystemError(-err->error,
+                                     _("error adding fdb entry for %s"), ifname);
+                return -1;
+            }
         }
         break;
     case NLMSG_DONE: