From 00ef2c98ded3986d686fef6775b13738712a3b1e Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Wed, 19 Jul 2017 15:00:31 -0700 Subject: [PATCH] [VMware] Adjust to enforcement point API change Enforcement point was modified to hold single connection. In addition, to avoid requirements conflict, modify devstack scripts to work against stable/ocata branch of vmware-nsxlib. Change-Id: I4b889851d1aa0e142e5b95a696ccaa60fa4a8448 --- devstack/lib/nsx | 3 +-- .../drivers/vmware/nsx_policy/nsx_policy_mapping.py | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/devstack/lib/nsx b/devstack/lib/nsx index 46eee076c..166dbde2a 100644 --- a/devstack/lib/nsx +++ b/devstack/lib/nsx @@ -1,12 +1,11 @@ # TODO(annak): This is a temporary solution # nsxlib, which wraps policy API, is under development # since policy API is yet to be finalized -# we prefer to run against master branch at this point function prepare_nsx_policy { NSXLIB_NAME='vmware-nsxlib' GITDIR[$NSXLIB_NAME]=/opt/stack/vmware-nsxlib GITREPO[$NSXLIB_NAME]=${NSXLIB_REPO:-${GIT_BASE}/openstack/vmware-nsxlib.git} - GITBRANCH[$NSXLIB_NAME]=${NSXLIB_BRANCH:-master} + GITBRANCH[$NSXLIB_NAME]=${NSXLIB_BRANCH:-stable/ocata} if use_library_from_git $NSXLIB_NAME; then git_clone_by_name $NSXLIB_NAME diff --git a/gbpservice/neutron/services/grouppolicy/drivers/vmware/nsx_policy/nsx_policy_mapping.py b/gbpservice/neutron/services/grouppolicy/drivers/vmware/nsx_policy/nsx_policy_mapping.py index dcef163c7..d1c1d5ee8 100644 --- a/gbpservice/neutron/services/grouppolicy/drivers/vmware/nsx_policy/nsx_policy_mapping.py +++ b/gbpservice/neutron/services/grouppolicy/drivers/vmware/nsx_policy/nsx_policy_mapping.py @@ -129,11 +129,11 @@ class NsxPolicyMappingDriver(api.ResourceMappingDriver): nsx_manager_thumbprint = cfg.CONF.NSX_POLICY.nsx_manager_thumbprint epoints = self.nsx_policy.enforcement_point.list() for ep in epoints: - for conn in ep['connection_info']: - if conn['enforcement_point_address'] == nsx_manager_ip: - LOG.debug('Enforcement point for %s already exists (%s)', - nsx_manager_ip, ep['id']) - return + conn = ep['connection_info'] + if conn and conn['enforcement_point_address'] == nsx_manager_ip: + LOG.debug('Enforcement point for %s already exists (%s)', + nsx_manager_ip, ep['id']) + return LOG.info('Creating enforcement point for %s', nsx_manager_ip) self.nsx_policy.enforcement_point.create_or_overwrite(