[libvirt] [PATCH] 802.1Qbh: Delay IFF_UP'ing interface until migration final stage

Roopa Prabhu roprabhu at cisco.com
Sat Feb 19 04:11:31 UTC 2011


From: Roopa Prabhu <roprabhu at cisco.com>

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

Signed-off-by: Roopa Prabhu <roprabhu at cisco.com>
Signed-off-by: David Wang <dwang2 at cisco.com>
Signed-off-by: Christian Benvenuti <benve at cisco.com>
---
 src/util/macvtap.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)


diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 8814400..a71db86 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -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;




More information about the libvir-list mailing list