]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
802.1Qbh: Delay IFF_UP'ing interface until migration final stage
authorRoopa Prabhu <roprabhu@cisco.com>
Tue, 22 Feb 2011 12:48:54 +0000 (07:48 -0500)
committerStefan Berger <stefanb@us.ibm.com>
Tue, 22 Feb 2011 12:48:54 +0000 (07:48 -0500)
Current code does an IFF_UP on a 8021Qbh interface immediately after a port
profile set. This is ok in most cases except when its the migration prepare
stage. During migration we want to postpone IFF_UP'ing the interface on the
destination host until the source host has disassociated the interface.
This patch moves IFF_UP of the interface to the final stage of migration.
The motivation for this change is to postpone any addr registrations on the
destination host until the source host has done the addr deregistrations.

While at it, for symmetry with associate move ifDown of a 8021Qbh interface
to before disassociate

src/util/macvtap.c

index 8814400f7b3319297344cd018c7660aa99d33cbc..a71db864c6ff951415c4c54d233f23cf7a122bc3 100644 (file)
@@ -1470,8 +1470,6 @@ doPortProfileOp8021Qbh(const char *ifname,
                                   NULL,
                                   vf,
                                   PORT_REQUEST_DISASSOCIATE);
-        if (!rc)
-            ifaceUp(ifname);
         break;
 
     case DISASSOCIATE:
@@ -1484,7 +1482,6 @@ doPortProfileOp8021Qbh(const char *ifname,
                                    NULL,
                                    vf,
                                    PORT_REQUEST_DISASSOCIATE);
-        ifaceDown(ifname);
         break;
 
     default:
@@ -1550,10 +1547,11 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
 
     case VIR_VIRTUALPORT_8021QBH:
         /* avoid associating twice */
-        if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
-            break;
-        rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
-                                    virtPort, vmuuid, ASSOCIATE);
+        if (vmOp != VIR_VM_OP_MIGRATE_IN_FINISH)
+            rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
+                                        virtPort, vmuuid, ASSOCIATE);
+        if (vmOp != VIR_VM_OP_MIGRATE_IN_START && !rc)
+            ifaceUp(linkdev);
         break;
     }
 
@@ -1600,6 +1598,7 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
         /* avoid disassociating twice */
         if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
             break;
+        ifaceDown(linkdev);
         rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
                                     virtPort, NULL, DISASSOCIATE);
         break;