]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Ensure initialize_connection in targets pass multipath parameter
authorTomoki Sekiyama <tomoki.sekiyama@hds.com>
Fri, 13 Feb 2015 23:49:54 +0000 (18:49 -0500)
committerTomoki Sekiyama <tomoki.sekiyama@hds.com>
Wed, 25 Mar 2015 22:00:52 +0000 (18:00 -0400)
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

cinder/volume/targets/iscsi.py
cinder/volume/targets/iser.py
cinder/volume/targets/lio.py
cinder/volume/targets/scst.py
cinder/volume/targets/tgt.py

index aea40eaf9c411641b6f41fcff5b81eb8c3cdc31f..8dd1e78f687089ccb9c3727153a59ba2ed8b1e81 100644 (file)
@@ -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
index a6a3b5eea4f49ff27d968abff0cc783cd5daeef7..5cfa7220a33db3853c55fadc47200240d357e70b 100644 (file)
@@ -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
-        }
index 21f9b635e98b5df82078ace5e52796cbf0b8b126..43d50a900103ab807b3bc6721ec5b35a620d16f5 100644 (file)
@@ -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]
index a262ad9aaac83283c0716b845fbadf4334fae460..906713d9fa24c72277479999728ef3ba85aa23c4 100644 (file)
@@ -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
-        }
index 2b29536d9222386268f21f56e2dd1287a6644054..0df053d6bddef141ab08e10d970aec853d32d78f 100644 (file)
@@ -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