Merge "Handle exception on searching for images"
This commit is contained in:
commit
06f18577c0
@ -55,11 +55,17 @@ class API(object):
|
|||||||
# before proceeding to create container. If image is not found,
|
# before proceeding to create container. If image is not found,
|
||||||
# container create will fail with 400 status.
|
# container create will fail with 400 status.
|
||||||
if CONF.api.enable_image_validation:
|
if CONF.api.enable_image_validation:
|
||||||
|
try:
|
||||||
images = self.rpcapi.image_search(
|
images = self.rpcapi.image_search(
|
||||||
context, new_container.image,
|
context, new_container.image,
|
||||||
new_container.image_driver, True, host_state['host'])
|
new_container.image_driver, True, host_state['host'])
|
||||||
if not images:
|
if not images:
|
||||||
raise exception.ImageNotFound(image=new_container.image)
|
raise exception.ImageNotFound(image=new_container.image)
|
||||||
|
except Exception as e:
|
||||||
|
new_container.status = consts.ERROR
|
||||||
|
new_container.status_reason = str(e)
|
||||||
|
new_container.save(context)
|
||||||
|
raise
|
||||||
|
|
||||||
self._record_action_start(context, new_container,
|
self._record_action_start(context, new_container,
|
||||||
container_actions.CREATE)
|
container_actions.CREATE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user