[Amphorav2] Healthmonitor operation minor fixes

* Fix logging messages for healthmonitor operations
* Add retry when healthmonitor is not in db yet
* Fix setting ONLINE operating_status

This fix api test_healthmonitor_update test.

Change-Id: I293587fa6d1f7a06aae9d1cca5b81342478c5df2
This commit is contained in:
Ann Taraday 2020-06-30 17:05:15 +04:00
parent e2e873fc9d
commit db180bf818
3 changed files with 12 additions and 4 deletions

View File

@ -95,19 +95,19 @@ class Endpoints(object):
def create_health_monitor(self, context, health_monitor):
LOG.info('Creating health monitor \'%s\'...', health_monitor.get(
constants.ID))
constants.HEALTHMONITOR_ID))
self.worker.create_health_monitor(health_monitor)
def update_health_monitor(self, context, original_health_monitor,
health_monitor_updates):
LOG.info('Updating health monitor \'%s\'...',
original_health_monitor.get(constants.ID))
original_health_monitor.get(constants.HEALTHMONITOR_ID))
self.worker.update_health_monitor(original_health_monitor,
health_monitor_updates)
def delete_health_monitor(self, context, health_monitor):
LOG.info('Deleting health monitor \'%s\'...', health_monitor.get(
constants.ID))
constants.HEALTHMONITOR_ID))
self.worker.delete_health_monitor(health_monitor)
def create_member(self, context, member):

View File

@ -134,6 +134,12 @@ class ControllerWorker(object):
db_apis.get_session(),
id=health_monitor[constants.HEALTHMONITOR_ID])
if not db_health_monitor:
LOG.warning('Failed to fetch %s %s from DB. Retrying for up to '
'60 seconds.', 'healthmonitor',
db_health_monitor[constants.HEALTHMONITOR_ID])
raise db_exceptions.NoResultFound
pool = db_health_monitor.pool
pool.health_monitor = db_health_monitor
load_balancer = pool.load_balancer

View File

@ -1856,7 +1856,9 @@ class MarkHealthMonitorActiveInDB(BaseDatabaseTask):
LOG.debug("Mark ACTIVE in DB for health monitor id: %s",
health_mon[constants.HEALTHMONITOR_ID])
op_status = (constants.ONLINE if health_mon[constants.ADMIN_STATE_UP]
db_health_mon = self.health_mon_repo.get(
db_apis.get_session(), id=health_mon[constants.HEALTHMONITOR_ID])
op_status = (constants.ONLINE if db_health_mon.enabled
else constants.OFFLINE)
self.health_mon_repo.update(db_apis.get_session(),
health_mon[constants.HEALTHMONITOR_ID],