From bc2c4cc9c80a5ed19354b2c8a903dfb2b5abad4d Mon Sep 17 00:00:00 2001 From: Keerthivasan S Date: Thu, 20 Mar 2025 01:35:54 -0400 Subject: [PATCH] [Pure Storage] Fix QoS setting for cloned volumes Volumes created from glance images on the source FlashArray using volume cloning are not being assigned the correct QoS specifications associated with the requested volume type. This patch resolves that issue. Closes-Bug: #2100547 Change-Id: Ic302492b624a91b56143724eeaa4a85608cb1911 --- cinder/tests/unit/volume/drivers/test_pure.py | 45 +++++++++++++++++++ cinder/volume/drivers/pure.py | 5 +++ .../pure_fix_clone_qos-4b80be464b506e4c.yaml | 7 +++ 3 files changed, 57 insertions(+) create mode 100644 releasenotes/notes/pure_fix_clone_qos-4b80be464b506e4c.yaml diff --git a/cinder/tests/unit/volume/drivers/test_pure.py b/cinder/tests/unit/volume/drivers/test_pure.py index 2af9bb4c3c1..ea0806032bd 100644 --- a/cinder/tests/unit/volume/drivers/test_pure.py +++ b/cinder/tests/unit/volume/drivers/test_pure.py @@ -2074,6 +2074,51 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase): self.driver.create_cloned_volume, vol, src_vol) self.assertFalse(self.array.extend_volume.called) + # Tests cloning a volume that is not replicated type with QoS + @ddt.data( + { + "qos_name": "qos-iops-bws", + "qos_spec": dict(QOS_IOPS_BWS), + "qos_data": {"iops_limit": '100', "bandwidth_limit": '1048576'} + }, + { + "qos_name": "qos-iops", + "qos_spec": dict(QOS_IOPS), + "qos_data": {"iops_limit": '100'} + }, + { + "qos_name": "qos-bws", + "qos_spec": dict(QOS_BWS), + "qos_data": {"bandwidth_limit": '1048576'} + }, + ) + @mock.patch(BASE_DRIVER_OBJ + "._get_qos_settings") + @mock.patch(BASE_DRIVER_OBJ + ".set_qos") + @mock.patch(DRIVER_PATH + ".flasharray.VolumePost") + def test_create_cloned_volume_qos(self, qos_info, + mock_fa, + mock_qos, + mock_qos_specs): + ctxt = context.get_admin_context() + qos = qos_specs.create(ctxt, + qos_info["qos_name"], + qos_info["qos_spec"]) + qos_data = self.flasharray.Qos(**qos_info["qos_data"]) + vol, vol_name = self.new_fake_vol(set_provider_id=False) + src_vol, src_name = self.new_fake_vol(spec={"size": 1}, + type_qos_specs_id=qos.id) + mock_data = self.array.flasharray.VolumePost(names=[vol_name], + source= + pure.flasharray. + reference(name=src_name), + qos=qos_data) + mock_fa.return_value = mock_data + mock_qos_specs.return_value = qos + self.mock_object(self.driver, '_get_volume_type_extra_spec', + return_value={}) + self.driver.create_cloned_volume(vol, src_vol) + self.driver.set_qos.assert_called_with(self.array, vol_name, qos) + @mock.patch(DRIVER_PATH + ".flasharray.VolumePost") def test_create_cloned_volume_sync_rep(self, mock_fa): repl_extra_specs = { diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index ae98e6a151d..0cc06265170 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -938,6 +938,11 @@ class PureBaseVolumeDriver(san.SanDriver): vol_name, src_vref["size"], volume["size"]) + # Check if the volume_type has QoS settings and if so + # apply them to the newly created volume + qos = self._get_qos_settings(volume.volume_type) + if qos: + self.set_qos(current_array, vol_name, qos) return self._setup_volume(current_array, volume, vol_name) diff --git a/releasenotes/notes/pure_fix_clone_qos-4b80be464b506e4c.yaml b/releasenotes/notes/pure_fix_clone_qos-4b80be464b506e4c.yaml new file mode 100644 index 00000000000..fe737ee343f --- /dev/null +++ b/releasenotes/notes/pure_fix_clone_qos-4b80be464b506e4c.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Pure Storage driver `bug #2100547 + `_: Fixed issue where + volumes created as clones from a source image volume did not get + the defined QoS settings associated with the volume type used.