From 026dd9d34a3fa9bfc912cb350953aef64a6864a5 Mon Sep 17 00:00:00 2001 From: Alexander Deiter Date: Thu, 27 Apr 2023 15:50:30 +0000 Subject: [PATCH] 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 Change-Id: I6a33e4c85057bdf79530f9c9f24d867c49931310 --- .../unit/volume/drivers/test_infinidat.py | 5 ++-- cinder/volume/drivers/infinidat.py | 23 +++++++------------ .../drivers/infinidat-volume-driver.rst | 15 ++++++++---- ...-compression-setting-04eaf71933d55912.yaml | 16 +++++++++++++ 4 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/bug-2017815-infinidat-fix-compression-setting-04eaf71933d55912.yaml diff --git a/cinder/tests/unit/volume/drivers/test_infinidat.py b/cinder/tests/unit/volume/drivers/test_infinidat.py index c917e2e3ad6..1c12f1a1901 100644 --- a/cinder/tests/unit/volume/drivers/test_infinidat.py +++ b/cinder/tests/unit/volume/drivers/test_infinidat.py @@ -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", diff --git a/cinder/volume/drivers/infinidat.py b/cinder/volume/drivers/infinidat.py index edba38c0fef..c275fef8429 100644 --- a/cinder/volume/drivers/infinidat.py +++ b/cinder/volume/drivers/infinidat.py @@ -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) diff --git a/doc/source/configuration/block-storage/drivers/infinidat-volume-driver.rst b/doc/source/configuration/block-storage/drivers/infinidat-volume-driver.rst index f6e99d25f3a..c4de59049ec 100644 --- a/doc/source/configuration/block-storage/drivers/infinidat-volume-driver.rst +++ b/doc/source/configuration/block-storage/drivers/infinidat-volume-driver.rst @@ -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. diff --git a/releasenotes/notes/bug-2017815-infinidat-fix-compression-setting-04eaf71933d55912.yaml b/releasenotes/notes/bug-2017815-infinidat-fix-compression-setting-04eaf71933d55912.yaml new file mode 100644 index 00000000000..8f26841af58 --- /dev/null +++ b/releasenotes/notes/bug-2017815-infinidat-fix-compression-setting-04eaf71933d55912.yaml @@ -0,0 +1,16 @@ +--- +fixes: + - | + Infinidat driver `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.