Handle initialize_connection() exception in volume manager
Due to the fact that several drivers require backend communication to fetch connection information for a volume, it's possile that these driver throw exceptions while doing that. Currently exceptions can bubble up to volume API not being handled. This patch logs exception in volume manager and then raises VolumeBackendAPIException to caller. Change-Id: Ib3cc152e04ba029dd835a64b0cfb0a77b8a6828e Closes-bug: 1256804
This commit is contained in:
@@ -188,9 +188,14 @@ class VolumeActionsController(wsgi.Controller):
|
||||
connector = body['os-initialize_connection']['connector']
|
||||
except KeyError:
|
||||
raise webob.exc.HTTPBadRequest("Must specify 'connector'")
|
||||
info = self.volume_api.initialize_connection(context,
|
||||
volume,
|
||||
connector)
|
||||
try:
|
||||
info = self.volume_api.initialize_connection(context,
|
||||
volume,
|
||||
connector)
|
||||
except exception.VolumeBackendAPIException as error:
|
||||
msg = _("Unable to fetch connection information from backend.")
|
||||
raise webob.exc.HTTPInternalServerError(msg)
|
||||
|
||||
return {'connection_info': info}
|
||||
|
||||
@wsgi.action('os-terminate_connection')
|
||||
|
||||
Reference in New Issue
Block a user