Browse Source

Merge "Octavia driver bug fixes" into stable/train

changes/22/758522/2
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
b34d844b04
2 changed files with 39 additions and 2 deletions
  1. +8
    -0
      vmware_nsx/services/lbaas/octavia/octavia_driver.py
  2. +31
    -2
      vmware_nsx/services/lbaas/octavia/octavia_listener.py

+ 8
- 0
vmware_nsx/services/lbaas/octavia/octavia_driver.py View File

@ -190,6 +190,8 @@ class NSXOctaviaDriver(driver_base.ProviderDriver):
if project_id is None:
project_id = parent_project_id
pool_dict['tenant_id'] = pool_dict['project_id'] = project_id
for member in pool_dict.get('members', []):
member['id'] = member['member_id']
return pool_dict
@ -303,9 +305,15 @@ class NSXOctaviaDriver(driver_base.ProviderDriver):
elif obj_type == 'Pool':
if 'listener' not in obj_dict:
self._get_listener_in_pool_dict(obj_dict, is_update)
if obj_dict.get('loadbalancer_id'):
# Generate a loadbalancer object
obj_dict['loadbalancer'] = self._get_load_balancer_dict(
obj_dict['loadbalancer_id'])
if obj_dict.get('healthmonitor'):
obj_dict['healthmonitor']['id'] = obj_dict[
'healthmonitor']['healthmonitor_id']
for member in obj_dict.get('members', []):
member['id'] = member['member_id']
elif obj_type == 'Member':
# Get the pool object


+ 31
- 2
vmware_nsx/services/lbaas/octavia/octavia_listener.py View File

@ -350,6 +350,7 @@ class NSXOctaviaListenerEndpoint(object):
member['pool'] = pool
self.member.delete_cascade(ctx, member, dummy_completor)
if pool.get('healthmonitor'):
pool['healthmonitor']['pool'] = pool
self.healthmonitor.delete_cascade(
ctx, pool['healthmonitor'], dummy_completor)
self.pool.delete_cascade(ctx, pool, dummy_completor)
@ -461,16 +462,44 @@ class NSXOctaviaListenerEndpoint(object):
@log_helpers.log_method_call
def pool_delete(self, ctxt, pool):
delete_result = {'value': True}
def dummy_completor(success=True):
delete_result['value'] = success
ctx = neutron_context.Context(None, pool['project_id'])
# Octavia removes pool HMs while pool is deleted
if pool.get('healthmonitor'):
pool['healthmonitor']['pool'] = pool
try:
self.healthmonitor.delete_cascade(
ctx, pool['healthmonitor'], dummy_completor)
except Exception as e:
delete_result['value'] = False
LOG.error('NSX driver pool_delete failed to delete HM %s', e)
for member in pool.get('members', []):
try:
if not member.get('pool'):
member['pool'] = pool
self.member.delete_cascade(ctx, member, dummy_completor)
except Exception as e:
delete_result['value'] = False
LOG.error('NSX driver pool_delete failed to delete member'
' %s %s', member['id'], e)
completor = self.get_completor_func(constants.POOLS,
pool, delete=True)
try:
self.pool.delete(ctx, pool, completor)
except Exception as e:
LOG.error('NSX driver pool_delete failed %s', e)
delete_result['value'] = False
if not delete_result['value']:
completor(success=False)
return False
return True
return delete_result['value']
@log_helpers.log_method_call
def pool_update(self, ctxt, old_pool, new_pool):


Loading…
Cancel
Save