Bug fix for free space calculation

Instead of calculating the free space ourselves, simply report the
amount of free space that the storage array tells us it has.

Closes-bug: #1918229
Change-Id: Iff02775822056904e5457ecddcefb2e580f47953
This commit is contained in:
Ajitha Robert 2021-03-09 00:05:35 -08:00
parent 47cdd944b3
commit b5b681b737
3 changed files with 12 additions and 10 deletions

View File

@ -197,9 +197,7 @@ FAKE_POSITIVE_GROUP_INFO_RESPONSE = {
'name': 'group-nimble',
'usage_valid': True,
'usable_capacity_bytes': 8016883089408,
'compressed_vol_usage_bytes': 2938311843,
'compressed_snap_usage_bytes': 36189,
'unused_reserve_bytes': 0}
'free_space': 101111111901}
FAKE_GET_VOL_INFO_RESPONSE = {'name': 'testvolume-cg',
'clone': False,
@ -1136,7 +1134,7 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
'storage_protocol': 'iSCSI',
'pools': [{'pool_name': 'NIMBLE',
'total_capacity_gb': 7466.30419921875,
'free_capacity_gb': 7463.567649364471,
'free_capacity_gb': 94.16706105787307,
'reserved_percentage': 0,
'QoS_support': False,
'multiattach': True,

View File

@ -382,15 +382,11 @@ class NimbleBaseVolumeDriver(san.SanDriver):
'array is invalid'))
total_capacity = (group_info['usable_capacity_bytes'] /
float(units.Gi))
used_space = ((group_info['compressed_vol_usage_bytes'] +
group_info['compressed_snap_usage_bytes'] +
group_info['unused_reserve_bytes']) /
free_space = (group_info['free_space'] /
float(units.Gi))
free_space = total_capacity - used_space
LOG.debug('total_capacity=%(capacity)f '
'used_space=%(used)f free_space=%(free)f',
'free_space=%(free)f',
{'capacity': total_capacity,
'used': used_space,
'free': free_space})
backend_name = self.configuration.safe_get(

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Nimble driver `bug #1918229
<https://bugs.launchpad.net/cinder/+bug/1918229>`_: Corrected an issue
where the Nimble storage driver was inaccurately determining that there
was no free space left in the storage array. The driver now relies on the
storage array to report the amount of free space.