From a5ac30b63e44c7e10ad600af62b0746f75f45040 Mon Sep 17 00:00:00 2001 From: Nikolay Starodubtsev Date: Fri, 20 Mar 2015 14:57:32 +0300 Subject: [PATCH] Add new log messages where it's needed During log rewriting process we mention some places where we should add 'Warning' and 'Info' level messages within messages we have at 'Debug' level. Closes-Bug: 1435208 Change-Id: Ib8bfc29c6f8c9ad5392ff09fa29a14e1209b3cc7 --- sahara/main.py | 2 +- sahara/service/direct_engine.py | 14 ++++++-------- sahara/service/heat/heat_engine.py | 18 ++++++------------ 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/sahara/main.py b/sahara/main.py index 330f3e43..7b557609 100644 --- a/sahara/main.py +++ b/sahara/main.py @@ -162,12 +162,12 @@ def make_app(): def _load_driver(namespace, name): - # TODO(starodubcevna): add LI here in the future for logging improvement extension_manager = stevedore.DriverManager( namespace=namespace, name=name, invoke_on_load=True ) + LOG.info(_LI("Driver {name} successfully loaded").format(name=name)) return extension_manager.driver diff --git a/sahara/service/direct_engine.py b/sahara/service/direct_engine.py index 71bbc6fa..6f20fbc3 100644 --- a/sahara/service/direct_engine.py +++ b/sahara/service/direct_engine.py @@ -115,12 +115,18 @@ class DirectEngine(e.Engine): if rollback_info.get('shutdown', False): self._rollback_cluster_creation(cluster, reason) + LOG.warning(_LW("Cluster {name} creation rollback " + "(reason: {reason})").format(name=cluster.name, + reason=reason)) return False instance_ids = rollback_info.get('instance_ids', []) if instance_ids: self._rollback_cluster_scaling( cluster, g.get_instances(cluster, instance_ids), reason) + LOG.warning(_LW("Cluster {name} scaling rollback " + "(reason: {reason})").format(name=cluster.name, + reason=reason)) return True @@ -481,19 +487,11 @@ class DirectEngine(e.Engine): def _rollback_cluster_creation(self, cluster, ex): """Shutdown all instances and update cluster status.""" - # TODO(starodubcevna): Need to add LOG.warning to upper level in next - # commits - LOG.debug("Cluster {name} creation rollback " - "(reason: {reason})".format(name=cluster.name, reason=ex)) self.shutdown_cluster(cluster) def _rollback_cluster_scaling(self, cluster, instances, ex): - # TODO(starodubcevna): Need to add LOG.warning to upper level in next - # commits """Attempt to rollback cluster scaling.""" - LOG.debug("Cluster {name} scaling rollback " - "(reason: {reason})".format(name=cluster.name, reason=ex)) for i in instances: self._shutdown_instance(i) diff --git a/sahara/service/heat/heat_engine.py b/sahara/service/heat/heat_engine.py index a8290351..19862294 100644 --- a/sahara/service/heat/heat_engine.py +++ b/sahara/service/heat/heat_engine.py @@ -101,6 +101,9 @@ class HeatEngine(e.Engine): if rollback_info.get('shutdown', False): self._rollback_cluster_creation(cluster, reason) + LOG.warning(_LW("Cluster {name} creation rollback " + "(reason: {reason})").format(name=cluster.name, + reason=reason)) return False rollback_count = rollback_info.get('rollback_count', {}).copy() @@ -108,6 +111,9 @@ class HeatEngine(e.Engine): if rollback_count or target_count: self._rollback_cluster_scaling( cluster, rollback_count, target_count, reason) + LOG.warning(_LW("Cluster {name} scaling rollback " + "(reason: {reason})").format(name=cluster.name, + reason=reason)) return True @@ -149,12 +155,6 @@ class HeatEngine(e.Engine): def _rollback_cluster_creation(self, cluster, ex): """Shutdown all instances and update cluster status.""" - # TODO(starodubcevna): Need to add LOG.warning to upper level in next - # commits - LOG.debug("Cluster {name} creation rollback " - "(reason: {reason})".format(name=cluster.name, - reason=ex)) - self.shutdown_cluster(cluster) def _rollback_cluster_scaling(self, cluster, rollback_count, @@ -168,12 +168,6 @@ class HeatEngine(e.Engine): maximize the chance of rollback success. """ - # TODO(starodubcevna): Need to add LOG.warning to upper level in next - # commits - LOG.debug("Cluster {name} scaling rollback " - "(reason: {reason})".format(name=cluster.name, - reason=ex)) - for ng in rollback_count: if rollback_count[ng] > target_count[ng]: rollback_count[ng] = target_count[ng]