Merge "Add new log messages where it's needed"

This commit is contained in:
Jenkins 2015-03-23 23:18:37 +00:00 committed by Gerrit Code Review
commit d7297357fc
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]