diff --git a/cinder/tests/unit/volume/drivers/hpe/test_nimble.py b/cinder/tests/unit/volume/drivers/hpe/test_nimble.py index 16a5d348640..39e25cc5ef9 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_nimble.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_nimble.py @@ -278,7 +278,8 @@ REPL_DEVICES = [{ def create_configuration(username, password, ip_address, pool_name=None, subnet_label=None, - thin_provision=True, devices=None): + thin_provision=True, devices=None, + max_over_subscription_ratio=20.0): configuration = mock.Mock() configuration.san_login = username configuration.san_password = password @@ -288,6 +289,7 @@ def create_configuration(username, password, ip_address, configuration.nimble_subnet_label = subnet_label configuration.safe_get.return_value = 'NIMBLE' configuration.replication_device = devices + configuration.max_over_subscription_ratio = max_over_subscription_ratio return configuration @@ -1194,7 +1196,8 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase): @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', '*')) + 'nimble', 'nimble_pass', '10.18.108.55', 'default', '*', True, + None, 15.0)) def test_get_volume_stats(self): self.mock_client_service.get_group_info.return_value = ( FAKE_POSITIVE_GROUP_INFO_RESPONSE) @@ -1212,7 +1215,8 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase): 'consistent_group_snapshot_enabled': True, 'replication_enabled': False, 'consistent_group_replication_enabled': - False}]} + False, + 'max_over_subscription_ratio': 15.0}]} self.assertEqual( expected_res, self.driver.get_volume_stats(refresh=True)) diff --git a/cinder/volume/drivers/hpe/nimble.py b/cinder/volume/drivers/hpe/nimble.py index e3e7eb4c621..2437eb64e3a 100644 --- a/cinder/volume/drivers/hpe/nimble.py +++ b/cinder/volume/drivers/hpe/nimble.py @@ -158,7 +158,9 @@ class NimbleBaseVolumeDriver(san.SanDriver): @staticmethod def get_driver_options(): - return nimble_opts + additional_opts = driver.BaseVD._get_oslo_driver_opts( + 'max_over_subscription_ratio') + return nimble_opts + additional_opts def _check_config(self): """Ensure that the flags we care about are set.""" @@ -425,6 +427,8 @@ class NimbleBaseVolumeDriver(san.SanDriver): 'storage_protocol': self._storage_protocol} # 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}) single_pool = dict( pool_name=backend_name, total_capacity_gb=total_capacity, @@ -432,6 +436,7 @@ class NimbleBaseVolumeDriver(san.SanDriver): reserved_percentage=0, QoS_support=False, multiattach=True, + max_over_subscription_ratio=mor, thin_provisioning_support=True, consistent_group_snapshot_enabled=True, consistent_group_replication_enabled=self._replicated_type, diff --git a/releasenotes/notes/nimble-max-oversubscription-ratio-1d9812954f824fcf.yaml b/releasenotes/notes/nimble-max-oversubscription-ratio-1d9812954f824fcf.yaml new file mode 100644 index 00000000000..642811801b0 --- /dev/null +++ b/releasenotes/notes/nimble-max-oversubscription-ratio-1d9812954f824fcf.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + HPE Nimble: Report max oversubscription ratio according to backend + configuration ``max_over_subscription_ratio``