From: Roopa Prabhu Date: Tue, 22 Feb 2011 12:48:54 +0000 (-0500) Subject: 802.1Qbh: Delay IFF_UP'ing interface until migration final stage X-Git-Tag: CVE-2011-1146~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfd39ccda8d0347636d92b89bf569b1dc9924ea6;p=thirdparty%2Flibvirt.git 802.1Qbh: Delay IFF_UP'ing interface until migration final stage 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 --- diff --git a/src/util/macvtap.c b/src/util/macvtap.c index 8814400f7b..a71db864c6 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;