Merge "HP 3PAR drivers should not claim to have 'infinite' space"
This commit is contained in:
commit
b0c3f12078
@ -2256,30 +2256,35 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
|
||||
# and return the mock HTTP 3PAR client
|
||||
mock_client = self.setup_driver()
|
||||
mock_client.getCPG.return_value = self.cpgs[0]
|
||||
mock_client.getStorageSystemInfo.return_value = {'serialNumber':
|
||||
'1234'}
|
||||
totalCapacityMiB = 8000
|
||||
freeCapacityMiB = 4000
|
||||
mock_client.getStorageSystemInfo.return_value = {
|
||||
'serialNumber': '1234',
|
||||
'totalCapacityMiB': totalCapacityMiB,
|
||||
'freeCapacityMiB': freeCapacityMiB
|
||||
}
|
||||
stats = self.driver.get_volume_stats(True)
|
||||
const = 0.0009765625
|
||||
self.assertEqual(stats['storage_protocol'], 'FC')
|
||||
self.assertEqual(stats['total_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['free_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['total_capacity_gb'], totalCapacityMiB * const)
|
||||
self.assertEqual(stats['free_capacity_gb'], freeCapacityMiB * const)
|
||||
|
||||
expected = [
|
||||
mock.call.login(HP3PAR_USER_NAME, HP3PAR_USER_PASS),
|
||||
mock.call.getCPG(HP3PAR_CPG),
|
||||
mock.call.getStorageSystemInfo(),
|
||||
mock.call.getCPG(HP3PAR_CPG),
|
||||
mock.call.logout()]
|
||||
|
||||
mock_client.assert_has_calls(expected)
|
||||
stats = self.driver.get_volume_stats(True)
|
||||
self.assertEqual(stats['storage_protocol'], 'FC')
|
||||
self.assertEqual(stats['total_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['free_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['total_capacity_gb'], totalCapacityMiB * const)
|
||||
self.assertEqual(stats['free_capacity_gb'], freeCapacityMiB * const)
|
||||
|
||||
cpg2 = self.cpgs[0].copy()
|
||||
cpg2.update({'SDGrowth': {'limitMiB': 8192}})
|
||||
mock_client.getCPG.return_value = cpg2
|
||||
|
||||
const = 0.0009765625
|
||||
stats = self.driver.get_volume_stats(True)
|
||||
self.assertEqual(stats['storage_protocol'], 'FC')
|
||||
total_capacity_gb = 8192 * const
|
||||
@ -2544,30 +2549,31 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
|
||||
# and return the mock HTTP 3PAR client
|
||||
mock_client = self.setup_driver()
|
||||
mock_client.getCPG.return_value = self.cpgs[0]
|
||||
mock_client.getStorageSystemInfo.return_value = {'serialNumber':
|
||||
'1234'}
|
||||
totalCapacityMiB = 8000
|
||||
freeCapacityMiB = 4000
|
||||
mock_client.getStorageSystemInfo.return_value = {
|
||||
'serialNumber': '1234',
|
||||
'totalCapacityMiB': totalCapacityMiB,
|
||||
'freeCapacityMiB': freeCapacityMiB
|
||||
}
|
||||
stats = self.driver.get_volume_stats(True)
|
||||
const = 0.0009765625
|
||||
self.assertEqual(stats['storage_protocol'], 'iSCSI')
|
||||
self.assertEqual(stats['total_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['free_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['total_capacity_gb'], totalCapacityMiB * const)
|
||||
self.assertEqual(stats['free_capacity_gb'], freeCapacityMiB * const)
|
||||
|
||||
expected = [
|
||||
mock.call.login(HP3PAR_USER_NAME, HP3PAR_USER_PASS),
|
||||
mock.call.getCPG(HP3PAR_CPG),
|
||||
mock.call.getStorageSystemInfo(),
|
||||
mock.call.getCPG(HP3PAR_CPG),
|
||||
mock.call.logout()]
|
||||
|
||||
mock_client.assert_has_calls(expected)
|
||||
|
||||
self.assertEqual(stats['storage_protocol'], 'iSCSI')
|
||||
self.assertEqual(stats['total_capacity_gb'], 'infinite')
|
||||
self.assertEqual(stats['free_capacity_gb'], 'infinite')
|
||||
|
||||
cpg2 = self.cpgs[0].copy()
|
||||
cpg2.update({'SDGrowth': {'limitMiB': 8192}})
|
||||
mock_client.getCPG.return_value = cpg2
|
||||
|
||||
const = 0.0009765625
|
||||
stats = self.driver.get_volume_stats(True)
|
||||
self.assertEqual(stats['storage_protocol'], 'iSCSI')
|
||||
total_capacity_gb = 8192 * const
|
||||
|
@ -149,10 +149,11 @@ class HP3PARCommon(object):
|
||||
2.0.19 - Update default persona from Generic to Generic-ALUA
|
||||
2.0.20 - Configurable SSH missing key policy and known hosts file
|
||||
2.0.21 - Remove bogus invalid snapCPG=None exception
|
||||
2.0.22 - HP 3PAR drivers should not claim to have 'infinite' space
|
||||
|
||||
"""
|
||||
|
||||
VERSION = "2.0.21"
|
||||
VERSION = "2.0.22"
|
||||
|
||||
stats = {}
|
||||
|
||||
@ -623,11 +624,13 @@ class HP3PARCommon(object):
|
||||
'vendor_name': 'Hewlett-Packard',
|
||||
'volume_backend_name': None}
|
||||
|
||||
info = self.client.getStorageSystemInfo()
|
||||
try:
|
||||
cpg = self.client.getCPG(self.config.hp3par_cpg)
|
||||
if 'limitMiB' not in cpg['SDGrowth']:
|
||||
total_capacity = 'infinite'
|
||||
free_capacity = 'infinite'
|
||||
# System capacity is best we can do for now.
|
||||
total_capacity = info['totalCapacityMiB'] * const
|
||||
free_capacity = info['freeCapacityMiB'] * const
|
||||
else:
|
||||
total_capacity = int(cpg['SDGrowth']['limitMiB'] * const)
|
||||
free_capacity = int((cpg['SDGrowth']['limitMiB'] -
|
||||
@ -641,7 +644,6 @@ class HP3PARCommon(object):
|
||||
LOG.error(err)
|
||||
raise exception.InvalidInput(reason=err)
|
||||
|
||||
info = self.client.getStorageSystemInfo()
|
||||
stats['location_info'] = ('HP3PARDriver:%(sys_id)s:%(dest_cpg)s' %
|
||||
{'sys_id': info['serialNumber'],
|
||||
'dest_cpg': self.config.safe_get(
|
||||
|
Loading…
Reference in New Issue
Block a user