diff --git a/cinder/tests/unit/volume/drivers/test_infinidat.py b/cinder/tests/unit/volume/drivers/test_infinidat.py index 76cd068fbd5..ea6785869c2 100644 --- a/cinder/tests/unit/volume/drivers/test_infinidat.py +++ b/cinder/tests/unit/volume/drivers/test_infinidat.py @@ -48,7 +48,7 @@ class InfiniboxDriverTestCaseBase(test.TestCase): self.configuration.infinidat_storage_protocol = 'fc' self.configuration.san_ip = 'mockbox' self.configuration.infinidat_pool_name = 'mockpool' - self.configuration.san_thin_provision = 'thin' + self.configuration.san_thin_provision = True self.configuration.san_login = 'user' self.configuration.san_password = 'pass' self.configuration.volume_backend_name = 'mock' @@ -60,6 +60,7 @@ class InfiniboxDriverTestCaseBase(test.TestCase): self.configuration.chap_username = None self.configuration.chap_password = None self.configuration.infinidat_use_compression = None + self.configuration.max_over_subscription_ratio = 10.0 self.driver = infinidat.InfiniboxVolumeDriver( configuration=self.configuration) @@ -190,6 +191,13 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.assertRaises(exception.VolumeDriverException, self.driver.get_volume_stats) + def test_get_volume_stats_max_over_subscription_ratio(self): + result = self.driver.get_volume_stats() + # check the defaults defined in setUp + self.assertEqual(10.0, result['max_over_subscription_ratio']) + self.assertTrue(result['thin_provisioning_support']) + self.assertFalse(result['thick_provisioning_support']) + @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") def test_create_volume(self, *mocks): self.driver.create_volume(test_volume) diff --git a/cinder/volume/drivers/infinidat.py b/cinder/volume/drivers/infinidat.py index bc211d0f913..054b881c2ab 100644 --- a/cinder/volume/drivers/infinidat.py +++ b/cinder/volume/drivers/infinidat.py @@ -441,6 +441,8 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver): total_capacity_gb = float(physical_capacity_bytes) / units.Gi qos_support = (hasattr(self._system.compat, "has_qos") and self._system.compat.has_qos()) + max_osr = self.configuration.max_over_subscription_ratio + thin = self.configuration.san_thin_provision self._volume_stats = dict(volume_backend_name=self._backend_name, vendor_name=VENDOR_NAME, driver_version=self.VERSION, @@ -449,7 +451,10 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver): total_capacity_gb=total_capacity_gb, free_capacity_gb=free_capacity_gb, consistent_group_snapshot_enabled=True, - QoS_support=qos_support) + QoS_support=qos_support, + thin_provisioning_support=thin, + thick_provisioning_support=not thin, + max_over_subscription_ratio=max_osr) return self._volume_stats def _create_volume(self, volume): diff --git a/releasenotes/notes/infinidat-max-osr-2d9fd2d0f9424657.yaml b/releasenotes/notes/infinidat-max-osr-2d9fd2d0f9424657.yaml new file mode 100644 index 00000000000..b37419ee6b2 --- /dev/null +++ b/releasenotes/notes/infinidat-max-osr-2d9fd2d0f9424657.yaml @@ -0,0 +1,5 @@ +--- +features: + - Added support for oversubscription in thin provisioning in the INFINIDAT + InfiniBox driver. To use oversubscription, define + ``max_over_subscription_ratio`` in the cinder configuration file.