From 11edf336592b779cd05b1e3b44abc9c8c5a3a205 Mon Sep 17 00:00:00 2001 From: Ryan McNair Date: Thu, 12 Nov 2015 15:06:32 +0000 Subject: [PATCH] Deprecate *_multipath_enabled flag for IBM drivers Deprecate the *_multipath_enabled from the FlashSystem and Storwize/SVC driver. When enabled, this flag was intended to create a single mapping between the compute node and the storage device for FC connections. However, all available storage WWNNs were still being mapped to the compute node, and instead enabling this flag was causing a terminate_connection to not cleanup all LUN mappings (because Nova did not know of all the target_wwns that were actually mapped). This can be seen by enabling the flag, connecting a volume, disconnecting the volume and observing the stray LUN mappings under '/dev/disk/by-path'. Currently we do not have a way to limit the storage WWNNs which are mapped during a FC connection, so we will ignore the config to fix this broken behavior, and then remove the config next release. DocImpact Change-Id: I0019c1e0c0dbb0cd48a7f389376480e7fa1b1e07 Closes-Bug: #1516778 --- cinder/tests/unit/test_ibm_flashsystem.py | 1 - .../tests/unit/test_ibm_flashsystem_iscsi.py | 1 - cinder/tests/unit/test_storwize_svc.py | 88 ++----------------- .../volume/drivers/ibm/flashsystem_common.py | 3 +- cinder/volume/drivers/ibm/flashsystem_fc.py | 17 +--- .../drivers/ibm/storwize_svc/__init__.py | 29 ++---- .../ibm/storwize_svc/storwize_svc_common.py | 1 - 7 files changed, 20 insertions(+), 120 deletions(-) diff --git a/cinder/tests/unit/test_ibm_flashsystem.py b/cinder/tests/unit/test_ibm_flashsystem.py index ef560f2c4..70b82a858 100644 --- a/cinder/tests/unit/test_ibm_flashsystem.py +++ b/cinder/tests/unit/test_ibm_flashsystem.py @@ -723,7 +723,6 @@ class FlashSystemDriverTestCase(test.TestCase): 'san_login': 'username', 'san_password': 'password', 'flashsystem_connection_protocol': 'FC', - 'flashsystem_multipath_enabled': False, 'flashsystem_multihostmap_enabled': True} self.connector = { diff --git a/cinder/tests/unit/test_ibm_flashsystem_iscsi.py b/cinder/tests/unit/test_ibm_flashsystem_iscsi.py index 1d82edd9c..31b625ae9 100644 --- a/cinder/tests/unit/test_ibm_flashsystem_iscsi.py +++ b/cinder/tests/unit/test_ibm_flashsystem_iscsi.py @@ -116,7 +116,6 @@ class FlashSystemISCSIDriverTestCase(test.TestCase): 'san_login': 'username', 'san_password': 'password', 'flashsystem_connection_protocol': 'iSCSI', - 'flashsystem_multipath_enabled': False, 'flashsystem_multihostmap_enabled': True, 'iscsi_ip_address': '192.168.1.10', 'flashsystem_iscsi_portid': 1} diff --git a/cinder/tests/unit/test_storwize_svc.py b/cinder/tests/unit/test_storwize_svc.py index 76af4863a..5c43a9382 100644 --- a/cinder/tests/unit/test_storwize_svc.py +++ b/cinder/tests/unit/test_storwize_svc.py @@ -1745,7 +1745,6 @@ class StorwizeSVCDriverTestCase(test.TestCase): 'storwize_svc_flashcopy_timeout': 20, # Test ignore capitalization 'storwize_svc_connection_protocol': 'iScSi', - 'storwize_svc_multipath_enabled': False, 'storwize_svc_allow_tenant_qos': True} wwpns = [str(random.randint(0, 9999999999999999)).zfill(16), str(random.randint(0, 9999999999999999)).zfill(16)] @@ -1767,7 +1766,6 @@ class StorwizeSVCDriverTestCase(test.TestCase): 'storwize_svc_volpool_name': 'openstack', # Test ignore capitalization 'storwize_svc_connection_protocol': 'iScSi', - 'storwize_svc_multipath_enabled': False, 'storwize_svc_allow_tenant_qos': True, 'ssh_conn_timeout': 0} config_group = self.driver.configuration.config_group @@ -1947,7 +1945,6 @@ class StorwizeSVCDriverTestCase(test.TestCase): 'compression': False, 'easytier': True, 'protocol': 'iSCSI', - 'multipath': False, 'iogrp': 0, 'qos': None, 'replication': False, @@ -2340,7 +2337,7 @@ class StorwizeSVCDriverTestCase(test.TestCase): expected = {'FC': {'driver_volume_type': 'fibre_channel', 'data': {'target_lun': 0, - 'target_wwn': 'AABBCCDDEEFF0011', + 'target_wwn': ['AABBCCDDEEFF0011'], 'target_discovered': False}}, 'iSCSI': {'driver_volume_type': 'iscsi', 'data': {'target_discovered': False, @@ -3087,7 +3084,7 @@ class StorwizeSVCDriverTestCase(test.TestCase): self.assertIsNotNone(host_name) - def test_storwize_initiator_multiple_preferred_nodes_matching(self): + def test_storwize_initiator_multiple_wwpns_connected(self): # Generate us a test volume volume = self._create_volume() @@ -3110,83 +3107,16 @@ class StorwizeSVCDriverTestCase(test.TestCase): with mock.patch.object(storwize_svc_common.StorwizeHelpers, 'get_conn_fc_wwpns') as get_mappings: - get_mappings.return_value = ['AABBCCDDEEFF0001', - 'AABBCCDDEEFF0002', - 'AABBCCDDEEFF0010', - 'AABBCCDDEEFF0012'] + mapped_wwpns = ['AABBCCDDEEFF0001', 'AABBCCDDEEFF0002', + 'AABBCCDDEEFF0010', 'AABBCCDDEEFF0012'] + get_mappings.return_value = mapped_wwpns # Initialize the connection init_ret = self.driver.initialize_connection(volume, connector) - # Make sure we use the preferred WWPN. - self.assertEqual('AABBCCDDEEFF0010', - init_ret['data']['target_wwn']) - - def test_storwize_initiator_multiple_preferred_nodes_no_matching(self): - # Generate us a test volume - volume = self._create_volume() - - # Fibre Channel volume type - extra_spec = {'capabilities:storage_protocol': ' FC'} - vol_type = volume_types.create(self.ctxt, 'FC', extra_spec) - - volume['volume_type_id'] = vol_type['id'] - - # Make sure that the volumes have been created - self._assert_vol_exists(volume['name'], True) - - # Set up WWPNs that will not match what is available. - self.driver._state['storage_nodes']['1']['WWPN'] = ['123456789ABCDEF0', - '123456789ABCDEF1'] - - wwpns = ['ff00000000000000', 'ff00000000000001'] - connector = {'host': 'storwize-svc-test', 'wwpns': wwpns} - - with mock.patch.object(storwize_svc_common.StorwizeHelpers, - 'get_conn_fc_wwpns') as get_mappings: - get_mappings.return_value = ['AABBCCDDEEFF0001', - 'AABBCCDDEEFF0002', - 'AABBCCDDEEFF0010', - 'AABBCCDDEEFF0012'] - - # Initialize the connection - init_ret = self.driver.initialize_connection(volume, connector) - - # Make sure we use the first available WWPN. - self.assertEqual('AABBCCDDEEFF0001', - init_ret['data']['target_wwn']) - - def test_storwize_initiator_single_preferred_node_matching(self): - # Generate us a test volume - volume = self._create_volume() - - # Fibre Channel volume type - extra_spec = {'capabilities:storage_protocol': ' FC'} - vol_type = volume_types.create(self.ctxt, 'FC', extra_spec) - - volume['volume_type_id'] = vol_type['id'] - - # Make sure that the volumes have been created - self._assert_vol_exists(volume['name'], True) - - # Set up one WWPN. - self.driver._state['storage_nodes']['1']['WWPN'] = ['AABBCCDDEEFF0012'] - - wwpns = ['ff00000000000000', 'ff00000000000001'] - connector = {'host': 'storwize-svc-test', 'wwpns': wwpns} - - with mock.patch.object(storwize_svc_common.StorwizeHelpers, - 'get_conn_fc_wwpns') as get_mappings: - get_mappings.return_value = ['AABBCCDDEEFF0001', - 'AABBCCDDEEFF0002', - 'AABBCCDDEEFF0010', - 'AABBCCDDEEFF0012'] - - # Initialize the connection - init_ret = self.driver.initialize_connection(volume, connector) - - # Make sure we use the preferred WWPN. - self.assertEqual('AABBCCDDEEFF0012', + # Make sure we return all wwpns which where mapped as part of the + # connection + self.assertEqual(mapped_wwpns, init_ret['data']['target_wwn']) def test_storwize_terminate_connection(self): @@ -3238,7 +3168,7 @@ class StorwizeSVCDriverTestCase(test.TestCase): 'ff00000000000001': ['AABBCCDDEEFF0011']}, 'target_discovered': False, 'target_lun': 0, - 'target_wwn': 'AABBCCDDEEFF0011', + 'target_wwn': ['AABBCCDDEEFF0011'], 'volume_id': volume['id'] } } diff --git a/cinder/volume/drivers/ibm/flashsystem_common.py b/cinder/volume/drivers/ibm/flashsystem_common.py index 422b6bddc..bb06e3a5e 100644 --- a/cinder/volume/drivers/ibm/flashsystem_common.py +++ b/cinder/volume/drivers/ibm/flashsystem_common.py @@ -122,8 +122,7 @@ class FlashSystemDriver(san.SanDriver): 'err': six.text_type(err)})) def _build_default_params(self): - return {'protocol': self.configuration.flashsystem_connection_protocol, - 'multipath': self.configuration.flashsystem_multipath_enabled} + return {'protocol': self.configuration.flashsystem_connection_protocol} def _build_initiator_target_map(self, initiator_wwpns, target_wwpns): map = {} diff --git a/cinder/volume/drivers/ibm/flashsystem_fc.py b/cinder/volume/drivers/ibm/flashsystem_fc.py index 3f0a63cfe..f941d98c3 100644 --- a/cinder/volume/drivers/ibm/flashsystem_fc.py +++ b/cinder/volume/drivers/ibm/flashsystem_fc.py @@ -32,7 +32,7 @@ from oslo_utils import excutils import six from cinder import exception -from cinder.i18n import _, _LE, _LI, _LW +from cinder.i18n import _, _LE, _LI from cinder import utils import cinder.volume.driver from cinder.volume.drivers.ibm import flashsystem_common as fscommon @@ -44,8 +44,9 @@ LOG = logging.getLogger(__name__) flashsystem_fc_opts = [ cfg.BoolOpt('flashsystem_multipath_enabled', default=False, - help='Connect with multipath (FC only).' - '(Default is false.)') + help='This option no longer has any affect. It is deprecated ' + 'and will be removed in the next release.', + deprecated_for_removal=True) ] CONF = cfg.CONF @@ -187,17 +188,12 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver, 'enter: _get_vdisk_map_properties: vdisk ' '%(vdisk_name)s.', {'vdisk_name': vdisk_name}) - preferred_node = '0' IO_group = '0' - # Get preferred node and other nodes in I/O group - preferred_node_entry = None io_group_nodes = [] for k, node in self._storage_nodes.items(): if vdisk_params['protocol'] != node['protocol']: continue - if node['id'] == preferred_node: - preferred_node_entry = node if node['IO_group'] == IO_group: io_group_nodes.append(node) @@ -208,11 +204,6 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver, LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) - if not preferred_node_entry and not vdisk_params['multipath']: - # Get 1st node in I/O group - preferred_node_entry = io_group_nodes[0] - LOG.warning(_LW('_get_vdisk_map_properties: Did not find a ' - 'preferred node for vdisk %s.'), vdisk_name) properties = {} properties['target_discovered'] = False properties['target_lun'] = lun_id diff --git a/cinder/volume/drivers/ibm/storwize_svc/__init__.py b/cinder/volume/drivers/ibm/storwize_svc/__init__.py index 9c3e62066..f41a7d87b 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/__init__.py +++ b/cinder/volume/drivers/ibm/storwize_svc/__init__.py @@ -103,8 +103,9 @@ storwize_svc_opts = [ '(Default: Enabled)'), cfg.BoolOpt('storwize_svc_multipath_enabled', default=False, - help='Connect with multipath (FC only; iSCSI multipath is ' - 'controlled by Nova)'), + help='This option no longer has any affect. It is deprecated ' + 'and will be removed in the next release.', + deprecated_for_removal=True), cfg.BoolOpt('storwize_svc_multihostmap_enabled', default=True, help='Allows vdisk to multi host mapping'), @@ -408,7 +409,7 @@ class StorwizeSVCDriver(san.SanDriver, LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) - if not preferred_node_entry and not vol_opts['multipath']: + if not preferred_node_entry: # Get 1st node in I/O group preferred_node_entry = io_group_nodes[0] LOG.warning(_LW('initialize_connection: Did not find a ' @@ -445,25 +446,7 @@ class StorwizeSVCDriver(san.SanDriver, for node in self._state['storage_nodes'].values(): conn_wwpns.extend(node['WWPN']) - if not vol_opts['multipath']: - # preferred_node_entry can have a list of WWPNs while only - # one WWPN may be available on the storage host. Here we - # walk through the nodes until we find one that works, - # default to the first WWPN otherwise. - for WWPN in preferred_node_entry['WWPN']: - if WWPN in conn_wwpns: - properties['target_wwn'] = WWPN - break - else: - LOG.warning(_LW('Unable to find a preferred node match' - ' for node %(node)s in the list of ' - 'available WWPNs on %(host)s. ' - 'Using first available.'), - {'node': preferred_node, - 'host': host_name}) - properties['target_wwn'] = conn_wwpns[0] - else: - properties['target_wwn'] = conn_wwpns + properties['target_wwn'] = conn_wwpns i_t_map = self._make_initiator_target_map(connector['wwpns'], conn_wwpns) @@ -854,7 +837,7 @@ class StorwizeSVCDriver(san.SanDriver, 'diff': diff, 'host': host}) - ignore_keys = ['protocol', 'multipath'] + ignore_keys = ['protocol'] no_copy_keys = ['warning', 'autoexpand', 'easytier'] copy_keys = ['rsize', 'grainsize', 'compression'] all_keys = ignore_keys + no_copy_keys + copy_keys diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index c7050967d..c4370d0a8 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -737,7 +737,6 @@ class StorwizeHelpers(object): 'compression': config.storwize_svc_vol_compression, 'easytier': config.storwize_svc_vol_easytier, 'protocol': protocol, - 'multipath': config.storwize_svc_multipath_enabled, 'iogrp': config.storwize_svc_vol_iogrp, 'qos': None, 'stretched_cluster': cluster_partner, -- 2.45.2