]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Convert SolidFire Capacity response to GiB
authorJohn Griffith <john.griffith8@gmail.com>
Tue, 13 May 2014 05:01:55 +0000 (01:01 -0400)
committerJohn Griffith <john.griffith8@gmail.com>
Tue, 13 May 2014 14:47:18 +0000 (10:47 -0400)
This patch fixes the reported free_capacity_gb response
in the SolidFire update_cluster_status method.

The initial patch fixed the free_capacity conversion,
however omitted the same fix that was needed for the
free_space calculation.

Closes Bug: #1284452

Change-Id: If034957764911ec92a6d7e603d0510325018db6d

cinder/tests/test_solidfire.py
cinder/volume/drivers/solidfire.py

index c4efcfe7da7f6ca3c0be6a784c11039bae073600..87bbd2edc770f8d882f641284e2e7874bfeb50f3 100644 (file)
@@ -60,8 +60,8 @@ class SolidFireVolumeTestCase(test.TestCase):
         if method is 'GetClusterCapacity' and version == '1.0':
             LOG.info('Called Fake GetClusterCapacity...')
             data = {'result':
-                    {'clusterCapacity': {'maxProvisionedSpace': 99999999,
-                     'usedSpace': 999,
+                    {'clusterCapacity': {'maxProvisionedSpace': 107374182400,
+                     'usedSpace': 1073741824,
                      'compressionPercent': 100,
                      'deDuplicationPercent': 100,
                      'thinProvisioningPercent': 100}}}
@@ -552,3 +552,11 @@ class SolidFireVolumeTestCase(test.TestCase):
         self.assertTrue(sfv.retype(self.ctxt,
                                    testvol,
                                    test_type, diff, host))
+
+    def test_update_cluster_status(self):
+        self.stubs.Set(SolidFireDriver, '_issue_api_request',
+                       self.fake_issue_api_request)
+        sfv = SolidFireDriver(configuration=self.configuration)
+        sfv._update_cluster_status()
+        self.assertEqual(sfv.cluster_stats['free_capacity_gb'], 99.0)
+        self.assertEqual(sfv.cluster_stats['total_capacity_gb'], 100.0)
index 4952cdb76ada1317e052b5dbff48bf7ebddef2d4..33f1511e00063703515cb6745597667b5e34e6a1 100644 (file)
@@ -681,7 +681,8 @@ class SolidFireDriver(SanISCSIDriver):
         data["driver_version"] = self.VERSION
         data["storage_protocol"] = 'iSCSI'
 
-        data['total_capacity_gb'] = results['maxProvisionedSpace']
+        data['total_capacity_gb'] =\
+            float(results['maxProvisionedSpace'] / units.GiB)
 
         data['free_capacity_gb'] = float(free_capacity / units.GiB)
         data['reserved_percentage'] = self.configuration.reserved_percentage