From 52a7d601a0c97ab4eb47b9bf10da19a9f61afe25 Mon Sep 17 00:00:00 2001 From: Jim Branen Date: Tue, 4 Mar 2014 16:38:41 -0800 Subject: [PATCH] Fix HP LeftHand Performance issue with AO MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Setting AdaptiveOptimization (AO) to ‘true’, the default value, at volume create time significantly slows down the operation on the LeftHand array. If at create time, AO is set to ‘true’, it will result in an update operation following the create operation to set this value. Therefore, it is best to not specify the value, when ‘true’, and let it default to ‘true’. Change-Id: I2c8860e3f25a7bcaa2d2efefeffc1c11319f33e2 Closes-Bug:#1285925 --- cinder/tests/test_hplefthand.py | 64 +++++++++++++++++++ .../drivers/san/hp/hp_lefthand_rest_proxy.py | 13 +++- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/cinder/tests/test_hplefthand.py b/cinder/tests/test_hplefthand.py index 36428c564..040ad86bf 100644 --- a/cinder/tests/test_hplefthand.py +++ b/cinder/tests/test_hplefthand.py @@ -1300,3 +1300,67 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase): self.assertEqual( len(expected), len(mock_client.method_calls)) + + @mock.patch.object(volume_types, 'get_volume_type', + return_value={'extra_specs': {'hplh:ao': 'true'}}) + def test_create_volume_with_ao_true(self, _mock_volume_type): + + # setup drive with default configuration + # and return the mock HTTP LeftHand client + mock_client = self.setup_driver() + + volume_with_vt = self.volume + volume_with_vt['volume_type_id'] = 1 + + # mock return value of createVolume + mock_client.createVolume.return_value = { + 'iscsiIqn': self.connector['initiator']} + + volume_info = self.driver.create_volume(volume_with_vt) + + self.assertEqual('10.0.1.6:3260,1 iqn.1993-08.org.debian:01:222 0', + volume_info['provider_location']) + + # make sure createVolume is called without + # isAdaptiveOptimizationEnabled == true + expected = self.driver_startup_call_stack + [ + mock.call.createVolume( + 'fakevolume', + 1, + units.GiB, + {'isThinProvisioned': True, 'clusterName': 'CloudCluster1'})] + + mock_client.assert_has_calls(expected) + + @mock.patch.object(volume_types, 'get_volume_type', + return_value={'extra_specs': {'hplh:ao': 'false'}}) + def test_create_volume_with_ao_false(self, _mock_volume_type): + + # setup drive with default configuration + # and return the mock HTTP LeftHand client + mock_client = self.setup_driver() + + volume_with_vt = self.volume + volume_with_vt['volume_type_id'] = 1 + + # mock return value of createVolume + mock_client.createVolume.return_value = { + 'iscsiIqn': self.connector['initiator']} + + volume_info = self.driver.create_volume(volume_with_vt) + + self.assertEqual('10.0.1.6:3260,1 iqn.1993-08.org.debian:01:222 0', + volume_info['provider_location']) + + # make sure createVolume is called with + # isAdaptiveOptimizationEnabled == false + expected = self.driver_startup_call_stack + [ + mock.call.createVolume( + 'fakevolume', + 1, + units.GiB, + {'isThinProvisioned': True, + 'clusterName': 'CloudCluster1', + 'isAdaptiveOptimizationEnabled': False})] + + mock_client.assert_has_calls(expected) diff --git a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py index 80c08ac84..3ec60770b 100644 --- a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py +++ b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py @@ -87,9 +87,11 @@ class HPLeftHandRESTProxy(ISCSIDriver): 1.0.2 - Added support for volume migrate 1.0.3 - Fixed bug #1285829, HP LeftHand backend assisted migration should check for snapshots + 1.0.4 - Fixed bug #1285925, LeftHand AO volume create performance + improvement """ - VERSION = "1.0.3" + VERSION = "1.0.4" device_stats = {} @@ -152,6 +154,15 @@ class HPLeftHandRESTProxy(ISCSIDriver): if 'isThinProvisioned' not in optional: optional['isThinProvisioned'] = True + # AdaptiveOptimization defaults to 'true' if you don't specify the + # value on a create, and that is the most efficient way to create + # a volume. If you pass in 'false' or 'true' for AO, it will result + # in an update operation following the create operation to set this + # value, so it is best to not specify the value and let it default + # to 'true'. + if optional.get('isAdaptiveOptimizationEnabled'): + del optional['isAdaptiveOptimizationEnabled'] + clusterName = self.configuration.hplefthand_clustername optional['clusterName'] = clusterName -- 2.45.2