"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "octavia/api/drivers/amphora_driver/v1/driver.py" between
octavia-7.1.1.tar.gz and octavia-8.0.0.tar.gz

About: OpenStack Octavia is an operator-grade reference implementation for Load Balancing as a Service (LBaaS).
The "Wallaby" series (latest release).

driver.py  (octavia-7.1.1):driver.py  (octavia-8.0.0)
skipping to change at line 55 skipping to change at line 55
consts.LB_ALGORITHM_LEAST_CONNECTIONS] consts.LB_ALGORITHM_LEAST_CONNECTIONS]
AMPHORA_SUPPORTED_PROTOCOLS = [ AMPHORA_SUPPORTED_PROTOCOLS = [
lib_consts.PROTOCOL_TCP, lib_consts.PROTOCOL_TCP,
lib_consts.PROTOCOL_HTTP, lib_consts.PROTOCOL_HTTP,
lib_consts.PROTOCOL_HTTPS, lib_consts.PROTOCOL_HTTPS,
lib_consts.PROTOCOL_TERMINATED_HTTPS, lib_consts.PROTOCOL_TERMINATED_HTTPS,
lib_consts.PROTOCOL_PROXY, lib_consts.PROTOCOL_PROXY,
lib_consts.PROTOCOL_PROXYV2, lib_consts.PROTOCOL_PROXYV2,
lib_consts.PROTOCOL_UDP, lib_consts.PROTOCOL_UDP,
lib_consts.PROTOCOL_SCTP,
] ]
class AmphoraProviderDriver(driver_base.ProviderDriver): class AmphoraProviderDriver(driver_base.ProviderDriver):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
topic = cfg.CONF.oslo_messaging.topic topic = cfg.CONF.oslo_messaging.topic
self.target = messaging.Target( self.target = messaging.Target(
namespace=consts.RPC_NAMESPACE_CONTROLLER_AGENT, namespace=consts.RPC_NAMESPACE_CONTROLLER_AGENT,
topic=topic, version="1.0", fanout=False) topic=topic, version="1.0", fanout=False)
self.client = rpc.get_client(self.target) self.client = rpc.get_client(self.target)
skipping to change at line 85 skipping to change at line 86
def _validate_listener_protocol(self, listener): def _validate_listener_protocol(self, listener):
if listener.protocol not in AMPHORA_SUPPORTED_PROTOCOLS: if listener.protocol not in AMPHORA_SUPPORTED_PROTOCOLS:
msg = ('Amphora provider does not support %s protocol. ' msg = ('Amphora provider does not support %s protocol. '
'Supported: %s' 'Supported: %s'
% (listener.protocol, % (listener.protocol,
", ".join(AMPHORA_SUPPORTED_PROTOCOLS))) ", ".join(AMPHORA_SUPPORTED_PROTOCOLS)))
raise exceptions.UnsupportedOptionError( raise exceptions.UnsupportedOptionError(
user_fault_string=msg, user_fault_string=msg,
operator_fault_string=msg) operator_fault_string=msg)
def _validate_alpn_protocols(self, listener): def _validate_alpn_protocols(self, obj):
if not listener.alpn_protocols: if not obj.alpn_protocols:
return return
supported = consts.AMPHORA_SUPPORTED_ALPN_PROTOCOLS supported = consts.AMPHORA_SUPPORTED_ALPN_PROTOCOLS
not_supported = set(listener.alpn_protocols) - set(supported) not_supported = set(obj.alpn_protocols) - set(supported)
if not_supported: if not_supported:
msg = ('Amphora provider does not support %s ALPN protocol(s). ' msg = ('Amphora provider does not support %s ALPN protocol(s). '
'Supported: %s' 'Supported: %s'
% (", ".join(not_supported), ", ".join(supported))) % (", ".join(not_supported), ", ".join(supported)))
raise exceptions.UnsupportedOptionError( raise exceptions.UnsupportedOptionError(
user_fault_string=msg, user_fault_string=msg,
operator_fault_string=msg) operator_fault_string=msg)
# Load Balancer # Load Balancer
def create_vip_port(self, loadbalancer_id, project_id, vip_dictionary): def create_vip_port(self, loadbalancer_id, project_id, vip_dictionary):
skipping to change at line 198 skipping to change at line 199
'client_crl_container_ref') 'client_crl_container_ref')
listener_dict.pop('client_crl_container_data', None) listener_dict.pop('client_crl_container_data', None)
payload = {consts.LISTENER_ID: listener_id, payload = {consts.LISTENER_ID: listener_id,
consts.LISTENER_UPDATES: listener_dict} consts.LISTENER_UPDATES: listener_dict}
self.client.cast({}, 'update_listener', **payload) self.client.cast({}, 'update_listener', **payload)
# Pool # Pool
def pool_create(self, pool): def pool_create(self, pool):
self._validate_pool_algorithm(pool) self._validate_pool_algorithm(pool)
self._validate_alpn_protocols(pool)
payload = {consts.POOL_ID: pool.pool_id} payload = {consts.POOL_ID: pool.pool_id}
self.client.cast({}, 'create_pool', **payload) self.client.cast({}, 'create_pool', **payload)
def pool_delete(self, pool): def pool_delete(self, pool):
pool_id = pool.pool_id pool_id = pool.pool_id
payload = {consts.POOL_ID: pool_id} payload = {consts.POOL_ID: pool_id}
self.client.cast({}, 'delete_pool', **payload) self.client.cast({}, 'delete_pool', **payload)
def pool_update(self, old_pool, new_pool): def pool_update(self, old_pool, new_pool):
self._validate_alpn_protocols(new_pool)
if new_pool.lb_algorithm: if new_pool.lb_algorithm:
self._validate_pool_algorithm(new_pool) self._validate_pool_algorithm(new_pool)
pool_dict = new_pool.to_dict() pool_dict = new_pool.to_dict()
if 'admin_state_up' in pool_dict: if 'admin_state_up' in pool_dict:
pool_dict['enabled'] = pool_dict.pop('admin_state_up') pool_dict['enabled'] = pool_dict.pop('admin_state_up')
pool_id = pool_dict.pop('pool_id') pool_id = pool_dict.pop('pool_id')
if 'tls_container_ref' in pool_dict: if 'tls_container_ref' in pool_dict:
pool_dict['tls_certificate_id'] = pool_dict.pop( pool_dict['tls_certificate_id'] = pool_dict.pop(
'tls_container_ref') 'tls_container_ref')
pool_dict.pop('tls_container_data', None) pool_dict.pop('tls_container_data', None)
skipping to change at line 287 skipping to change at line 290
if 'admin_state_up' in member_dict: if 'admin_state_up' in member_dict:
member_dict['enabled'] = member_dict.pop('admin_state_up') member_dict['enabled'] = member_dict.pop('admin_state_up')
updated_members.append(member_dict) updated_members.append(member_dict)
# Find members that are deleted # Find members that are deleted
deleted_members = [] deleted_members = []
for m in old_members: for m in old_members:
if m.id not in new_member_ids: if m.id not in new_member_ids:
deleted_members.append(m) deleted_members.append(m)
if deleted_members or new_members or updated_members: payload = {'old_member_ids': [m.id for m in deleted_members],
payload = {'old_member_ids': [m.id for m in deleted_members], 'new_member_ids': [m.member_id for m in new_members],
'new_member_ids': [m.member_id for m in new_members], 'updated_members': updated_members}
'updated_members': updated_members} self.client.cast({}, 'batch_update_members', **payload)
self.client.cast({}, 'batch_update_members', **payload)
else:
LOG.info("Member batch update is a noop, returning early.")
def _validate_members(self, db_pool, members): def _validate_members(self, db_pool, members):
if db_pool.protocol == consts.PROTOCOL_UDP: if db_pool.protocol in consts.LVS_PROTOCOLS:
# For UDP LBs, check that we are not mixing IPv4 and IPv6 # For SCTP/UDP LBs, check that we are not mixing IPv4 and IPv6
for member in members: for member in members:
member_is_ipv6 = utils.is_ipv6(member.address) member_is_ipv6 = utils.is_ipv6(member.address)
for listener in db_pool.listeners: for listener in db_pool.listeners:
lb = listener.load_balancer lb = listener.load_balancer
vip_is_ipv6 = utils.is_ipv6(lb.vip.ip_address) vip_is_ipv6 = utils.is_ipv6(lb.vip.ip_address)
if member_is_ipv6 != vip_is_ipv6: if member_is_ipv6 != vip_is_ipv6:
msg = ("This provider doesn't support mixing IPv4 and " msg = ("This provider doesn't support mixing IPv4 and "
"IPv6 addresses for its VIP and members in UDP " "IPv6 addresses for its VIP and members in {} "
"load balancers.") "load balancers.".format(db_pool.protocol))
raise exceptions.UnsupportedOptionError( raise exceptions.UnsupportedOptionError(
user_fault_string=msg, user_fault_string=msg,
operator_fault_string=msg) operator_fault_string=msg)
# Health Monitor # Health Monitor
def health_monitor_create(self, healthmonitor): def health_monitor_create(self, healthmonitor):
payload = {consts.HEALTH_MONITOR_ID: healthmonitor.healthmonitor_id} payload = {consts.HEALTH_MONITOR_ID: healthmonitor.healthmonitor_id}
self.client.cast({}, 'create_health_monitor', **payload) self.client.cast({}, 'create_health_monitor', **payload)
def health_monitor_delete(self, healthmonitor): def health_monitor_delete(self, healthmonitor):
 End of changes. 8 change blocks. 
14 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)