conn = FakeEcomConnection()
return conn
- def fake_do_iscsi_discovery(self, volume, ipAddress):
+ def fake_do_iscsi_discovery(self, volume):
output = []
item = '10.10.0.50: 3260,1 iqn.1992-04.com.emc: 50000973f006dd80'
output.append(item)
'_wrap_find_device_number',
return_value={'hostlunid': 1,
'storagesystem': EMCVMAXCommonData.storage_system})
- @mock.patch.object(
- EMCVMAXUtils,
- 'find_ip_protocol_endpoint',
- return_value='10.10.10.10')
def test_map_no_fast_success(self, _mock_volume_type, mock_wrap_group,
- mock_wrap_device, mock_find_ip):
+ mock_wrap_device):
self.driver.initialize_connection(self.data.test_volume,
self.data.connector)
self.data.test_ctxt, self.data.test_volume, self.data.new_type,
self.data.diff, self.data.test_host)
+ def test_check_for_setup_error(self):
+ self.driver.configuration.iscsi_ip_address = '1.1.1.1'
+ self.driver.check_for_setup_error()
+ self.driver.configuration.iscsi_ip_address = None
+ self.assertRaises(exception.InvalidInput,
+ self.driver.check_for_setup_error)
+
def _cleanup(self):
bExists = os.path.exists(self.config_file_path)
if bExists:
conn = FakeEcomConnection()
return conn
- def fake_do_iscsi_discovery(self, volume, ipAddress):
+ def fake_do_iscsi_discovery(self, volume):
output = []
item = '10.10.0.50: 3260,1 iqn.1992-04.com.emc: 50000973f006dd80'
output.append(item)
'_wrap_find_device_number',
return_value={'hostlunid': 1,
'storagesystem': EMCVMAXCommonData.storage_system})
- @mock.patch.object(
- EMCVMAXUtils,
- 'find_ip_protocol_endpoint',
- return_value='10.10.10.10')
def test_map_fast_success(self, _mock_volume_type, mock_wrap_group,
- mock_wrap_device, mock_find_ip):
+ mock_wrap_device):
self.driver.initialize_connection(self.data.test_volume,
self.data.connector)
'_wrap_find_device_number',
return_value={'hostlunid': 1,
'storagesystem': EMCVMAXCommonData.storage_system})
- @mock.patch.object(
- EMCVMAXUtils,
- 'find_ip_protocol_endpoint',
- return_value='10.10.10.10')
def test_map_no_fast_success(self, _mock_volume_type, mock_wrap_group,
- mock_wrap_device, mock_find_ip):
+ mock_wrap_device):
self.driver.initialize_connection(self.data.test_volume,
self.data.connector)
:param volume: volume Object
:param connector: the connector Object
:returns: deviceInfoDict, device information tuple
- :returns: ipAddress, required for ISCSI command
:raises: VolumeBackendAPIException
"""
- ipAddress = None
extraSpecs = self._initial_setup(volume)
volumeName = volume['name']
% {'vol': volumeName})
raise exception.VolumeBackendAPIException(
data=exception_message)
- if self.protocol.lower() == 'iscsi':
- ipAddress = self.utils.find_ip_protocol_endpoint(
- self.conn, deviceInfoDict['storagesystem'])
- if ipAddress is None:
- LOG.info(_("Unable to get iscsi IP address "
- "for storagesystem %(storageSystem)s")
- % {'storageSystem': deviceInfoDict['storagesystem']})
-
- return deviceInfoDict, ipAddress
+
+ return deviceInfoDict
def _wrap_find_device_number(self, volume, connector):
"""Aid for unit testing
}
}
"""
- device_info, ipAddress = self.common.initialize_connection(
+ device_info = self.common.initialize_connection(
volume, connector)
device_number = device_info['hostlunid']
storage_system = device_info['storagesystem']
configuration=self.configuration)
def check_for_setup_error(self):
- pass
+ if not self.configuration.iscsi_ip_address:
+ raise exception.InvalidInput(
+ reason=_('iscsi_ip_address is not set.'))
def create_volume(self, volume):
"""Creates a EMC(VMAX/VNX) volume."""
}
}
"""
- devInfo, ipAddress = self.common.initialize_connection(
- volume, connector)
+ self.common.initialize_connection(volume, connector)
iscsi_properties = self.smis_get_iscsi_properties(
- volume, connector, ipAddress)
+ volume, connector)
LOG.info(_("Leaving initialize_connection: %s") % (iscsi_properties))
return {
'data': iscsi_properties
}
- def smis_do_iscsi_discovery(self, volume, ipAddress):
+ def smis_do_iscsi_discovery(self, volume):
- LOG.warn(_("ISCSI provider_location not stored, using discovery"))
+ LOG.info(_("ISCSI provider_location not stored, using discovery."))
(out, _err) = self._execute('iscsiadm', '-m', 'discovery',
'-t', 'sendtargets', '-p',
- ipAddress,
+ self.configuration.iscsi_ip_address,
run_as_root=True)
LOG.info(_(
return targets
- def smis_get_iscsi_properties(self, volume, connector, ipAddress):
+ def smis_get_iscsi_properties(self, volume, connector):
"""Gets iscsi configuration.
We ideally get saved information in the volume entity, but fall back
"""
properties = {}
- location = self.smis_do_iscsi_discovery(volume, ipAddress)
+ location = self.smis_do_iscsi_discovery(volume)
if not location:
raise exception.InvalidVolume(_("Could not find iSCSI export "
" for volume %(volumeName)s")