From dbde6a3cad318ad8a9e23e23184bccb442b069aa Mon Sep 17 00:00:00 2001 From: rajinir Date: Mon, 2 Oct 2017 10:51:48 -0500 Subject: [PATCH] Dell EMC PS: Optimize parsing of capacity info from backend The backend api returns large amounts of information and times out when there are lots of volumes. Accelerated the process by terminating the parsing after the capacity info is retrieved. Closes Bug: #1661154 Change-Id: I1f0adaa8e25cd3ec74084b22bbe1573b92713959 (cherry picked from commit a9a0c2ee2e973d0594f2707d64846e882e179c94) --- cinder/volume/drivers/dell_emc/ps.py | 18 ++++++++++++++---- .../ps-optimize-parsing-8aa447c50f2474c7.yaml | 5 +++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/ps-optimize-parsing-8aa447c50f2474c7.yaml diff --git a/cinder/volume/drivers/dell_emc/ps.py b/cinder/volume/drivers/dell_emc/ps.py index f16d10c26fd..2c03574f340 100644 --- a/cinder/volume/drivers/dell_emc/ps.py +++ b/cinder/volume/drivers/dell_emc/ps.py @@ -137,9 +137,11 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver): 1.4.1 - Rebranded driver to Dell EMC. 1.4.2 - Enable report discard support. 1.4.2a - Fixed over-subscription ratio calculation + 1.4.2b - Optimize volume stats information parsing + """ - VERSION = "1.4.2a" + VERSION = "1.4.2b" # ThirdPartySytems wiki page CI_WIKI_NAME = "Dell_Storage_CI" @@ -299,12 +301,13 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver): data['reserved_percentage'] = 0 data['QoS_support'] = False - data['total_capacity_gb'] = 0 - data['free_capacity_gb'] = 0 + data['total_capacity_gb'] = None + data['free_capacity_gb'] = None data['multiattach'] = False - provisioned_capacity = 0 + data['total_volumes'] = None + provisioned_capacity = None for line in self._eql_execute('pool', 'select', self.configuration.eqlx_pool, 'show'): if line.startswith('TotalCapacity:'): @@ -316,6 +319,13 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver): if line.startswith('VolumeReportedSpace:'): out_tup = line.rstrip().partition(' ') provisioned_capacity = self._get_space_in_gb(out_tup[-1]) + if line.startswith('TotalVolumes:'): + out_tup = line.rstrip().partition(' ') + data['total_volumes'] = int(out_tup[-1]) + # Terminate parsing once this data is found to improve performance + if (data['total_capacity_gb'] and data['free_capacity_gb'] and + provisioned_capacity and data['total_volumes']): + break global_capacity = data['total_capacity_gb'] global_free = data['free_capacity_gb'] diff --git a/releasenotes/notes/ps-optimize-parsing-8aa447c50f2474c7.yaml b/releasenotes/notes/ps-optimize-parsing-8aa447c50f2474c7.yaml new file mode 100644 index 00000000000..6760394144a --- /dev/null +++ b/releasenotes/notes/ps-optimize-parsing-8aa447c50f2474c7.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Dell EMC PS Series Driver code reporting volume stats is now optimized + to return the information earlier and accelerate the process. This change + fixes bug 1661154.