From e6ad644046b441f041afaab177936b9d50c3dd36 Mon Sep 17 00:00:00 2001 From: GirishChilukuri Date: Mon, 8 Mar 2021 10:03:31 +0000 Subject: [PATCH] [SVF]:Bulk create Hyperswap volume is failing. [Spectrum Virtualize Family] During HyperSwap create volume there is multiple lsmdiskgrp calls, which is causing more concurrent calls on SVC. This patch fixes the issue by caching the site information during initialization and checking for HyperSwap pool site information. Closes-Bug: #1917605 Change-Id: I3f734e55efeabcfdeca4c4f3e87bc4a5a0481875 --- .../volume/drivers/ibm/test_storwize_svc.py | 20 ++++++++----- .../ibm/storwize_svc/storwize_svc_common.py | 29 +++++++++++++++++-- ...ap_volume_is_failing-79a9ec2108612240.yaml | 7 +++++ 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/bug-1917605-ibm-svf_Bulk_create_Hyperswap_volume_is_failing-79a9ec2108612240.yaml diff --git a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py index 179fe3b3d9e..4662348268f 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py @@ -537,7 +537,7 @@ class StorwizeSVCManagementSimulator(object): 'vdisk_count', 'capacity', 'extent_size', 'free_capacity', 'virtual_capacity', 'used_capacity', 'real_capacity', 'overallocation', 'warning', - 'easy_tier', 'easy_tier_status', 'site_id', + 'easy_tier', 'easy_tier_status', 'site_id', 'site_name', 'data_reduction']) for i in range(pool_num): row_data = [str(i + 1), @@ -546,32 +546,36 @@ class StorwizeSVCManagementSimulator(object): '3573412790272', '256', '3529926246400', '1693247906775', '26843545600', '38203734097', '47', '80', 'auto', - 'inactive', '', 'no'] + 'inactive', '', '', 'no'] rows.append(row_data) rows.append([str(pool_num + 1), 'openstack2', 'online', '1', '0', '3573412790272', '256', '3529432325160', '1693247906775', '26843545600', - '38203734097', '47', '80', 'auto', 'inactive', '', 'no']) + '38203734097', '47', '80', 'auto', 'inactive', '', '', + 'no']) rows.append([str(pool_num + 2), 'openstack3', 'offline', '1', '0', '3573412790272', '128', '3529432325160', '1693247906775', '26843545600', - '38203734097', '47', '80', 'auto', 'inactive', '', 'yes']) + '38203734097', '47', '80', 'auto', 'inactive', '', '', + 'yes']) rows.append([str(pool_num + 3), 'hyperswap1', 'online', '1', '0', '3573412790272', '256', '3529432325160', '1693247906775', '26843545600', - '38203734097', '47', '80', 'auto', 'inactive', '1', 'no']) + '38203734097', '47', '80', 'auto', 'inactive', '1', + 'site1', 'no']) rows.append([str(pool_num + 4), 'hyperswap2', 'online', '1', '0', '3573412790272', '128', '3529432325160', '1693247906775', '26843545600', - '38203734097', '47', '80', 'auto', 'inactive', '2', 'no']) + '38203734097', '47', '80', 'auto', 'inactive', '2', + 'site2', 'no']) rows.append([str(pool_num + 5), 'dr_pool1', 'online', '1', '0', '3573412790272', '128', '3529432325160', '1693247906775', '26843545600', '38203734097', '47', '80', - 'auto', 'inactive', '1', 'yes']) + 'auto', 'inactive', '1', 'site1', 'yes']) rows.append([str(pool_num + 6), 'dr_pool2', 'online', '1', '0', '3573412790272', '128', '3529432325160', '1693247906775', '26843545600', '38203734097', '47', '80', - 'auto', 'inactive', '2', 'yes']) + 'auto', 'inactive', '2', 'site2', 'yes']) if 'obj' not in kwargs: return self._print_info_cmd(rows=rows, **kwargs) else: 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 20b9c76ee4a..40b40123166 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -2649,8 +2649,19 @@ class StorwizeHelpers(object): raise exception.InvalidInput( reason=_('The peer pool is necessary for hyperswap volume, ' 'please configure the peer pool.')) - pool_attr = self.get_pool_attrs(pool) - peer_pool_attr = self.get_pool_attrs(peer_pool) + pool_attr = None + peer_pool_attr = None + for stat_pool in self.stats.get('pools', []): + if stat_pool['pool_name'] == pool: + pool_attr = stat_pool + elif stat_pool['pool_name'] == peer_pool: + peer_pool_attr = stat_pool + + if pool_attr is None: + pool_attr = self.get_pool_attrs(pool) + if peer_pool_attr is None: + peer_pool_attr = self.get_pool_attrs(peer_pool) + if not peer_pool_attr: raise exception.InvalidInput( reason=_('The hyperswap peer pool %s ' @@ -2970,6 +2981,10 @@ class StorwizeSVCCommonDriver(san.SanDriver, self._secondary_pools = [self._replica_target.get('pool_name')] return self._secondary_pools + def _get_backend_peer_pool(self): + if not self._active_backend_id: + return self.configuration.storwize_peer_pool + def _validate_pools_exist(self): # Validate that the pool exists pools = self._get_backend_pools() @@ -5695,6 +5710,12 @@ class StorwizeSVCCommonDriver(san.SanDriver, data['pools'] = [self._build_pool_stats(pool) for pool in self._get_backend_pools()] + + if self._helpers.is_system_topology_hyperswap(self._state): + peer_pool = self._get_backend_peer_pool() + if peer_pool: + data['pools'].append(self._build_pool_stats(peer_pool)) + if self._replica_enabled: data['replication'] = self._replica_enabled data['replication_enabled'] = self._replica_enabled @@ -5758,6 +5779,8 @@ class StorwizeSVCCommonDriver(san.SanDriver, 'consistent_group_snapshot_enabled': True, 'backend_state': backend_state, 'data_reduction': is_dr_pool, + 'site_id': pool_data['site_id'], + 'site_name': pool_data['site_name'], } if self._replica_enabled: pool_stats.update({ @@ -5780,6 +5803,8 @@ class StorwizeSVCCommonDriver(san.SanDriver, 'max_over_subscription_ratio': 0, 'reserved_percentage': 0, 'data_reduction': is_dr_pool, + 'site_id': None, + 'site_name': None, 'backend_state': 'down'} return pool_stats diff --git a/releasenotes/notes/bug-1917605-ibm-svf_Bulk_create_Hyperswap_volume_is_failing-79a9ec2108612240.yaml b/releasenotes/notes/bug-1917605-ibm-svf_Bulk_create_Hyperswap_volume_is_failing-79a9ec2108612240.yaml new file mode 100644 index 00000000000..0110f7a1cc6 --- /dev/null +++ b/releasenotes/notes/bug-1917605-ibm-svf_Bulk_create_Hyperswap_volume_is_failing-79a9ec2108612240.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + IBM Spectrum Virtualize Family driver `Bug #1917605 + `_: Fixed issue + in StorwizeSVCCommonDriver to save site and peer pool information + in stats during initialization.