Catch specific exception on claim
If resource claim fails, a ResourcesUnavailable exception will be raised. We can catch this exception instead of catching a generic exception. Change-Id: I0bef394ac6c1c01a7b527d49ceb1613b90dcb480
This commit is contained in:
parent
298b96234c
commit
0304d1b992
@ -79,7 +79,7 @@ class Claim(NopClaim):
|
||||
self._pci_requests = pci_requests
|
||||
|
||||
# Check claim at constructor to avoid mess code
|
||||
# Raise exception ComputeResourcesUnavailable if claim failed
|
||||
# Raise exception ResourcesUnavailable if claim failed
|
||||
self._claim_test(resources, limits)
|
||||
|
||||
@property
|
||||
|
@ -309,9 +309,7 @@ class Manager(periodic_task.PeriodicTasks):
|
||||
context, container, requested_networks, requested_volumes,
|
||||
sandbox, limits, reraise)
|
||||
return created_container
|
||||
except Exception as e:
|
||||
# Other exception has handled in create sandbox and create base,
|
||||
# exception occured here only can be the claim failed.
|
||||
except exception.ResourcesUnavailable as e:
|
||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||
LOG.exception("Container resource claim failed: %s",
|
||||
six.text_type(e))
|
||||
|
Loading…
x
Reference in New Issue
Block a user