From 56a5a2b97f15b2f5952e97ccecb5695f31ec1acd Mon Sep 17 00:00:00 2001 From: Thomas Bachman Date: Thu, 9 Jun 2016 11:03:47 -0400 Subject: [PATCH] Fix Port Group name construction The port group name was improperly constructed when used with single_tenant_mode = False. It also wasn't passing the port group name into the RPC call to the DVS agent. Lastly, the port needs to be marked as active as part of the port binding process (DVS ports only). This patch fixes all of these issues. Closes-Bug: #1590609, #1590830 Change-Id: I104fc8d24179a673f4d7f3df5ec6e5e3369c5d9a Signed-off-by: Thomas Bachman (cherry picked from commit 9c38c8558632959aa89db8ed038bd1746866fd10) (cherry picked from commit d138ca8ec539f570d5e8fdb5e376f0e086f24b8b) --- .../ml2/drivers/grouppolicy/apic/driver.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gbpservice/neutron/plugins/ml2/drivers/grouppolicy/apic/driver.py b/gbpservice/neutron/plugins/ml2/drivers/grouppolicy/apic/driver.py index 1b4fca5f3..b64d22f16 100644 --- a/gbpservice/neutron/plugins/ml2/drivers/grouppolicy/apic/driver.py +++ b/gbpservice/neutron/plugins/ml2/drivers/grouppolicy/apic/driver.py @@ -13,6 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +import copy + +from neutron.common import constants as n_constants from neutron import context as nctx from neutron.extensions import portbindings from neutron import manager @@ -112,16 +115,21 @@ class APICMechanismGBPDriver(api.MechanismDriver): network = self.apic_gbp._get_network(context._plugin_context, network_id) project_name = self.apic_gbp._tenant_by_sharing_policy(network) + apic_tenant_name = self.apic_gbp.apic_manager.apic.fvTenant.name( + project_name) profile = self.apic_gbp.apic_manager.app_profile_name # Use default security groups from MD vif_details = {portbindings.CAP_PORT_FILTER: False} - vif_details['dvs_port_group_name'] = (str(project_name) + + vif_details['dvs_port_group_name'] = (apic_tenant_name + '|' + str(profile) + '|' + str(ptg_name)) + currentcopy = copy.copy(context.current) + currentcopy['portgroup_name'] = ( + vif_details['dvs_port_group_name']) booked_port_key = None if self.dvs_notifier: booked_port_key = self.dvs_notifier.bind_port_call( - context.current, + currentcopy, context.network.network_segments, context.network.current, context.host @@ -129,7 +137,8 @@ class APICMechanismGBPDriver(api.MechanismDriver): if booked_port_key: vif_details['dvs_port_key'] = booked_port_key context.set_binding(segment[api.ID], - VIF_TYPE_DVS, vif_details) + VIF_TYPE_DVS, vif_details, + n_constants.PORT_STATUS_ACTIVE) return True else: return False