Record server.id in server creation exception
If an error happens in the initial creation, no id is returned to the server can't be cleaned up. Change-Id: Ieb818dcf9ded062f016a3f96342f320dc203edd0
This commit is contained in:
parent
714dabcc33
commit
2c24e204a6
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- server creation errors now include the server id in the
|
||||
Exception to allow people to clean up.
|
10
shade/exc.py
10
shade/exc.py
@ -54,6 +54,16 @@ class OpenStackCloudException(Exception):
|
||||
return message
|
||||
|
||||
|
||||
class OpenStackCloudCreateException(OpenStackCloudException):
|
||||
|
||||
def __init__(self, resource, resource_id, extra_data=None, **kwargs):
|
||||
super(OpenStackCloudCreateException, self).__init__(
|
||||
message="Error creating {resource}: {resource_id}".format(
|
||||
resource=resource, resource_id=resource_id),
|
||||
extra_data=extra_data, **kwargs)
|
||||
self.resource_id = resource_id
|
||||
|
||||
|
||||
class OpenStackCloudTimeout(OpenStackCloudException):
|
||||
pass
|
||||
|
||||
|
@ -6605,8 +6605,8 @@ class OpenStackCloud(
|
||||
# going to do the wait loop below, this is a waste of a call
|
||||
server = self.get_server_by_id(server.id)
|
||||
if server.status == 'ERROR':
|
||||
raise OpenStackCloudException(
|
||||
"Error in creating the server.")
|
||||
raise OpenStackCloudCreationException(
|
||||
resource='server', resource_id=server.id)
|
||||
|
||||
if wait:
|
||||
server = self.wait_for_server(
|
||||
|
Loading…
Reference in New Issue
Block a user