Fix Infinidat driver to inherit compression

* Fixed Infinidat driver to inherit compression setting by default for
  all newly created volumes. Admin can set ``True`` or ``False`` for
  the ``infinidat_use_compression`` option in the driver section of
  cinder.conf to explicitly enable or disable compression setting for
  all newly created volumes. Or leave this option unset (commented out)
  for all created volumes to inherit their compression setting from
  their parent pool at creation time. The default value is unset.

* Removed support for pre-v3.0 InfiniBox systems that do not support
  compression. These versions are end of life and no longer supported
  for a long time

Closes-bug: #2017815
Signed-off-by: Alexander Deiter <adeiter@infinidat.com>
Change-Id: I6a33e4c85057bdf79530f9c9f24d867c49931310
This commit is contained in:
Alexander Deiter 2023-04-27 15:50:30 +00:00
parent 40147e2489
commit 026dd9d34a
4 changed files with 37 additions and 22 deletions

View File

@ -455,7 +455,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase):
)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_volume_compression_not_enabled(self, *mocks):
def test_create_volume_compression_disabled(self, *mocks):
self.override_config('infinidat_use_compression', False)
self.driver.create_volume(test_volume)
self.assertFalse(
@ -463,8 +463,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase):
)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_volume_compression_not_available(self, *mocks):
self._system.compat.has_compression.return_value = False
def test_create_volume_compression_default(self, *mocks):
self.driver.create_volume(test_volume)
self.assertNotIn(
"compression_enabled",

View File

@ -84,9 +84,11 @@ infinidat_opts = [
help='List of names of network spaces to use for iSCSI '
'connectivity'),
cfg.BoolOpt('infinidat_use_compression',
default=False,
help='Specifies whether to turn on compression for newly '
'created volumes.'),
help='Specifies whether to enable (true) or disable (false) '
'compression for all newly created volumes. Leave this '
'unset (commented out) for all created volumes to '
'inherit their compression setting from their parent '
'pool at creation time. The default value is unset.')
]
CONF = cfg.CONF
@ -188,15 +190,6 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
raise exception.VolumeDriverException(message=msg)
else:
self._protocol = constants.FC
if (self.configuration.infinidat_use_compression and
not self._system.compat.has_compression()):
# InfiniBox systems support compression only from v3.0 and up
msg = _('InfiniBox system does not support volume compression.\n'
'Compression is available on InfiniBox 3.0 onward.\n'
'Please disable volume compression by setting '
'infinidat_use_compression to False in the Cinder '
'configuration file.')
raise exception.VolumeDriverException(message=msg)
LOG.debug('setup complete')
def validate_connector(self, connector):
@ -644,9 +637,9 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
pool=pool,
provtype=provtype,
size=size)
if self._system.compat.has_compression():
create_kwargs["compression_enabled"] = (
self.configuration.infinidat_use_compression)
compression_enabled = self.configuration.infinidat_use_compression
if compression_enabled is not None:
create_kwargs["compression_enabled"] = compression_enabled
infinidat_volume = self._system.volumes.create(**create_kwargs)
self._set_qos(volume, infinidat_volume)
self._set_cinder_object_metadata(infinidat_volume, volume)

View File

@ -180,14 +180,21 @@ Configure the driver back-end section with the parameters below.
* Volume compression
Volume compression is disabled by default.
To enable volume compression, add the following parameter:
Volume compression is available for all supported InfiniBox versions.
By default, compression for all newly created volumes is inherited from
its parent pool at creation time. All pools are created by default with
compression enabled.
To explicitly enable or disable compression for all newly created volumes,
add the following configuration parameter:
.. code-block:: ini
infinidat_use_compression = true
infinidat_use_compression = true/false
Volume compression is available on InfiniBox 3.0 onward.
Or leave this configuration parameter unset (commented out) for all
created volumes to inherit their compression setting from their parent
pool at creation time. The default value is unset.
After modifying the ``cinder.conf`` file, restart the ``cinder-volume``
service.

View File

@ -0,0 +1,16 @@
---
fixes:
- |
Infinidat driver `bug #2017815
<https://bugs.launchpad.net/cinder/+bug/2017815>`_:
Fixed Infinidat driver to inherit compression setting by default for
all newly created volumes. Admin can set ``True`` or ``False`` for
the ``infinidat_use_compression`` option in the driver section
of ``cinder.conf`` to explicitly enable or disable compression setting
for all newly created volumes. Or leave this option unset (commented out)
for all created volumes to inherit their compression setting from their
parent pool at creation time. The default value is unset.
upgrade:
- |
Infinidat driver: support has been removed for pre-v3.0 InfiniBox systems.
These versions are end of life and have not been supported for a long time.