Merge "INFINIDAT: delete host objects when detaching the last LUN"
This commit is contained in:
commit
34d8283798
@ -148,6 +148,14 @@ class InfiniboxDriverTestCase(test.TestCase):
|
||||
def test_terminate_connection(self):
|
||||
self.driver.terminate_connection(test_volume, test_connector)
|
||||
|
||||
def test_terminate_connection_delete_host(self):
|
||||
self._mock_host.get_luns.return_value = [object()]
|
||||
self.driver.terminate_connection(test_volume, test_connector)
|
||||
self.assertEqual(0, self._mock_host.safe_delete.call_count)
|
||||
self._mock_host.get_luns.return_value = []
|
||||
self.driver.terminate_connection(test_volume, test_connector)
|
||||
self.assertEqual(1, self._mock_host.safe_delete.call_count)
|
||||
|
||||
def test_terminate_connection_volume_doesnt_exist(self):
|
||||
self._system.volumes.safe_get.return_value = None
|
||||
self.assertRaises(exception.InvalidVolume,
|
||||
|
@ -213,6 +213,7 @@ class InfiniboxVolumeDriver(san.SanDriver):
|
||||
# check if the host now doesn't have mappings, to delete host_entry
|
||||
# if needed
|
||||
if len(host.get_luns()) == 0:
|
||||
host.safe_delete()
|
||||
# Create initiator-target mapping.
|
||||
target_wwpns = list(self._get_online_fc_ports())
|
||||
target_wwpns, init_target_map = self._build_initiator_target_map(
|
||||
|
Loading…
Reference in New Issue
Block a user