Merge "Octavia driver: various fixes"

This commit is contained in:
Zuul 2019-02-13 06:27:09 +00:00 committed by Gerrit Code Review
commit 90dda43b04
6 changed files with 24 additions and 17 deletions

View File

@ -134,6 +134,7 @@ Add octavia repo as an external repository and configure following flags in ``lo
[[local|localrc]]
OCTAVIA_NODE=api
DISABLE_AMP_IMAGE_BUILD=True
LIBS_FROM_GIT=python-openstackclient,python-octaviaclient
enable_plugin octavia https://git.openstack.org/openstack/octavia.git
enable_plugin octavia-dashboard https://git.openstack.org/openstack/octavia-dashboard
enable_service octavia
@ -258,6 +259,7 @@ Add octavia repo as an external repository and configure following flags in ``lo
[[local|localrc]]
OCTAVIA_NODE=api
DISABLE_AMP_IMAGE_BUILD=True
LIBS_FROM_GIT=python-openstackclient,python-octaviaclient
enable_plugin octavia https://git.openstack.org/openstack/octavia.git
enable_plugin octavia-dashboard https://git.openstack.org/openstack/octavia-dashboard
enable_service octavia

View File

@ -287,7 +287,6 @@ class EdgeListenerManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
completor(success=True)
@log_helpers.log_method_call
def stats_getter(context, core_plugin, ignore_list=None):
"""Update Octavia statistics for each listener (virtual server)"""
stat_list = []
@ -300,8 +299,6 @@ def stats_getter(context, core_plugin, ignore_list=None):
continue
lb_service_id = lb_binding.get('lb_service_id')
LOG.debug("Getting listeners statistics for NSX lb service %s",
lb_service_id)
try:
# get the NSX statistics for this LB service
rsp = lb_service_client.get_stats(lb_service_id)

View File

@ -38,6 +38,7 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
lb['vip_subnet_id']):
completor(success=True)
else:
completor(success=False)
msg = (_('Cannot create lb on subnet %(sub)s for '
'loadbalancer %(lb)s. The subnet needs to connect a '
'router which is already set gateway.') %

View File

@ -173,17 +173,18 @@ class EdgeMemberManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
lb_service = self._create_lb_service(
context, service_client, member['tenant_id'],
router_id, nsx_router_id, loadbalancer['id'], lb_size)
if lb_service:
lb_service_id = lb_service['id']
self._add_loadbalancer_binding(
context, loadbalancer['id'], lb_service_id,
nsx_router_id, loadbalancer['vip_address'])
else:
completor(success=False)
msg = (_('Failed to get lb service to attach virtual '
'server %(vs)s for member %(member)s') %
{'vs': vs_id, 'member': member['id']})
raise nsx_exc.NsxPluginException(err_msg=msg)
if not lb_service:
completor(success=False)
msg = (_('Failed to create lb service to attach '
'virtual server %(vs)s for member '
'%(member)s') %
{'vs': vs_id, 'member': member['id']})
raise nsx_exc.NsxPluginException(err_msg=msg)
lb_service_id = lb_service['id']
self._add_loadbalancer_binding(
context, loadbalancer['id'], lb_service_id,
nsx_router_id, loadbalancer['vip_address'])
with locking.LockManager.get_lock('pool-member-%s' % lb_pool_id):
lb_pool = pool_client.get(lb_pool_id)

View File

@ -45,7 +45,7 @@ unsupported_keys = {'Loadbalancer': ['vip_qos_policy_id'],
'timeout_member_connect',
'timeout_member_data',
'timeout_tcp_inspect'],
'HealthMonitor': ['expected_codes', 'max_retries_down'],
'HealthMonitor': ['max_retries_down'],
'Member': ['monitor_address', 'monitor_port', 'backup']}
@ -155,6 +155,12 @@ class NSXOctaviaDriver(driver_base.ProviderDriver):
recurse=False, render_unsets=True)
listener_dict['id'] = listener_dict['listener_id']
listener_dict['l7_policies'] = listener_dict['l7policies']
# Add the loadbalancer to the listener dict
if pool_dict.get('loadbalancer_id'):
# Generate a loadbalancer object
listener_dict['loadbalancer'] = (
self._get_load_balancer_dict(
pool_dict['loadbalancer_id']))
pool_dict['listener'] = listener_dict
if 'listeners' not in pool_dict:
# multiple listeners is not really supported yet

View File

@ -152,6 +152,8 @@ class NSXOctaviaListenerEndpoint(object):
constants.PROVISIONING_STATUS: parent_prov_status,
constants.OPERATING_STATUS: op_status}]
LOG.debug("Octavia transaction completed with statuses %s",
status_dict)
kw = {'status': status_dict}
self.client.cast({}, 'update_loadbalancer_status', **kw)
@ -333,7 +335,6 @@ class NSXOctaviaStatisticsCollector(object):
eventlet.spawn_n(self.thread_runner,
cfg.CONF.octavia_stats_interval)
@log_helpers.log_method_call
def thread_runner(self, interval):
while True:
time.sleep(interval)
@ -353,7 +354,6 @@ class NSXOctaviaStatisticsCollector(object):
nl_loadbalancers = context.session.query(models.LoadBalancer).all()
return [lb.id for lb in nl_loadbalancers]
@log_helpers.log_method_call
def collect(self):
if not self.core_plugin.octavia_listener:
return