Raise correct exception when validate_connector failed
Cinder volume manager uses validate_connector() method to verify if required information is in connector when handling initialize_connection() request. validate_connector() is actually a pure input validation method, basically checking if 'initiator' or 'wwpns' is in connector if storage protocol is iSCSI or FC. However, when required information is missing, currently drivers raises either VolumeBackendAPIException or VolumeDriverException, which would then bubble up to API and then to user (Nova) as InternalServerError. This change adds a new exception - InvalidConnectorException, that drivers should raise when connector is found not valid. With that, Cinder API would raise BadRequest instead to user, suggesting things are missing in request. Change-Id: I4f04f5d0c558404836a2bd270f7f22f3f2d4f314 Closes-bug: #1409580
This commit is contained in:
@@ -195,6 +195,9 @@ class VolumeActionsController(wsgi.Controller):
|
||||
info = self.volume_api.initialize_connection(context,
|
||||
volume,
|
||||
connector)
|
||||
except exception.InvalidInput as err:
|
||||
raise webob.exc.HTTPBadRequest(
|
||||
explanation=err)
|
||||
except exception.VolumeBackendAPIException as error:
|
||||
msg = _("Unable to fetch connection information from backend.")
|
||||
raise webob.exc.HTTPInternalServerError(explanation=msg)
|
||||
|
||||
Reference in New Issue
Block a user