3PAR: Report backend state in service list

This commit implements report backend state in
service list

Change-Id: I36b2fdb38a66808175b7c66eaaba0c8ff6a9fb2c
Implements: blueprint report-backend-state-in-service-list
This commit is contained in:
Vivek Soni 2018-03-26 23:37:56 -07:00
parent fb6f96e6c3
commit c5a8000b9c
3 changed files with 21 additions and 6 deletions

View File

@ -7266,6 +7266,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver):
self.assertEqual(3.0, stats['pools'][0]['free_capacity_gb']) self.assertEqual(3.0, stats['pools'][0]['free_capacity_gb'])
self.assertEqual(87.5, stats['pools'][0]['capacity_utilization']) self.assertEqual(87.5, stats['pools'][0]['capacity_utilization'])
self.assertEqual(3, stats['pools'][0]['total_volumes']) self.assertEqual(3, stats['pools'][0]['total_volumes'])
self.assertEqual('up', stats['pools'][0]['backend_state'])
self.assertEqual(GOODNESS_FUNCTION, self.assertEqual(GOODNESS_FUNCTION,
stats['pools'][0]['goodness_function']) stats['pools'][0]['goodness_function'])
self.assertEqual(FILTER_FUNCTION, self.assertEqual(FILTER_FUNCTION,

View File

@ -266,11 +266,12 @@ class HPE3PARCommon(object):
extra-specs. bug #1744025 extra-specs. bug #1744025
4.0.6 - Monitor task of promoting a virtual copy. bug #1749642 4.0.6 - Monitor task of promoting a virtual copy. bug #1749642
4.0.7 - Handle force detach case. bug #1686745 4.0.7 - Handle force detach case. bug #1686745
4.0.8 - Added support for report backend state in service list.
""" """
VERSION = "4.0.7" VERSION = "4.0.8"
stats = {} stats = {}
@ -1472,7 +1473,15 @@ class HPE3PARCommon(object):
# set in the child classes # set in the child classes
pools = [] pools = []
try:
info = self.client.getStorageSystemInfo() info = self.client.getStorageSystemInfo()
backend_state = 'up'
except Exception as ex:
info = {}
backend_state = 'down'
LOG.warning("Exception at getStorageSystemInfo() "
"Reason: '%(reason)s'", {'reason': ex})
qos_support = True qos_support = True
thin_support = True thin_support = True
remotecopy_support = True remotecopy_support = True
@ -1572,7 +1581,7 @@ class HPE3PARCommon(object):
'reserved_percentage': ( 'reserved_percentage': (
self.config.safe_get('reserved_percentage')), self.config.safe_get('reserved_percentage')),
'location_info': ('HPE3PARDriver:%(sys_id)s:%(dest_cpg)s' % 'location_info': ('HPE3PARDriver:%(sys_id)s:%(dest_cpg)s' %
{'sys_id': info['serialNumber'], {'sys_id': info.get('serialNumber'),
'dest_cpg': cpg_name}), 'dest_cpg': cpg_name}),
'total_volumes': total_volumes, 'total_volumes': total_volumes,
'capacity_utilization': capacity_utilization, 'capacity_utilization': capacity_utilization,
@ -1588,7 +1597,8 @@ class HPE3PARCommon(object):
'consistent_group_snapshot_enabled': True, 'consistent_group_snapshot_enabled': True,
'compression': compression_support, 'compression': compression_support,
'consistent_group_replication_enabled': 'consistent_group_replication_enabled':
self._replication_enabled self._replication_enabled,
'backend_state': backend_state
} }
if remotecopy_support: if remotecopy_support:
@ -1598,11 +1608,11 @@ class HPE3PARCommon(object):
pools.append(pool) pools.append(pool)
self.stats = {'driver_version': '3.0', self.stats = {'driver_version': '4.0',
'storage_protocol': None, 'storage_protocol': None,
'vendor_name': 'Hewlett Packard Enterprise', 'vendor_name': 'Hewlett Packard Enterprise',
'volume_backend_name': None, 'volume_backend_name': None,
'array_id': info['id'], 'array_id': info.get('id'),
'replication_enabled': self._replication_enabled, 'replication_enabled': self._replication_enabled,
'replication_targets': self._get_replication_targets(), 'replication_targets': self._get_replication_targets(),
'pools': pools} 'pools': pools}

View File

@ -0,0 +1,4 @@
---
features:
- |
Added flag 'backend_state' which will give backend state info in service list.