Merge "[Amphorav2] Healthmonitor operation minor fixes"

This commit is contained in:
Zuul 2020-09-23 14:58:51 +00:00 committed by Gerrit Code Review
commit b3982cd32f
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

@ -169,6 +169,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

@ -1874,7 +1874,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],