Status description is set on errors

If cluster comes into Error state, status_description field would contain
information about the error,

Implements blueprint expose-cluster-errors-details

Change-Id: I6ac629db331515ba8f5ef02b39852b6be9f592c9
This commit is contained in:
Nikita Konovalov 2013-07-17 19:24:47 +04:00
parent a862927f2d
commit c80b956307
2 changed files with 5 additions and 3 deletions

View File

@ -73,9 +73,10 @@ def create_cluster(values):
try:
context.model_update(cluster, status='Validating')
plugin.validate(cluster)
except Exception:
except Exception as ex:
with excutils.save_and_reraise_exception():
context.model_update(cluster, status='Error')
context.model_update(cluster, status='Error',
status_description=str(ex))
context.spawn(_provision_cluster, cluster.id)

View File

@ -44,7 +44,8 @@ def create_cluster(cluster):
except Exception as ex:
LOG.warn("Can't start cluster '%s' (reason: %s)", cluster.name, ex)
with excutils.save_and_reraise_exception():
context.model_update(cluster, status='Error')
context.model_update(cluster, status='Error',
status_description=str(ex))
_rollback_cluster_creation(cluster, ex)