diff --git a/octavia/cmd/house_keeping.py b/octavia/cmd/house_keeping.py index dd7d8e0add..3ac27a7b56 100755 --- a/octavia/cmd/house_keeping.py +++ b/octavia/cmd/house_keeping.py @@ -42,7 +42,7 @@ def spare_amphora_check(): spare_amp = house_keeping.SpareAmphora() while spare_amp_thread_event.is_set(): - LOG.info(_LI("Initiating spare amphora check...")) + LOG.debug("Initiating spare amphora check...") spare_amp.spare_check() time.sleep(interval) @@ -52,10 +52,12 @@ def db_cleanup(): # Read the interval from CONF interval = CONF.house_keeping.cleanup_interval LOG.info(_LI("DB cleanup interval is set to %d sec") % interval) + LOG.info(_LI('Amphora expiry age is %s seconds') % + CONF.house_keeping.amphora_expiry_age) db_cleanup = house_keeping.DatabaseCleanup() while db_cleanup_thread_event.is_set(): - LOG.info(_LI("Initiating the cleanup of old amphora...")) + LOG.debug("Initiating the cleanup of old amphora...") db_cleanup.delete_old_amphorae() time.sleep(interval) @@ -88,4 +90,4 @@ def main(): db_cleanup_thread_event.clear() spare_amp_thread.join() db_cleanup_thread.join() - LOG.info(_LI("House-Keeping process terminated")) \ No newline at end of file + LOG.info(_LI("House-Keeping process terminated")) diff --git a/octavia/controller/housekeeping/house_keeping.py b/octavia/controller/housekeeping/house_keeping.py index 59d8ebb513..f8af501526 100644 --- a/octavia/controller/housekeeping/house_keeping.py +++ b/octavia/controller/housekeeping/house_keeping.py @@ -41,23 +41,23 @@ class SpareAmphora(object): session = db_api.get_session() conf_spare_cnt = CONF.house_keeping.spare_amphora_pool_size curr_spare_cnt = self.amp_repo.get_spare_amphora_count(session) - LOG.info(_LI("Required Spare Amphora count : %d") % conf_spare_cnt) - LOG.info(_LI("Current Spare Amphora count : %d") % curr_spare_cnt) + LOG.debug("Required Spare Amphora count : %d" % conf_spare_cnt) + LOG.debug("Current Spare Amphora count : %d" % curr_spare_cnt) diff_count = conf_spare_cnt - curr_spare_cnt # When the current spare amphora is less than required if diff_count > 0: - LOG.info(_LI("Current spare amphora are fewer than required")) - LOG.info(_LI("Initiating creation of %d amphora ...") % diff_count) + LOG.info(_LI("Initiating creation of %d spare amphora.") % + diff_count) # Call Amphora Create Flow diff_count times for i in range(1, diff_count + 1): - LOG.info(_LI("Starting amphorae number %d ...") % i) + LOG.debug("Starting amphorae number %d ..." % i) self.cw.create_amphora() else: - LOG.info(_LI("Current spare amphora count satisfies the " - "requirement")) + LOG.debug(_LI("Current spare amphora count satisfies the " + "requirement")) class DatabaseCleanup(object): @@ -69,7 +69,6 @@ class DatabaseCleanup(object): """Checks the DB for old amphora and deletes them based on it's age.""" exp_age = datetime.timedelta( seconds=CONF.house_keeping.amphora_expiry_age) - LOG.info(_LI('Amphora expiry age is %s seconds') % exp_age) session = db_api.get_session() amphora = self.amp_repo.get_all(session, status=constants.DELETED) diff --git a/octavia/controller/worker/tasks/database_tasks.py b/octavia/controller/worker/tasks/database_tasks.py index fbc4fd08e1..29437472e1 100644 --- a/octavia/controller/worker/tasks/database_tasks.py +++ b/octavia/controller/worker/tasks/database_tasks.py @@ -24,7 +24,7 @@ from octavia.common import data_models from octavia.common import exceptions from octavia.db import api as db_apis from octavia.db import repositories as repo -from octavia.i18n import _LW +from octavia.i18n import _LI, _LW LOG = logging.getLogger(__name__) @@ -56,7 +56,7 @@ class CreateAmphoraInDB(BaseDatabaseTask): id=uuidutils.generate_uuid(), status=constants.PENDING_CREATE) - LOG.debug("Created Amphora in DB with id %s" % amphora.id) + LOG.info(_LI("Created Amphora in DB with id %s") % amphora.id) return amphora.id def revert(self, result, *args, **kwargs): @@ -292,8 +292,8 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask): loadbalancer_id) raise exceptions.NoReadyAmphoraeException() - LOG.debug("Allocated Amphora with id %s for load balancer " - "with id %s" % (amp.id, loadbalancer_id)) + LOG.info(_LI("Allocated Amphora with id %(amp)s for load balancer " + "with id %(lb)s") % {"amp": amp.id, "lb": loadbalancer_id}) return amp.id @@ -308,9 +308,10 @@ class MarkAmphoraAllocatedInDB(BaseDatabaseTask): def execute(self, amphora, loadbalancer_id): """Mark amphora as allocated to a load balancer in DB.""" - LOG.debug("Mark ALLOCATED in DB for amphora: %s with compute id %s " - "for load balancer: %s" % - (amphora.id, amphora.compute_id, loadbalancer_id)) + LOG.info(_LI("Mark ALLOCATED in DB for amphora: %(amp)s with " + "compute id %(comp)s for load balancer: %(lb)s") % + {"amp": amphora.id, "comp": amphora.compute_id, + "lb": loadbalancer_id}) self.amphora_repo.update(db_apis.get_session(), amphora.id, status=constants.AMPHORA_ALLOCATED, compute_id=amphora.compute_id, @@ -441,8 +442,9 @@ class MarkAmphoraReadyInDB(BaseDatabaseTask): def execute(self, amphora): """Mark amphora as ready in DB.""" - LOG.debug("Mark BOOTING in DB for amphora: %s with compute id %s" % - (amphora.id, amphora.compute_id)) + LOG.info(_LI("Mark READY in DB for amphora: %(amp)s with compute " + "id %(comp)s") % {"amp": amphora.id, + "comp": amphora.compute_id}) self.amphora_repo.update(db_apis.get_session(), amphora.id, status=constants.AMPHORA_READY, compute_id=amphora.compute_id, @@ -484,8 +486,8 @@ class MarkLBActiveInDB(BaseDatabaseTask): def execute(self, loadbalancer): """Mark the load balancer as active in DB.""" - LOG.debug("Mark ACTIVE in DB for load balancer id: %s" % - loadbalancer.id) + LOG.info(_LI("Mark ACTIVE in DB for load balancer id: %s") % + loadbalancer.id) self.loadbalancer_repo.update(db_apis.get_session(), loadbalancer.id, provisioning_status=constants.ACTIVE) @@ -854,4 +856,4 @@ class GetVipFromLoadbalancer(BaseDatabaseTask): """Task to pull the vip from a loadbalancer.""" def execute(self, loadbalancer): - return loadbalancer.vip \ No newline at end of file + return loadbalancer.vip