]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: only register callbacks for CREATE operations in virnetdevmacvlan.c
authorD. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
Fri, 13 Apr 2012 12:41:16 +0000 (14:41 +0200)
committerLaine Stump <laine@laine.org>
Wed, 18 Apr 2012 12:05:17 +0000 (08:05 -0400)
Currently upon a migration a callback is created when a 802.1qbg link
is set to PREASSOCIATE, this should not happen because this is a no-op
on most switches, and does not lead to an ASSOCIATE state.  This patch
only creates callbacks when CREATE or RESTORE is requested.  Migration
and libvirtd restart scenarios are already handled elsewhere.

Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
src/util/virnetdevmacvlan.c

index 326e29c4abd0221632f7905f2be2fe9e0832c6aa..879d846e8522217dd3159021866d4a2dfa16a532 100644 (file)
@@ -945,9 +945,18 @@ create_name:
         goto disassociate_exit;
     }
 
-    if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
-                                         linkdev, vmuuid, virtPortProfile, vmOp) < 0 )
+    if (vmOp == VIR_NETDEV_VPORT_PROFILE_OP_CREATE ||
+        vmOp == VIR_NETDEV_VPORT_PROFILE_OP_RESTORE) {
+        /* Only directly register upon a create or restore (restarting
+         * a saved image) - migration and libvirtd restart are handled
+         * elsewhere.
+         */
+        if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
+                                                         linkdev, vmuuid,
+                                                         virtPortProfile,
+                                                         vmOp) < 0 )
         goto disassociate_exit;
+    }
 
     return rc;