From: Kurt Martin Date: Tue, 18 Aug 2015 23:15:28 +0000 (-0700) Subject: LeftHand driver is ignoring reserved_percentage X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=fe77c32fcacb997bb2a08c03e6f17f9b1de92724;p=openstack-build%2Fcinder-build.git LeftHand driver is ignoring reserved_percentage The LH driver was hard coding the reserved_percentage parameter to 0. The LeftHand driver should be reading this value from the cinder configuration file as it's used in the capacity filter for calculating capacities. DocImpact Change-Id: Ib76c191f75300f9607811727b0f08ed09deb06c0 Closes-Bug: 1486267 --- diff --git a/cinder/tests/unit/test_hplefthand.py b/cinder/tests/unit/test_hplefthand.py index fbf1264f9..4a1f11162 100644 --- a/cinder/tests/unit/test_hplefthand.py +++ b/cinder/tests/unit/test_hplefthand.py @@ -682,6 +682,15 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase): mock_conf.hplefthand_clustername = "CloudCluster1" mock_conf.goodness_function = GOODNESS_FUNCTION mock_conf.filter_function = FILTER_FUNCTION + mock_conf.reserved_percentage = 25 + + def safe_get(attr): + try: + return mock_conf.__getattribute__(attr) + except AttributeError: + return None + mock_conf.safe_get = safe_get + return mock_conf @mock.patch('hplefthandclient.client.HPLeftHandClient', spec=True) @@ -2056,6 +2065,7 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase): self.assertEqual(True, stats['thin_provisioning_support']) self.assertEqual(True, stats['thick_provisioning_support']) self.assertEqual(1, int(stats['provisioned_capacity_gb'])) + self.assertEqual(25, int(stats['reserved_percentage'])) cap_util = ( float(units.Gi * 500 - units.Gi * 250) / float(units.Gi * 500) 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 ff32fbe0d..67cac79d9 100644 --- a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py +++ b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py @@ -298,7 +298,8 @@ class HPLeftHandRESTProxy(driver.ISCSIDriver): data = {} backend_name = self.configuration.safe_get('volume_backend_name') data['volume_backend_name'] = backend_name or self.__class__.__name__ - data['reserved_percentage'] = 0 + data['reserved_percentage'] = ( + self.configuration.safe_get('reserved_percentage')) data['storage_protocol'] = 'iSCSI' data['vendor_name'] = 'Hewlett-Packard' data['location_info'] = (self.DRIVER_LOCATION % {