From 1311d8e794f2409c701b8ebc6f4eb945d76cdb35 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Fri, 19 Jul 2024 15:16:16 +0300 Subject: [PATCH] HPE Nimble: Report thin provisioning correctly Report backend capability according to configured value, not hardcoded flag. Change-Id: I350e16ec3266bf3640a99188cebed5d6b1280087 --- .../unit/volume/drivers/hpe/test_nimble.py | 28 +++++++++++++++++++ cinder/volume/drivers/hpe/nimble.py | 7 +++-- ...-provisioning-actual-576a9a7669106c82.yaml | 5 ++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/nimnble-thin-provisioning-actual-576a9a7669106c82.yaml diff --git a/cinder/tests/unit/volume/drivers/hpe/test_nimble.py b/cinder/tests/unit/volume/drivers/hpe/test_nimble.py index 39e25cc5ef9..0fba131ae02 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_nimble.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_nimble.py @@ -1221,6 +1221,34 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase): expected_res, self.driver.get_volume_stats(refresh=True)) + @mock.patch(NIMBLE_URLLIB2) + @mock.patch(NIMBLE_CLIENT) + @mock.patch.object(obj_volume.VolumeList, 'get_all_by_host', + mock.Mock(return_value=[])) + @NimbleDriverBaseTestCase.client_mock_decorator(create_configuration( + 'nimble', 'nimble_pass', '10.18.108.55', 'default', '*', False)) + def test_get_volume_stats_no_thin_provisioning(self): + self.mock_client_service.get_group_info.return_value = ( + FAKE_POSITIVE_GROUP_INFO_RESPONSE) + exp_res = {'driver_version': DRIVER_VERSION, + 'vendor_name': 'Nimble', + 'volume_backend_name': 'NIMBLE', + 'storage_protocol': 'iSCSI', + 'pools': [{'pool_name': 'NIMBLE', + 'total_capacity_gb': 7466.30419921875, + 'free_capacity_gb': 94.16706105787307, + 'reserved_percentage': 0, + 'QoS_support': False, + 'multiattach': True, + 'max_over_subscription_ratio': 20.0, + 'thin_provisioning_support': False, + 'consistent_group_snapshot_enabled': True, + 'consistent_group_replication_enabled': False, + 'replication_enabled': False}]} + self.assertEqual( + exp_res, + self.driver.get_volume_stats(refresh=True)) + @mock.patch(NIMBLE_URLLIB2) @mock.patch(NIMBLE_CLIENT) @mock.patch.object(obj_volume.VolumeList, 'get_all_by_host', diff --git a/cinder/volume/drivers/hpe/nimble.py b/cinder/volume/drivers/hpe/nimble.py index 2437eb64e3a..2b8a78e5ac6 100644 --- a/cinder/volume/drivers/hpe/nimble.py +++ b/cinder/volume/drivers/hpe/nimble.py @@ -428,7 +428,10 @@ class NimbleBaseVolumeDriver(san.SanDriver): # Just use a single pool for now, FIXME to support multiple # pools mor = self.configuration.max_over_subscription_ratio - LOG.debug("mor: %(mor)s", {'mor': mor}) + thin_provisioning = self.configuration.san_thin_provision + LOG.debug("mor: %(mor)s, thin_provisioning: $(thin_provisioning)s", + {'mor': mor, 'thin_provisioning': thin_provisioning}) + single_pool = dict( pool_name=backend_name, total_capacity_gb=total_capacity, @@ -437,7 +440,7 @@ class NimbleBaseVolumeDriver(san.SanDriver): QoS_support=False, multiattach=True, max_over_subscription_ratio=mor, - thin_provisioning_support=True, + thin_provisioning_support=thin_provisioning, consistent_group_snapshot_enabled=True, consistent_group_replication_enabled=self._replicated_type, replication_enabled=self._replicated_type) diff --git a/releasenotes/notes/nimnble-thin-provisioning-actual-576a9a7669106c82.yaml b/releasenotes/notes/nimnble-thin-provisioning-actual-576a9a7669106c82.yaml new file mode 100644 index 00000000000..f0ea67d6a6b --- /dev/null +++ b/releasenotes/notes/nimnble-thin-provisioning-actual-576a9a7669106c82.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + HPE Nimble driver. Report thin provisioning capability + correctly according to backend configuration.