Merge "lightbits: add qos support"

This commit is contained in:
Zuul 2025-02-18 20:39:14 +00:00 committed by Gerrit Code Review
commit 3e7e62dddd
3 changed files with 43 additions and 12 deletions

View File

@ -339,6 +339,7 @@ class LightOSStorageVolumeDriverTest(test.TestCase):
"acl": {'values': kwargs.get('acl')},
"IPAcl": ipacl,
"state": "Available",
"qosPolicyUUID": kwargs.get("qos_policy", None)
}
volume["ETag"] = get_vol_etag(volume)
code, new_vol = self.db.create_volume(volume)
@ -577,11 +578,11 @@ class LightOSStorageVolumeDriverTest(test.TestCase):
volume_type_id=vol_type2.id)
volume3 = test_utils.create_volume(self.ctxt, size=4,
volume_type_id=vol_type3.id)
compression, _, _ = self.driver._get_volume_specs(volume1)
compression, _, _, _ = self.driver._get_volume_specs(volume1)
self.assertTrue(compression == "True")
compression, _, _ = self.driver._get_volume_specs(volume2)
compression, _, _, _ = self.driver._get_volume_specs(volume2)
self.assertTrue(compression == "True")
compression, _, _ = self.driver._get_volume_specs(volume3)
compression, _, _, _ = self.driver._get_volume_specs(volume3)
self.assertTrue(compression == "False")
db.volume_destroy(self.ctxt, volume1.id)
@ -610,11 +611,11 @@ class LightOSStorageVolumeDriverTest(test.TestCase):
volume_type_id=vol_type2.id)
volume3 = test_utils.create_volume(self.ctxt, size=4,
volume_type_id=vol_type3.id)
compression, _, _ = self.driver._get_volume_specs(volume1)
compression, _, _, _ = self.driver._get_volume_specs(volume1)
self.assertTrue(compression == "False")
compression, _, _ = self.driver._get_volume_specs(volume2)
compression, _, _, _ = self.driver._get_volume_specs(volume2)
self.assertTrue(compression == "False")
compression, _, _ = self.driver._get_volume_specs(volume3)
compression, _, _, _ = self.driver._get_volume_specs(volume3)
self.assertTrue(compression == "True")
db.volume_destroy(self.ctxt, volume1.id)
@ -988,7 +989,7 @@ class LightOSStorageVolumeDriverTest(test.TestCase):
assert volumes_data['reserved_percentage'] == RESERVED_PERCENTAGE, \
"Expected %d, received %s" % \
(RESERVED_PERCENTAGE, volumes_data['reserved_percentage'])
assert volumes_data['QoS_support'] is False, \
assert volumes_data['QoS_support'] is True, \
"Expected False, received %s" % volumes_data['QoS_support']
assert volumes_data['online_extend_support'] is True, \
"Expected True, received %s" % \

View File

@ -251,6 +251,9 @@ class LightOSConnection(object):
kwargs.get("snapshot_name")),
{})
}
if kwargs.get("qos_policy", None) is not None:
lightos_commands['create_volume'][2]['qosPolicyUUID'] = \
str(kwargs.get("qos_policy"))
if cmd not in lightos_commands:
raise exception.UnknownCmd(cmd=cmd)
else:
@ -609,10 +612,11 @@ class LightOSVolumeDriver(driver.VolumeDriver):
compression = self._parse_extra_spec(type_compression,
default_compression)
num_replicas = str(specs.get('lightos:num_replicas', num_replicas))
qos_policy = specs.get('lightos:qos_policy', None)
project_name = specs.get(
'lightos:project_name',
LIGHTOS_DEFAULT_PROJECT_NAME)
return (compression, num_replicas, project_name)
return (compression, num_replicas, project_name, qos_policy)
def _create_new_lightos_volume(self,
os_volume,
@ -620,7 +624,8 @@ class LightOSVolumeDriver(driver.VolumeDriver):
lightos_name,
src_snapshot_lightos_name=None):
"""Create a new LightOS volume for this openstack volume."""
(compression, num_replicas, _) = self._get_volume_specs(os_volume)
(compression, num_replicas, _, qos_policy) = \
self._get_volume_specs(os_volume)
vol_ipAcl = ['ALLOW_NONE'] if self.use_ip_acl() else ['ALLOW_ANY']
return self.cluster.send_cmd(
cmd='create_volume',
@ -632,8 +637,8 @@ class LightOSVolumeDriver(driver.VolumeDriver):
compression=compression,
src_snapshot_name=src_snapshot_lightos_name,
acl=['ALLOW_NONE'],
ip_acl=vol_ipAcl
)
ip_acl=vol_ipAcl,
qos_policy=qos_policy)
def _get_lightos_uuid(self, project_name, volume):
lightos_name = self._lightos_volname(volume)
@ -1025,7 +1030,7 @@ class LightOSVolumeDriver(driver.VolumeDriver):
'driver_version': self.VERSION,
'storage_protocol': constants.LIGHTOS,
'reserved_percentage': res_percentage,
'QoS_support': False,
'QoS_support': True,
'online_extend_support': True,
'thin_provisioning_support': True,
'compression': [True, False],
@ -1622,6 +1627,15 @@ class LightOSVolumeDriver(driver.VolumeDriver):
minimum=1,
maximun=3,
default=3)
self._set_property(
properties,
"lightos:qos_policy",
"Lightbits volume QoS policy UUID",
_(
"Specifies the Lightbits volume QoS policy UUID to use for \
the LightOS volume."),
"string",
default=None)
return properties, 'lightos'

View File

@ -0,0 +1,16 @@
---
features:
- |
Lightbits driver: allows administrators to better manage and optimize
storage performance by associating QoS policies with volume types.
* Administrators must first create the required QoS policy on the vendor
side.
* Once the QoS policy is created, it can be linked to a volume type in
the system using the policy's unique UUID.
Example:
.. code-block:: bash
openstack volume type create LightbitsWithQos --property volume_backend_name=<backend_name> --property=lightos:qos_policy=<uuid>