From a8a4518580d321604fbd54a04996aba9ee02cb25 Mon Sep 17 00:00:00 2001 From: rajinir Date: Thu, 31 Aug 2017 14:23:18 -0500 Subject: [PATCH] Dell EMC PS: Report total volumes on the backend Adds support to report total_volumes in the volume stats. Total number of volumes on the storage backend can be used in custom driver filter functions. Change-Id: I4dcbfada009efa4157558967dce3272c641ed324 Implements: blueprint ps-report-total-volumes Closes-Bug: #1714338 --- cinder/tests/unit/volume/drivers/dell_emc/test_ps.py | 4 +++- cinder/volume/drivers/dell_emc/ps.py | 7 ++++++- .../notes/ps-report-total-volumes-8aa447c50f2474a7.yaml | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/ps-report-total-volumes-8aa447c50f2474a7.yaml diff --git a/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py b/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py index 0ddccc8d200..43c48749f87 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py @@ -58,7 +58,8 @@ class PSSeriesISCSIDriverTestCase(test.TestCase): self.driver_stats_output = ['TotalCapacity: 111GB', 'FreeSpace: 11GB', - 'VolumeReserve: 80GB'] + 'VolumeReserve: 80GB', + 'TotalVolumes: 100'] self.cmd = 'this is dummy command' self._context = context.get_admin_context() self.driver = ps.PSSeriesISCSIDriver( @@ -410,6 +411,7 @@ class PSSeriesISCSIDriverTestCase(test.TestCase): thin_enabled = self.configuration.san_thin_provision self.assertEqual(float('111.0'), stats['total_capacity_gb']) self.assertEqual(float('11.0'), stats['free_capacity_gb']) + self.assertEqual(100, stats['total_volumes']) if thin_enabled: self.assertEqual(80.0, stats['provisioned_capacity_gb']) diff --git a/cinder/volume/drivers/dell_emc/ps.py b/cinder/volume/drivers/dell_emc/ps.py index 09b12064c6a..a6d7fb1d440 100644 --- a/cinder/volume/drivers/dell_emc/ps.py +++ b/cinder/volume/drivers/dell_emc/ps.py @@ -136,10 +136,11 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver): eqlx_chap_login, and eqlx_chap_password. 1.4.1 - Rebranded driver to Dell EMC. 1.4.2 - Enable report discard support. + 1.4.3 - Report total_volumes in volume stats """ - VERSION = "1.4.2" + VERSION = "1.4.3" # ThirdPartySytems wiki page CI_WIKI_NAME = "Dell_Storage_CI" @@ -302,6 +303,7 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver): data['total_capacity_gb'] = 0 data['free_capacity_gb'] = 0 data['multiattach'] = False + data['total_volumes'] = 0 provisioned_capacity = 0 @@ -316,6 +318,9 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver): if line.startswith('VolumeReserve:'): 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]) global_capacity = data['total_capacity_gb'] global_free = data['free_capacity_gb'] diff --git a/releasenotes/notes/ps-report-total-volumes-8aa447c50f2474a7.yaml b/releasenotes/notes/ps-report-total-volumes-8aa447c50f2474a7.yaml new file mode 100644 index 00000000000..68d852b5bb7 --- /dev/null +++ b/releasenotes/notes/ps-report-total-volumes-8aa447c50f2474a7.yaml @@ -0,0 +1,4 @@ +--- +features: + - Dell EMC PS volume driver reports the total number + of volumes on the backend in volume stats.