]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Raise correct exception when validate_connector failed
authorZhiteng Huang <zhithuang@ebaysf.com>
Mon, 12 Jan 2015 05:27:15 +0000 (13:27 +0800)
committerZhiteng Huang <zhithuang@ebaysf.com>
Mon, 26 Jan 2015 05:29:41 +0000 (13:29 +0800)
commitc7d97c4ad70cc49dd529a10c593fbd9b20f89d90
tree6fc14da014115d00b3b65920de2ce205a13bf5b8
parent5f17a953ea2a2ea59da44ea87f038ac9b33150f2
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
14 files changed:
cinder/api/contrib/volume_actions.py
cinder/exception.py
cinder/tests/api/contrib/test_admin_actions.py
cinder/tests/targets/test_base_iscsi_driver.py
cinder/tests/test_huawei_t_dorado.py
cinder/tests/test_ibm_flashsystem.py
cinder/tests/test_storwize_svc.py
cinder/tests/test_volume.py
cinder/volume/driver.py
cinder/volume/drivers/huawei/huawei_t.py
cinder/volume/drivers/ibm/flashsystem.py
cinder/volume/drivers/ibm/storwize_svc/__init__.py
cinder/volume/manager.py
cinder/volume/targets/iscsi.py