'SDUsage': {'rawTotalMiB': 49152,
'rawUsedMiB': 1023,
'totalMiB': 36864,
- 'usedMiB': 768},
+ 'usedMiB': 1024 * 1},
'UsrUsage': {'rawTotalMiB': 57344,
'rawUsedMiB': 43349,
'totalMiB': 43008,
- 'usedMiB': 32512},
+ 'usedMiB': 1024 * 20},
'additionalStates': [],
'degradedStates': [],
'failedStates': [],
mock_client = self.setup_driver()
mock_client.getCPG.return_value = self.cpgs[0]
mock_client.getStorageSystemInfo.return_value = {
- 'serialNumber': '1234',
- 'freeCapacityMiB': 1024.0 * 2,
- 'totalCapacityMiB': 1024.0 * 123
+ 'serialNumber': '1234'
+ }
+
+ # cpg has no limit
+ mock_client.getCPGAvailableSpace.return_value = {
+ "capacityEfficiency": {u'compaction': 594.4},
+ "rawFreeMiB": 1024.0 * 6,
+ "usableFreeMiB": 1024.0 * 3
}
with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
self.assertEqual(stats['storage_protocol'], 'FC')
self.assertEqual(stats['total_capacity_gb'], 0)
self.assertEqual(stats['free_capacity_gb'], 0)
- self.assertEqual(stats['pools'][0]['total_capacity_gb'], 123.0)
- self.assertEqual(stats['pools'][0]['free_capacity_gb'], 2.0)
+ self.assertEqual(stats['pools'][0]['total_capacity_gb'], 24.0)
+ self.assertEqual(stats['pools'][0]['free_capacity_gb'], 3.0)
expected = [
mock.call.getStorageSystemInfo(),
mock.call.getCPG(HP3PAR_CPG),
- mock.call.getCPG(HP3PAR_CPG2)]
+ mock.call.getCPGAvailableSpace(HP3PAR_CPG),
+ mock.call.getCPG(HP3PAR_CPG2),
+ mock.call.getCPGAvailableSpace(HP3PAR_CPG2)]
mock_client.assert_has_calls(
self.standard_login +
self.assertEqual(stats['storage_protocol'], 'FC')
self.assertEqual(stats['total_capacity_gb'], 0)
self.assertEqual(stats['free_capacity_gb'], 0)
- self.assertEqual(stats['pools'][0]['total_capacity_gb'], 123.0)
- self.assertEqual(stats['pools'][0]['free_capacity_gb'], 2.0)
+ self.assertEqual(stats['pools'][0]['total_capacity_gb'], 24.0)
+ self.assertEqual(stats['pools'][0]['free_capacity_gb'], 3.0)
cpg2 = self.cpgs[0].copy()
cpg2.update({'SDGrowth': {'limitMiB': 8192}})
mock_client = self.setup_driver()
mock_client.getCPG.return_value = self.cpgs[0]
mock_client.getStorageSystemInfo.return_value = {
- 'serialNumber': '1234',
- 'freeCapacityMiB': 1024.0 * 2,
- 'totalCapacityMiB': 1024.0 * 123
+ 'serialNumber': '1234'
+ }
+ # cpg has no limit
+ mock_client.getCPGAvailableSpace.return_value = {
+ "capacityEfficiency": {u'compaction': 594.4},
+ "rawFreeMiB": 1024.0 * 6,
+ "usableFreeMiB": 1024.0 * 3
}
with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
self.assertEqual(stats['storage_protocol'], 'iSCSI')
self.assertEqual(stats['total_capacity_gb'], 0)
self.assertEqual(stats['free_capacity_gb'], 0)
- self.assertEqual(stats['pools'][0]['total_capacity_gb'], 123.0)
- self.assertEqual(stats['pools'][0]['free_capacity_gb'], 2.0)
+ self.assertEqual(stats['pools'][0]['total_capacity_gb'], 24.0)
+ self.assertEqual(stats['pools'][0]['free_capacity_gb'], 3.0)
expected = [
mock.call.getStorageSystemInfo(),
mock.call.getCPG(HP3PAR_CPG),
- mock.call.getCPG(HP3PAR_CPG2)]
+ mock.call.getCPGAvailableSpace(HP3PAR_CPG),
+ mock.call.getCPG(HP3PAR_CPG2),
+ mock.call.getCPGAvailableSpace(HP3PAR_CPG2)]
mock_client.assert_has_calls(
self.standard_login +
2.0.26 - Don't ignore extra-specs snap_cpg when missing cpg #1368972
2.0.27 - Fixing manage source-id error bug #1357075
2.0.28 - Removing locks bug #1381190
+ 2.0.29 - Report a limitless cpg's stats better bug #1398651
"""
- VERSION = "2.0.28"
+ VERSION = "2.0.29"
stats = {}
try:
cpg = self.client.getCPG(cpg_name)
if 'limitMiB' not in cpg['SDGrowth']:
- # System capacity is best we can do for now.
- total_capacity = info['totalCapacityMiB'] * const
- free_capacity = info['freeCapacityMiB'] * const
+ # cpg usable free space
+ cpg_avail_space = \
+ self.client.getCPGAvailableSpace(cpg_name)
+ free_capacity = int(
+ cpg_avail_space['usableFreeMiB'] * const)
+ # total_capacity is the best we can do for a limitless cpg
+ total_capacity = int(
+ (cpg['SDUsage']['usedMiB'] +
+ cpg['UsrUsage']['usedMiB'] +
+ cpg_avail_space['usableFreeMiB']) * const)
else:
total_capacity = int(cpg['SDGrowth']['limitMiB'] * const)
free_capacity = int((cpg['SDGrowth']['limitMiB'] -