]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
LVM: Add terminate_connection call for Target Objects
authorTomoki Sekiyama <tomoki.sekiyama@hds.com>
Wed, 7 Jan 2015 22:39:33 +0000 (17:39 -0500)
committerTomoki Sekiyama <tomoki.sekiyama@hds.com>
Wed, 7 Jan 2015 23:00:12 +0000 (18:00 -0500)
terminate_connection should be redirected from LVM driver to targets
object. Especially this is required in LioAdm to remove an initiator
from a target. This also fixes some mismatch of method arguments and
remove unused methods in target objects.

Change-Id: Ic42836e995bbdaad92e355b94cb2d7b45d8fdb60
Partial-Bug: #1408443

cinder/tests/targets/test_base_iscsi_driver.py
cinder/volume/drivers/lvm.py
cinder/volume/targets/driver.py
cinder/volume/targets/fake.py
cinder/volume/targets/iet.py
cinder/volume/targets/iscsi.py
cinder/volume/targets/lio.py

index 2608e5be318668aec274f1c73b5fa52f8441660c..4777e2f9a8d8c0f118ea569b04fd2d4de7dddd06 100644 (file)
@@ -127,7 +127,7 @@ class TestBaseISCSITargetDriver(test.TestCase):
         expected = {'driver_volume_type': 'iscsi',
                     'data': self.expected_iscsi_properties}
         self.assertEqual(expected,
-                         self.target.initialize_connection(self.testvol_1))
+                         self.target.initialize_connection(self.testvol_1, {}))
 
     def test_validate_connector(self):
         bad_connector = {'no_initiator': 'nada'}
index 1ae7ce292fe200739caad5a3f19b7e2dd04c141d..b0409a7c01d14dc95b9cbd1d3b0ee53f97f84e46 100644 (file)
@@ -572,7 +572,8 @@ class LVMVolumeDriver(driver.VolumeDriver):
         return self.target_driver.validate_connector(connector)
 
     def terminate_connection(self, volume, connector, **kwargs):
-        pass
+        return self.target_driver.terminate_connection(volume, connector,
+                                                       **kwargs)
 
 
 class LVMISCSIDriver(LVMVolumeDriver):
index bfa636d55cfdbdb6468015dacf3a483175f576c4..0e55932d942006a7b871e8c8432a84fb920c526d 100644 (file)
@@ -58,15 +58,10 @@ class Target(object):
         pass
 
     @abc.abstractmethod
-    def detach_volume(self, context, volume):
-        """Callback for volume detached from instance or host."""
-        pass
-
-    @abc.abstractmethod
-    def initialize_connection(self, volume, **kwargs):
+    def initialize_connection(self, volume, connector):
         """Allow connection to connector and return connection info."""
         pass
 
-    def terminate_connection(self, volume, **kwargs):
+    def terminate_connection(self, volume, connector, **kwargs):
         """Disallow connection from connector."""
         pass
index 9f6c8bb9ed2c535c16088f56d54601f033641ccb..d1bcbe9e0d6c4d9907b16b1f2f9e0c0834c74dae 100644 (file)
@@ -33,16 +33,8 @@ class FakeTarget(iscsi.ISCSITarget):
     def remove_export(self, context, volume):
         pass
 
-    def attach_volume(self, context,
-                      volume, instance_uuid,
-                      host_name, mountpoint):
+    def initialize_connection(self, volume, connector):
         pass
 
-    def detach_volume(self, context, volume):
-        pass
-
-    def initialize_connection(self, volume, **kwargs):
-        pass
-
-    def terminate_connection(self, volume, **kwargs):
+    def terminate_connection(self, volume, connector, **kwargs):
         pass
index 71214866d505c8b440b8aaa3e71155b39ff37d24..6c3f5e6d19b7ac6078b62ed2442b776505bffd4d 100644 (file)
@@ -28,15 +28,5 @@ class IetAdm(object):
     def remove_export(self, context, volume):
         pass
 
-    def attach_volume(self, context, volume,
-                      instance_uuid, host_name, mountpoint):
-        pass
-
-    def detach_volume(self, context, volume):
-        pass
-
-    def initialize_connection(self, volume, **kwargs):
-        pass
-
-    def terminate_connection(self, volume, **kwargs):
+    def initialize_connection(self, volume, connector):
         pass
index 0ae0a4512b995b4f2abc908cdf13108c83dd1bd0..d1c7fc6c7a4bccc5cdb1687ec6b0354605ed1ff5 100644 (file)
@@ -156,10 +156,7 @@ class ISCSITarget(driver.Target):
         """Get the current chap auth username and password."""
         return None
 
-    def detach_volume(self, context, volume):
-        self._get_iscsi_properties(volume)
-
-    def initialize_connection(self, volume, **kwargs):
+    def initialize_connection(self, volume, connector):
         """Initializes the connection and returns connection info.
 
         The iscsi driver returns a driver_volume_type of 'iscsi'.
index 3f38dacd2129bccb6b895d42ee396d6b732b5d8b..4aecde34459452188377a41fca2ec17ca6f731aa 100644 (file)
@@ -178,7 +178,7 @@ class LioAdm(TgtAdm):
             'data': iscsi_properties
         }
 
-    def terminate_connection(self, volume, connector):
+    def terminate_connection(self, volume, connector, **kwargs):
         volume_iqn = volume['provider_location'].split(' ')[1]
 
         # Delete initiator iqns from target ACL