Set listeners back to ACTIVE upon pool/member action failures
This patch ensure the listeners are set back from PENDING_UPDATE to ACTIVE in case of member or pool update failure. Closes-Bug: #1956745 Change-Id: I95860ae305c3d0c10859afb972d000328e23d614
This commit is contained in:
parent
1ddaef119b
commit
4d01470f5e
|
@ -1356,7 +1356,9 @@ class OvnProviderHelper():
|
||||||
pool_key = self._get_pool_key(pool[constants.ID])
|
pool_key = self._get_pool_key(pool[constants.ID])
|
||||||
commands = []
|
commands = []
|
||||||
external_ids = copy.deepcopy(ovn_lb.external_ids)
|
external_ids = copy.deepcopy(ovn_lb.external_ids)
|
||||||
|
pool_listeners = []
|
||||||
try:
|
try:
|
||||||
|
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
||||||
if pool_key in ovn_lb.external_ids:
|
if pool_key in ovn_lb.external_ids:
|
||||||
commands.append(
|
commands.append(
|
||||||
self.ovn_nbdb_api.db_remove('Load_Balancer', ovn_lb.uuid,
|
self.ovn_nbdb_api.db_remove('Load_Balancer', ovn_lb.uuid,
|
||||||
|
@ -1365,7 +1367,6 @@ class OvnProviderHelper():
|
||||||
commands.extend(
|
commands.extend(
|
||||||
self._refresh_lb_vips(ovn_lb.uuid, external_ids))
|
self._refresh_lb_vips(ovn_lb.uuid, external_ids))
|
||||||
# Remove Pool from Listener if it is associated
|
# Remove Pool from Listener if it is associated
|
||||||
listener_id = None
|
|
||||||
for key, value in ovn_lb.external_ids.items():
|
for key, value in ovn_lb.external_ids.items():
|
||||||
if (key.startswith(ovn_const.LB_EXT_IDS_LISTENER_PREFIX) and
|
if (key.startswith(ovn_const.LB_EXT_IDS_LISTENER_PREFIX) and
|
||||||
pool_key in value):
|
pool_key in value):
|
||||||
|
@ -1374,7 +1375,6 @@ class OvnProviderHelper():
|
||||||
self.ovn_nbdb_api.db_set(
|
self.ovn_nbdb_api.db_set(
|
||||||
'Load_Balancer', ovn_lb.uuid,
|
'Load_Balancer', ovn_lb.uuid,
|
||||||
('external_ids', external_ids)))
|
('external_ids', external_ids)))
|
||||||
listener_id = key.split('_')[1]
|
|
||||||
|
|
||||||
pool_key_when_disabled = self._get_pool_key(pool[constants.ID],
|
pool_key_when_disabled = self._get_pool_key(pool[constants.ID],
|
||||||
is_enabled=False)
|
is_enabled=False)
|
||||||
|
@ -1389,10 +1389,6 @@ class OvnProviderHelper():
|
||||||
ovn_lb, pool[constants.LOADBALANCER_ID], external_ids)[0])
|
ovn_lb, pool[constants.LOADBALANCER_ID], external_ids)[0])
|
||||||
self._execute_commands(commands)
|
self._execute_commands(commands)
|
||||||
|
|
||||||
if listener_id:
|
|
||||||
status[constants.LISTENERS] = [
|
|
||||||
{constants.ID: listener_id,
|
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(ovn_const.EXCEPTION_MSG, "deletion of pool")
|
LOG.exception(ovn_const.EXCEPTION_MSG, "deletion of pool")
|
||||||
status = {
|
status = {
|
||||||
|
@ -1403,6 +1399,13 @@ class OvnProviderHelper():
|
||||||
{constants.ID: pool[constants.LOADBALANCER_ID],
|
{constants.ID: pool[constants.LOADBALANCER_ID],
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
|
|
||||||
|
listener_status = []
|
||||||
|
for listener in pool_listeners:
|
||||||
|
listener_status.append(
|
||||||
|
{constants.ID: listener,
|
||||||
|
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
||||||
|
status[constants.LISTENERS] = listener_status
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def pool_update(self, pool):
|
def pool_update(self, pool):
|
||||||
|
@ -1433,7 +1436,10 @@ class OvnProviderHelper():
|
||||||
p_key_to_remove = None
|
p_key_to_remove = None
|
||||||
p_key_to_add = {}
|
p_key_to_add = {}
|
||||||
|
|
||||||
|
pool_listeners = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
||||||
if pool[constants.ADMIN_STATE_UP]:
|
if pool[constants.ADMIN_STATE_UP]:
|
||||||
if p_key_when_disabled in external_ids:
|
if p_key_when_disabled in external_ids:
|
||||||
p_key_to_add[pool_key] = external_ids[p_key_when_disabled]
|
p_key_to_add[pool_key] = external_ids[p_key_when_disabled]
|
||||||
|
@ -1468,13 +1474,6 @@ class OvnProviderHelper():
|
||||||
operating_status = constants.OFFLINE
|
operating_status = constants.OFFLINE
|
||||||
pool_status[constants.OPERATING_STATUS] = operating_status
|
pool_status[constants.OPERATING_STATUS] = operating_status
|
||||||
|
|
||||||
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
|
||||||
listener_status = []
|
|
||||||
for listener in pool_listeners:
|
|
||||||
listener_status.append(
|
|
||||||
{constants.ID: listener,
|
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
|
||||||
status[constants.LISTENERS] = listener_status
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(ovn_const.EXCEPTION_MSG, "update of pool")
|
LOG.exception(ovn_const.EXCEPTION_MSG, "update of pool")
|
||||||
status = {
|
status = {
|
||||||
|
@ -1485,6 +1484,13 @@ class OvnProviderHelper():
|
||||||
{constants.ID: pool[constants.LOADBALANCER_ID],
|
{constants.ID: pool[constants.LOADBALANCER_ID],
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
|
|
||||||
|
listener_status = []
|
||||||
|
for listener in pool_listeners:
|
||||||
|
listener_status.append(
|
||||||
|
{constants.ID: listener,
|
||||||
|
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
||||||
|
status[constants.LISTENERS] = listener_status
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def _add_member(self, member, ovn_lb, pool_key):
|
def _add_member(self, member, ovn_lb, pool_key):
|
||||||
|
@ -1540,9 +1546,11 @@ class OvnProviderHelper():
|
||||||
|
|
||||||
def member_create(self, member):
|
def member_create(self, member):
|
||||||
new_member = None
|
new_member = None
|
||||||
|
pool_listeners = []
|
||||||
try:
|
try:
|
||||||
pool_key, ovn_lb = self._find_ovn_lb_by_pool_id(
|
pool_key, ovn_lb = self._find_ovn_lb_by_pool_id(
|
||||||
member[constants.POOL_ID])
|
member[constants.POOL_ID])
|
||||||
|
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
||||||
new_member = self._add_member(member, ovn_lb, pool_key)
|
new_member = self._add_member(member, ovn_lb, pool_key)
|
||||||
pool = {constants.ID: member[constants.POOL_ID],
|
pool = {constants.ID: member[constants.POOL_ID],
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE,
|
constants.PROVISIONING_STATUS: constants.ACTIVE,
|
||||||
|
@ -1557,13 +1565,6 @@ class OvnProviderHelper():
|
||||||
constants.LOADBALANCERS: [
|
constants.LOADBALANCERS: [
|
||||||
{constants.ID: ovn_lb.name,
|
{constants.ID: ovn_lb.name,
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
|
||||||
listener_status = []
|
|
||||||
for listener in pool_listeners:
|
|
||||||
listener_status.append(
|
|
||||||
{constants.ID: listener,
|
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
|
||||||
status[constants.LISTENERS] = listener_status
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(ovn_const.EXCEPTION_MSG, "creation of member")
|
LOG.exception(ovn_const.EXCEPTION_MSG, "creation of member")
|
||||||
status = {
|
status = {
|
||||||
|
@ -1577,6 +1578,13 @@ class OvnProviderHelper():
|
||||||
{constants.ID: ovn_lb.name,
|
{constants.ID: ovn_lb.name,
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
|
|
||||||
|
listener_status = []
|
||||||
|
for listener in pool_listeners:
|
||||||
|
listener_status.append(
|
||||||
|
{constants.ID: listener,
|
||||||
|
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
||||||
|
status[constants.LISTENERS] = listener_status
|
||||||
|
|
||||||
if new_member and ovn_lb.health_check:
|
if new_member and ovn_lb.health_check:
|
||||||
operating_status = constants.ONLINE
|
operating_status = constants.ONLINE
|
||||||
if not self._update_hm_members(ovn_lb, pool_key):
|
if not self._update_hm_members(ovn_lb, pool_key):
|
||||||
|
@ -1616,9 +1624,11 @@ class OvnProviderHelper():
|
||||||
operator_fault_string=msg)
|
operator_fault_string=msg)
|
||||||
|
|
||||||
def member_delete(self, member):
|
def member_delete(self, member):
|
||||||
|
pool_listeners = []
|
||||||
try:
|
try:
|
||||||
pool_key, ovn_lb = self._find_ovn_lb_by_pool_id(
|
pool_key, ovn_lb = self._find_ovn_lb_by_pool_id(
|
||||||
member[constants.POOL_ID])
|
member[constants.POOL_ID])
|
||||||
|
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
||||||
pool_status = self._remove_member(member, ovn_lb, pool_key)
|
pool_status = self._remove_member(member, ovn_lb, pool_key)
|
||||||
pool = {constants.ID: member[constants.POOL_ID],
|
pool = {constants.ID: member[constants.POOL_ID],
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE,
|
constants.PROVISIONING_STATUS: constants.ACTIVE,
|
||||||
|
@ -1633,13 +1643,6 @@ class OvnProviderHelper():
|
||||||
constants.LOADBALANCERS: [
|
constants.LOADBALANCERS: [
|
||||||
{constants.ID: ovn_lb.name,
|
{constants.ID: ovn_lb.name,
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
|
||||||
listener_status = []
|
|
||||||
for listener in pool_listeners:
|
|
||||||
listener_status.append(
|
|
||||||
{constants.ID: listener,
|
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
|
||||||
status[constants.LISTENERS] = listener_status
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(ovn_const.EXCEPTION_MSG, "deletion of member")
|
LOG.exception(ovn_const.EXCEPTION_MSG, "deletion of member")
|
||||||
status = {
|
status = {
|
||||||
|
@ -1653,6 +1656,13 @@ class OvnProviderHelper():
|
||||||
{constants.ID: ovn_lb.name,
|
{constants.ID: ovn_lb.name,
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
|
|
||||||
|
listener_status = []
|
||||||
|
for listener in pool_listeners:
|
||||||
|
listener_status.append(
|
||||||
|
{constants.ID: listener,
|
||||||
|
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
||||||
|
status[constants.LISTENERS] = listener_status
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def _update_member(self, member, ovn_lb, pool_key):
|
def _update_member(self, member, ovn_lb, pool_key):
|
||||||
|
@ -1675,6 +1685,7 @@ class OvnProviderHelper():
|
||||||
self._execute_commands(commands)
|
self._execute_commands(commands)
|
||||||
|
|
||||||
def member_update(self, member):
|
def member_update(self, member):
|
||||||
|
pool_listeners = []
|
||||||
try:
|
try:
|
||||||
pool_key, ovn_lb = self._find_ovn_lb_by_pool_id(
|
pool_key, ovn_lb = self._find_ovn_lb_by_pool_id(
|
||||||
member[constants.POOL_ID])
|
member[constants.POOL_ID])
|
||||||
|
@ -1688,6 +1699,7 @@ class OvnProviderHelper():
|
||||||
constants.LOADBALANCERS: [
|
constants.LOADBALANCERS: [
|
||||||
{constants.ID: ovn_lb.name,
|
{constants.ID: ovn_lb.name,
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
|
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
||||||
self._update_member(member, ovn_lb, pool_key)
|
self._update_member(member, ovn_lb, pool_key)
|
||||||
if constants.ADMIN_STATE_UP in member:
|
if constants.ADMIN_STATE_UP in member:
|
||||||
if member[constants.ADMIN_STATE_UP]:
|
if member[constants.ADMIN_STATE_UP]:
|
||||||
|
@ -1707,14 +1719,6 @@ class OvnProviderHelper():
|
||||||
else:
|
else:
|
||||||
member_status[constants.OPERATING_STATUS] = (
|
member_status[constants.OPERATING_STATUS] = (
|
||||||
constants.OFFLINE)
|
constants.OFFLINE)
|
||||||
|
|
||||||
pool_listeners = self._get_pool_listeners(ovn_lb, pool_key)
|
|
||||||
listener_status = []
|
|
||||||
for listener in pool_listeners:
|
|
||||||
listener_status.append(
|
|
||||||
{constants.ID: listener,
|
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
|
||||||
status[constants.LISTENERS] = listener_status
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(ovn_const.EXCEPTION_MSG, "update of member")
|
LOG.exception(ovn_const.EXCEPTION_MSG, "update of member")
|
||||||
status = {
|
status = {
|
||||||
|
@ -1727,6 +1731,13 @@ class OvnProviderHelper():
|
||||||
constants.LOADBALANCERS: [
|
constants.LOADBALANCERS: [
|
||||||
{constants.ID: ovn_lb.name,
|
{constants.ID: ovn_lb.name,
|
||||||
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
constants.PROVISIONING_STATUS: constants.ACTIVE}]}
|
||||||
|
|
||||||
|
listener_status = []
|
||||||
|
for listener in pool_listeners:
|
||||||
|
listener_status.append(
|
||||||
|
{constants.ID: listener,
|
||||||
|
constants.PROVISIONING_STATUS: constants.ACTIVE})
|
||||||
|
status[constants.LISTENERS] = listener_status
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def _get_existing_pool_members(self, pool_id):
|
def _get_existing_pool_members(self, pool_id):
|
||||||
|
|
|
@ -664,7 +664,8 @@ class TestOvnOctaviaBase(base.TestOVNFunctionalBase,
|
||||||
'pools': [{'id': p.pool_id,
|
'pools': [{'id': p.pool_id,
|
||||||
'provisioning_status': 'DELETED'}],
|
'provisioning_status': 'DELETED'}],
|
||||||
'loadbalancers': [{'id': p.loadbalancer_id,
|
'loadbalancers': [{'id': p.loadbalancer_id,
|
||||||
'provisioning_status': 'ACTIVE'}]
|
'provisioning_status': 'ACTIVE'}],
|
||||||
|
'listeners': []
|
||||||
}
|
}
|
||||||
if listener_id:
|
if listener_id:
|
||||||
pool_dict['listeners'] = [{'id': listener_id,
|
pool_dict['listeners'] = [{'id': listener_id,
|
||||||
|
|
Loading…
Reference in New Issue