8bbd8f1b62
TCP and UDP Connect health monitors are now supported by the provider driver, when the underlying OVN version supports them. The health monitor uses the OVN distributed DHCP port as the source IP for messages, one must exist or the create or update operation will fail. The list of member ports to monitor is updated whenever one is created or deleted. Added support for SBDB notifications for Service Monitor events generated when the OVN health monitor code detects issues with connectivity. This will trigger updates to the Octavia objects as members go on/offline so that the Octavia API reflects the current running state of the load balancer. Added a lot of new unit and functional tests to cover all the new code, and enabled the tempest health monitor feature so those tests are run as well. Change-Id: I776a7a6b036ad72ce7eaa1ab39f448b344974be6
86 lines
3.0 KiB
Python
86 lines
3.0 KiB
Python
# Copyright 2020 Red Hat, Inc. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from oslo_log import log as logging
|
|
from ovsdbapp.backend.ovs_idl import event as row_event
|
|
|
|
# TODO(mjozefcz): Start consuming const and utils
|
|
# from neutron-lib once released.
|
|
from ovn_octavia_provider.common import constants as ovn_const
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
class LogicalRouterPortEvent(row_event.RowEvent):
|
|
|
|
def __init__(self, driver):
|
|
table = 'Logical_Router_Port'
|
|
events = (self.ROW_CREATE, self.ROW_DELETE)
|
|
super().__init__(events, table, None)
|
|
self.event_name = 'LogicalRouterPortEvent'
|
|
self.driver = driver
|
|
|
|
def run(self, event, row, old):
|
|
LOG.debug('LogicalRouterPortEvent logged, '
|
|
'%(event)s, %(row)s',
|
|
{'event': event,
|
|
'row': row})
|
|
if row.gateway_chassis:
|
|
return
|
|
if event == self.ROW_CREATE:
|
|
self.driver.lb_create_lrp_assoc_handler(row)
|
|
elif event == self.ROW_DELETE:
|
|
self.driver.lb_delete_lrp_assoc_handler(row)
|
|
|
|
|
|
class LogicalSwitchPortUpdateEvent(row_event.RowEvent):
|
|
|
|
def __init__(self, driver):
|
|
table = 'Logical_Switch_Port'
|
|
events = (self.ROW_UPDATE,)
|
|
super().__init__(events, table, None)
|
|
self.event_name = 'LogicalSwitchPortUpdateEvent'
|
|
self.driver = driver
|
|
|
|
def run(self, event, row, old):
|
|
LOG.debug('LogicalSwitchPortUpdateEvent logged, '
|
|
'%(event)s, %(row)s',
|
|
{'event': event,
|
|
'row': row})
|
|
# Get the neutron:port_name from external_ids and check if
|
|
# it's a vip port or not.
|
|
port_name = row.external_ids.get(
|
|
ovn_const.OVN_PORT_NAME_EXT_ID_KEY, '')
|
|
if port_name.startswith(ovn_const.LB_VIP_PORT_PREFIX):
|
|
# Handle port update only for vip ports created by
|
|
# this driver.
|
|
self.driver.vip_port_update_handler(row)
|
|
|
|
|
|
class ServiceMonitorUpdateEvent(row_event.RowEvent):
|
|
|
|
def __init__(self, driver):
|
|
table = 'Service_Monitor'
|
|
events = (self.ROW_UPDATE,)
|
|
super().__init__(events, table, None)
|
|
self.event_name = 'ServiceMonitorUpdateEvent'
|
|
self.driver = driver
|
|
|
|
def run(self, event, row, old):
|
|
LOG.debug('ServiceMonitorUpdateEvent logged, '
|
|
'%(event)s, %(row)s',
|
|
{'event': event,
|
|
'row': row})
|
|
self.driver.hm_update_event_handler(row)
|