Merge "Storwize/SVC driver detach volume failed" into stable/icehouse
This commit is contained in:
commit
63f5798e87
@ -2390,15 +2390,13 @@ class StorwizeSVCDriverTestCase(test.TestCase):
|
|||||||
self._delete_volume(volume)
|
self._delete_volume(volume)
|
||||||
|
|
||||||
def test_storwize_initiator_multiple_preferred_nodes_matching(self):
|
def test_storwize_initiator_multiple_preferred_nodes_matching(self):
|
||||||
# Set the context.
|
|
||||||
ctxt = context.get_admin_context()
|
|
||||||
|
|
||||||
# Generate us a test volume
|
# Generate us a test volume
|
||||||
volume = self._generate_vol_info(None, None)
|
volume = self._create_volume()
|
||||||
self.driver.create_volume(volume)
|
|
||||||
|
|
||||||
# Fibre Channel volume type
|
# Fibre Channel volume type
|
||||||
vol_type = volume_types.create(ctxt, 'FC', {'protocol': 'FC'})
|
extra_spec = {'capabilities:storage_protocol': '<in> FC'}
|
||||||
|
vol_type = volume_types.create(self.ctxt, 'FC', extra_spec)
|
||||||
|
|
||||||
volume['volume_type_id'] = vol_type['id']
|
volume['volume_type_id'] = vol_type['id']
|
||||||
|
|
||||||
@ -2427,15 +2425,12 @@ class StorwizeSVCDriverTestCase(test.TestCase):
|
|||||||
'AABBCCDDEEFF0010')
|
'AABBCCDDEEFF0010')
|
||||||
|
|
||||||
def test_storwize_initiator_multiple_preferred_nodes_no_matching(self):
|
def test_storwize_initiator_multiple_preferred_nodes_no_matching(self):
|
||||||
# Set the context.
|
|
||||||
ctxt = context.get_admin_context()
|
|
||||||
|
|
||||||
# Generate us a test volume
|
# Generate us a test volume
|
||||||
volume = self._generate_vol_info(None, None)
|
volume = self._create_volume()
|
||||||
self.driver.create_volume(volume)
|
|
||||||
|
|
||||||
# Fibre Channel volume type
|
# Fibre Channel volume type
|
||||||
vol_type = volume_types.create(ctxt, 'FC', {'protocol': 'FC'})
|
extra_spec = {'capabilities:storage_protocol': '<in> FC'}
|
||||||
|
vol_type = volume_types.create(self.ctxt, 'FC', extra_spec)
|
||||||
|
|
||||||
volume['volume_type_id'] = vol_type['id']
|
volume['volume_type_id'] = vol_type['id']
|
||||||
|
|
||||||
@ -2464,15 +2459,12 @@ class StorwizeSVCDriverTestCase(test.TestCase):
|
|||||||
'AABBCCDDEEFF0001')
|
'AABBCCDDEEFF0001')
|
||||||
|
|
||||||
def test_storwize_initiator_single_preferred_node_matching(self):
|
def test_storwize_initiator_single_preferred_node_matching(self):
|
||||||
# Set the context
|
|
||||||
ctxt = context.get_admin_context()
|
|
||||||
|
|
||||||
# Generate us a test volume
|
# Generate us a test volume
|
||||||
volume = self._generate_vol_info(None, None)
|
volume = self._create_volume()
|
||||||
self.driver.create_volume(volume)
|
|
||||||
|
|
||||||
# Fibre Channel volume type
|
# Fibre Channel volume type
|
||||||
vol_type = volume_types.create(ctxt, 'FC', {'protocol': 'FC'})
|
extra_spec = {'capabilities:storage_protocol': '<in> FC'}
|
||||||
|
vol_type = volume_types.create(self.ctxt, 'FC', extra_spec)
|
||||||
|
|
||||||
volume['volume_type_id'] = vol_type['id']
|
volume['volume_type_id'] = vol_type['id']
|
||||||
|
|
||||||
@ -2499,16 +2491,36 @@ class StorwizeSVCDriverTestCase(test.TestCase):
|
|||||||
self.assertEqual(init_ret['data']['target_wwn'],
|
self.assertEqual(init_ret['data']['target_wwn'],
|
||||||
'AABBCCDDEEFF0012')
|
'AABBCCDDEEFF0012')
|
||||||
|
|
||||||
def test_storwize_initiator_target_map(self):
|
def test_storwize_terminate_connection(self):
|
||||||
# Create two volumes to be used in mappings
|
# create a FC volume
|
||||||
ctxt = context.get_admin_context()
|
volume_fc = self._create_volume()
|
||||||
|
extra_spec = {'capabilities:storage_protocol': '<in> FC'}
|
||||||
|
vol_type_fc = volume_types.create(self.ctxt, 'FC', extra_spec)
|
||||||
|
volume_fc['volume_type_id'] = vol_type_fc['id']
|
||||||
|
|
||||||
|
# create a iSCSI volume
|
||||||
|
volume_iSCSI = self._create_volume()
|
||||||
|
extra_spec = {'capabilities:storage_protocol': '<in> iSCSI'}
|
||||||
|
vol_type_iSCSI = volume_types.create(self.ctxt, 'iSCSI', extra_spec)
|
||||||
|
volume_iSCSI['volume_type_id'] = vol_type_iSCSI['id']
|
||||||
|
|
||||||
|
connector = {'host': 'storwize-svc-host',
|
||||||
|
'wwnns': ['20000090fa17311e', '20000090fa17311f'],
|
||||||
|
'wwpns': ['ff00000000000000', 'ff00000000000001'],
|
||||||
|
'initiator': 'iqn.1993-08.org.debian:01:eac5ccc1aaa'}
|
||||||
|
|
||||||
|
self.driver.initialize_connection(volume_fc, connector)
|
||||||
|
self.driver.initialize_connection(volume_iSCSI, connector)
|
||||||
|
self.driver.terminate_connection(volume_iSCSI, connector)
|
||||||
|
self.driver.terminate_connection(volume_fc, connector)
|
||||||
|
|
||||||
|
def test_storwize_initiator_target_map(self):
|
||||||
# Generate us a test volume
|
# Generate us a test volume
|
||||||
volume = self._generate_vol_info(None, None)
|
volume = self._create_volume()
|
||||||
self.driver.create_volume(volume)
|
|
||||||
|
|
||||||
# FIbre Channel volume type
|
# FIbre Channel volume type
|
||||||
vol_type = volume_types.create(ctxt, 'FC', {'protocol': 'FC'})
|
extra_spec = {'capabilities:storage_protocol': '<in> FC'}
|
||||||
|
vol_type = volume_types.create(self.ctxt, 'FC', extra_spec)
|
||||||
|
|
||||||
volume['volume_type_id'] = vol_type['id']
|
volume['volume_type_id'] = vol_type['id']
|
||||||
|
|
||||||
|
@ -471,6 +471,16 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
|
|
||||||
vol_name = volume['name']
|
vol_name = volume['name']
|
||||||
if 'host' in connector:
|
if 'host' in connector:
|
||||||
|
# maybe two hosts on the storage, one is for FC and the other for
|
||||||
|
# iSCSI, so get host according to protocol
|
||||||
|
vol_opts = self._get_vdisk_params(volume['volume_type_id'])
|
||||||
|
connector = connector.copy()
|
||||||
|
if vol_opts['protocol'] == 'FC':
|
||||||
|
connector.pop('initiator', None)
|
||||||
|
elif vol_opts['protocol'] == 'iSCSI':
|
||||||
|
connector.pop('wwnns', None)
|
||||||
|
connector.pop('wwpns', None)
|
||||||
|
|
||||||
host_name = self._helpers.get_host_from_connector(connector)
|
host_name = self._helpers.get_host_from_connector(connector)
|
||||||
if host_name is None:
|
if host_name is None:
|
||||||
msg = (_('terminate_connection: Failed to get host name from'
|
msg = (_('terminate_connection: Failed to get host name from'
|
||||||
|
Loading…
Reference in New Issue
Block a user