LVM: Add terminate_connection call for Target Objects
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
This commit is contained in:
parent
0269a26f13
commit
00b03b90cc
|
@ -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'}
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue