NSX|V3: ensure that a readable name is set for LB resources on NSX
Make sure that a name is set with the UUID. If a resource does not have a name then we will use a default name type for the resource. Change-Id: If6c4ae03368c5e486bce8ee1e6184695729dec20
This commit is contained in:
parent
b8a0c73b95
commit
64d13df69f
@ -66,7 +66,7 @@ class EdgeHealthMonitorManager(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
pool_id = hm.pool.id
|
||||
pool_client = self.core_plugin.nsxlib.load_balancer.pool
|
||||
monitor_client = self.core_plugin.nsxlib.load_balancer.monitor
|
||||
monitor_name = utils.get_name_and_uuid(hm.name, hm.id)
|
||||
monitor_name = utils.get_name_and_uuid(hm.name or 'monitor', hm.id)
|
||||
tags = lb_utils.get_tags(self.core_plugin, hm.id, lb_const.LB_HM_TYPE,
|
||||
hm.tenant_id, context.project_name)
|
||||
monitor_body = self._build_monitor_args(hm)
|
||||
|
@ -31,19 +31,6 @@ def get_tags(plugin, resource_id, resource_type, project_id, project_name):
|
||||
return tags
|
||||
|
||||
|
||||
def get_nsx_resource_binding(client, name, id):
|
||||
"""
|
||||
:param client: nsx resource client
|
||||
:param name: name of neutron object
|
||||
:param id: id of neutron object
|
||||
:return: return the nsx resource id
|
||||
"""
|
||||
nsx_name = utils.get_name_and_uuid(name, id)
|
||||
nsx_resource = client.find_by_display_name(nsx_name)
|
||||
if nsx_resource:
|
||||
return nsx_resource[0]['id']
|
||||
|
||||
|
||||
def get_network_from_subnet(context, plugin, subnet_id):
|
||||
subnet = plugin.get_subnet(context, subnet_id)
|
||||
if subnet:
|
||||
@ -62,7 +49,7 @@ def get_router_from_network(context, plugin, subnet_id):
|
||||
|
||||
def get_lb_router_id(context, plugin, lb):
|
||||
router_client = plugin.nsxlib.logical_router
|
||||
name = utils.get_name_and_uuid(lb.name, lb.id)
|
||||
name = utils.get_name_and_uuid(lb.name or 'router', lb.id)
|
||||
tags = get_tags(plugin, lb.id, lb_const.LB_LB_TYPE, lb.tenant_id,
|
||||
context.project_name)
|
||||
edge_cluster_uuid = plugin._get_edge_cluster(plugin._default_tier0_router)
|
||||
|
@ -83,7 +83,8 @@ class EdgeListenerManager(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
app_client = load_balancer.application_profile
|
||||
vs_client = load_balancer.virtual_server
|
||||
service_client = load_balancer.service
|
||||
vs_name = utils.get_name_and_uuid(listener.name, listener.id)
|
||||
vs_name = utils.get_name_and_uuid(listener.name or 'listener',
|
||||
listener.id)
|
||||
tags = lb_utils.get_tags(self.core_plugin, listener.id,
|
||||
lb_const.LB_LISTENER_TYPE,
|
||||
listener.tenant_id,
|
||||
|
@ -57,7 +57,7 @@ class EdgeMemberManager(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
'external gateway') % {'router': router['id']})
|
||||
raise n_exc.BadRequest(resource='lbaas-lbservice-create',
|
||||
msg=msg)
|
||||
lb_name = utils.get_name_and_uuid(router['name'],
|
||||
lb_name = utils.get_name_and_uuid(router['name'] or 'router',
|
||||
router_id)
|
||||
tags = lb_utils.get_tags(self.core_plugin, router_id,
|
||||
lb_const.LR_ROUTER_TYPE,
|
||||
|
@ -40,7 +40,7 @@ class EdgePoolManager(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
lb_id = pool.loadbalancer_id
|
||||
pool_client = self.core_plugin.nsxlib.load_balancer.pool
|
||||
vs_client = self.core_plugin.nsxlib.load_balancer.virtual_server
|
||||
pool_name = utils.get_name_and_uuid(pool.name, pool.id)
|
||||
pool_name = utils.get_name_and_uuid(pool.name or 'pool', pool.id)
|
||||
tags = lb_utils.get_tags(self.core_plugin, pool.id,
|
||||
lb_const.LB_POOL_TYPE, pool.tenant_id,
|
||||
context.project_name)
|
||||
|
Loading…
Reference in New Issue
Block a user