Ensure initialize_connection in targets pass multipath parameter
When the connector dict specified to initialize_connection has 'multipath' key, its value should be passed to _get_iscsi_properties so that it can generate multipath information if available. This removes the duplicated codes and ensures every target passes the multipath property. Change-Id: Ia4a8c14c3d2544682f677622fb2dfe4291d95ffc
This commit is contained in:
parent
706878deaa
commit
2d61d8b1cf
@ -279,7 +279,9 @@ class ISCSITarget(driver.Target):
|
||||
}
|
||||
"""
|
||||
|
||||
iscsi_properties = self._get_iscsi_properties(volume)
|
||||
iscsi_properties = self._get_iscsi_properties(volume,
|
||||
connector.get(
|
||||
'multipath'))
|
||||
return {
|
||||
'driver_volume_type': self.iscsi_protocol,
|
||||
'data': iscsi_properties
|
||||
|
@ -44,25 +44,3 @@ class ISERTgtAdm(tgt.TgtAdm):
|
||||
self.configuration.iscsi_ip_address = \
|
||||
self.configuration.iser_ip_address
|
||||
self.configuration.iscsi_port = self.configuration.iser_port
|
||||
|
||||
def initialize_connection(self, volume, connector):
|
||||
"""Initializes the connection and returns connection info.
|
||||
The iser driver returns a driver_volume_type of 'iser'.
|
||||
The format of the driver data is defined in _get_iscsi_properties.
|
||||
Example return value::
|
||||
{
|
||||
'driver_volume_type': 'iser'
|
||||
'data': {
|
||||
'target_discovered': True,
|
||||
'target_iqn':
|
||||
'iqn.2010-10.org.openstack:volume-00000001',
|
||||
'target_portal': '127.0.0.0.1:3260',
|
||||
'volume_id': 1,
|
||||
}
|
||||
}
|
||||
"""
|
||||
iser_properties = self._get_iscsi_properties(volume)
|
||||
return {
|
||||
'driver_volume_type': 'iser',
|
||||
'data': iser_properties
|
||||
}
|
||||
|
@ -171,14 +171,7 @@ class LioAdm(iscsi.ISCSITarget):
|
||||
# We make changes persistent
|
||||
self._persist_configuration(volume['id'])
|
||||
|
||||
iscsi_properties = self._get_iscsi_properties(volume,
|
||||
connector.get(
|
||||
'multipath'))
|
||||
|
||||
return {
|
||||
'driver_volume_type': self.iscsi_protocol,
|
||||
'data': iscsi_properties
|
||||
}
|
||||
return super(LioAdm, self).initialize_connection(volume, connector)
|
||||
|
||||
def terminate_connection(self, volume, connector, **kwargs):
|
||||
volume_iqn = volume['provider_location'].split(' ')[1]
|
||||
|
@ -393,10 +393,3 @@ class SCSTAdm(iscsi.ISCSITarget):
|
||||
if tid is None:
|
||||
raise exception.ISCSITargetHelperCommandFailed(
|
||||
error_message="Target not found")
|
||||
|
||||
def initialize_connection(self, volume, connector):
|
||||
iscsi_properties = self._get_iscsi_properties(volume)
|
||||
return {
|
||||
'driver_volume_type': 'iscsi',
|
||||
'data': iscsi_properties
|
||||
}
|
||||
|
@ -277,15 +277,6 @@ class TgtAdm(iscsi.ISCSITarget):
|
||||
|
||||
return tid
|
||||
|
||||
def initialize_connection(self, volume, connector):
|
||||
iscsi_properties = self._get_iscsi_properties(volume,
|
||||
connector.get(
|
||||
'multipath'))
|
||||
return {
|
||||
'driver_volume_type': self.iscsi_protocol,
|
||||
'data': iscsi_properties
|
||||
}
|
||||
|
||||
def remove_iscsi_target(self, tid, lun, vol_id, vol_name, **kwargs):
|
||||
LOG.info(_LI('Removing iscsi_target for Volume ID: %s'), vol_id)
|
||||
vol_uuid_file = vol_name
|
||||
|
Loading…
x
Reference in New Issue
Block a user