NSXP: Fix LB service tags on public subnet

While creating a LB service on a LB service, the router id is not
available and should be set while setting connectivity during member
creation.

Change-Id: I7667311e4d4721bc8b19697c3dbf2e9fc31214d7
This commit is contained in:
Kobi Samoray 2019-04-17 13:15:41 +03:00
parent e435a2cea6
commit ac2ad801fc
2 changed files with 11 additions and 3 deletions

View File

@ -73,7 +73,8 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.NsxpLoadbalancerBaseManager):
lb_name = utils.get_name_and_uuid(lb['name'] or 'lb',
lb_id)
tags = lb_utils.get_tags(self.core_plugin, router_id,
tags = lb_utils.get_tags(self.core_plugin,
router_id if router_id else '',
lb_const.LR_ROUTER_TYPE,
lb['tenant_id'], context.project_name)
@ -92,8 +93,9 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.NsxpLoadbalancerBaseManager):
tags=tags, size=lb_size, connectivity_path=connectivity_path)
# Add rule to advertise external vips
p_utils.update_router_lb_vip_advertisement(
context, self.core_plugin, router_id)
if router_id:
p_utils.update_router_lb_vip_advertisement(
context, self.core_plugin, router_id)
except Exception as e:
with excutils.save_and_reraise_exception():
completor(success=False)

View File

@ -20,6 +20,7 @@ from oslo_utils import excutils
from vmware_nsx._i18n import _
from vmware_nsx.services.lbaas import base_mgr
from vmware_nsx.services.lbaas import lb_const
from vmware_nsx.services.lbaas.nsx_p.implementation import lb_utils as p_utils
from vmware_nsx.services.lbaas.nsx_v3.implementation import lb_utils
@ -68,8 +69,13 @@ class EdgeMemberManagerFromDict(base_mgr.NsxpLoadbalancerBaseManager):
connectivity_path = self.core_plugin.nsxpolicy.tier1.get_path(
router_id)
tags = lb_utils.get_tags(self.core_plugin,
router_id,
lb_const.LR_ROUTER_TYPE,
lb['tenant_id'], context.project_name)
try:
service_client.update(lb['id'],
tags=tags,
connectivity_path=connectivity_path)
p_utils.update_router_lb_vip_advertisement(
context, self.core_plugin, router_id)