Merge "Fix confusing exception message in NetApp iscsi driver"
This commit is contained in:
commit
7a2386502a
|
@ -22,6 +22,7 @@ import BaseHTTPServer
|
|||
import httplib
|
||||
|
||||
from lxml import etree
|
||||
import mock
|
||||
import six
|
||||
|
||||
from cinder import exception
|
||||
|
@ -40,7 +41,6 @@ from cinder.volume.drivers.netapp.options import netapp_provisioning_opts
|
|||
from cinder.volume.drivers.netapp.options import netapp_transport_opts
|
||||
from cinder.volume.drivers.netapp import ssc_utils
|
||||
|
||||
|
||||
LOG = logging.getLogger("cinder.volume.driver")
|
||||
|
||||
|
||||
|
@ -657,6 +657,23 @@ class NetAppDirectCmodeISCSIDriverTestCase(test.TestCase):
|
|||
self.driver.create_volume(self.volume)
|
||||
self.driver.extend_volume(self.volume, 4)
|
||||
|
||||
def test_initialize_connection_no_target_details_found(self):
|
||||
fake_volume = {'name': 'mock-vol'}
|
||||
fake_connector = {'initiator': 'iqn.mock'}
|
||||
self.driver._map_lun = mock.Mock(return_value='mocked-lun-id')
|
||||
self.driver._get_iscsi_service_details = mock.Mock(
|
||||
return_value='mocked-iqn')
|
||||
self.driver._get_target_details = mock.Mock(return_value=[])
|
||||
expected = (_('No iscsi target details were found for LUN %s')
|
||||
% fake_volume['name'])
|
||||
try:
|
||||
self.driver.initialize_connection(fake_volume, fake_connector)
|
||||
except exception.VolumeBackendAPIException as exc:
|
||||
if expected not in str(exc):
|
||||
self.fail(_('Expected exception message is missing'))
|
||||
else:
|
||||
self.fail(_('VolumeBackendAPIException not raised'))
|
||||
|
||||
|
||||
class NetAppDriverNegativeTestCase(test.TestCase):
|
||||
"""Test case for NetAppDriver"""
|
||||
|
|
|
@ -269,7 +269,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||
LOG.debug(msg % msg_fmt)
|
||||
|
||||
if not target_details_list:
|
||||
msg = _('Failed to get LUN target details for the LUN %s')
|
||||
msg = _('No iscsi target details were found for LUN %s')
|
||||
raise exception.VolumeBackendAPIException(data=msg % name)
|
||||
target_details = None
|
||||
for tgt_detail in target_details_list:
|
||||
|
|
Loading…
Reference in New Issue