Permalink
Browse files

Report errors when resource creation fails

In order for the Stack creation to fail, resources must raise an exception
when their creation fails. The Stack's create code will set the resource
state appropriately; resources should not silently do it themselves.

Signed-off-by: Zane Bitter <zbitter@redhat.com>
  • Loading branch information...
zaneb committed May 15, 2012
1 parent 0720684 commit 0f1bd5d29102318e62b5a10281d809807bd3b163
Showing with 4 additions and 5 deletions.
  1. +1 −1 heat/engine/instance.py
  2. +2 −2 heat/engine/volume.py
  3. +1 −2 heat/engine/wait_condition.py
View
@@ -193,7 +193,7 @@ def _null_callback(p, n, out):
self.ipaddress = server.networks[n][0]
break
else:
- self.state_set(self.CREATE_FAILED)
+ raise exception.Error(server.status)
def validate(self):
'''
View
@@ -45,7 +45,7 @@ def create(self):
self.instance_id_set(vol.id)
self.state_set(self.CREATE_COMPLETE)
else:
- self.state_set(self.CREATE_FAILED)
+ raise exception.Error(vol.status)
def validate(self):
'''
@@ -100,7 +100,7 @@ def create(self):
self.instance_id_set(va.id)
self.state_set(self.CREATE_COMPLETE)
else:
- self.state_set(self.CREATE_FAILED)
+ raise exception.Error(vol.status)
def validate(self):
'''
@@ -154,8 +154,7 @@ def create(self):
self.state_set(self.CREATE_COMPLETE,
'%s: %s' % (self.name, reason))
else:
- self.state_set(self.CREATE_FAILED,
- '%s: %s' % (self.name, reason))
+ raise exception.Error(reason)
def delete(self):
if self.state == self.DELETE_IN_PROGRESS or \

0 comments on commit 0f1bd5d

Please sign in to comment.