Convert SolidFire Capacity response to GiB

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
This commit is contained in:
John Griffith 2014-05-13 01:01:55 -04:00
parent 432720e99f
commit b75d26f9f3
2 changed files with 12 additions and 3 deletions

View 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)

View 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