Merge "Nimble: Report max_oversubscription_ratio via backend capabilities"

This commit is contained in:
Zuul 2024-11-15 18:44:09 +00:00 committed by Gerrit Code Review
commit a0eb7ee9a7
3 changed files with 18 additions and 4 deletions

View File

@ -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))

View File

@ -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,

View File

@ -0,0 +1,5 @@
---
fixes:
- |
HPE Nimble: Report max oversubscription ratio according to backend
configuration ``max_over_subscription_ratio``