vendor_name='Open Source',
driver_version=self.driver.VERSION,
storage_protocol='ceph',
- total_capacity_gb=27,
- free_capacity_gb=26,
+ total_capacity_gb=28.44,
+ free_capacity_gb=27.0,
reserved_percentage=0,
multiattach=False)
pool_stats = [pool for pool in outbuf['pools'] if
pool['name'] ==
self.configuration.rbd_pool][0]['stats']
- stats['free_capacity_gb'] = (
- pool_stats['max_avail'] // units.Gi)
- used_capacity_gb = pool_stats['bytes_used'] // units.Gi
- stats['total_capacity_gb'] = (stats['free_capacity_gb']
- + used_capacity_gb)
+ stats['free_capacity_gb'] = round((float(
+ pool_stats['max_avail']) / units.Gi), 2)
+ used_capacity_gb = float(
+ pool_stats['bytes_used']) / units.Gi
+ stats['total_capacity_gb'] = round(
+ (stats['free_capacity_gb'] + used_capacity_gb), 2)
except self.rados.Error:
# just log and return unknown capacities
LOG.exception(_LE('error refreshing volume stats'))