]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
LeftHand driver is ignoring reserved_percentage
authorKurt Martin <kurt.f.martin@hp.com>
Tue, 18 Aug 2015 23:15:28 +0000 (16:15 -0700)
committerKurt Martin <kurt.f.martin@hp.com>
Tue, 18 Aug 2015 23:55:38 +0000 (16:55 -0700)
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

cinder/tests/unit/test_hplefthand.py
cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py

index fbf1264f99376a839585fa92059a1367944d5640..4a1f11162e1ed3a2a8ac54dbc3338cf4e1216d1d 100644 (file)
@@ -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)
index ff32fbe0dde01d83bfe01f3e8bc0aed303e38022..67cac79d960fc31c9291da66f0b75339f8fb37f5 100644 (file)
@@ -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 % {