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>
This commit is contained in:
Zane Bitter 2012-05-15 15:03:38 +02:00
parent 0720684956
commit 0f1bd5d291
3 changed files with 4 additions and 5 deletions

View File

@ -193,7 +193,7 @@ class Instance(Resource):
self.ipaddress = server.networks[n][0]
break
else:
self.state_set(self.CREATE_FAILED)
raise exception.Error(server.status)
def validate(self):
'''

View File

@ -45,7 +45,7 @@ class Volume(Resource):
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 @@ class VolumeAttachment(Resource):
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):
'''

View File

@ -154,8 +154,7 @@ class WaitCondition(Resource):
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 \