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)
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 = {}
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