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
This commit is contained in:
Nikolay Starodubtsev 2015-03-20 14:57:32 +03:00
parent 3cf94be9ce
commit a5ac30b63e
3 changed files with 13 additions and 21 deletions

View File

@ -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

View File

@ -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)

View File

@ -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]