diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 116eea9434d..fecfcaaea83 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -7266,6 +7266,7 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver): self.assertEqual(3.0, stats['pools'][0]['free_capacity_gb']) self.assertEqual(87.5, stats['pools'][0]['capacity_utilization']) self.assertEqual(3, stats['pools'][0]['total_volumes']) + self.assertEqual('up', stats['pools'][0]['backend_state']) self.assertEqual(GOODNESS_FUNCTION, stats['pools'][0]['goodness_function']) self.assertEqual(FILTER_FUNCTION, diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 6a86815e827..0ff80a8c24a 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -266,11 +266,12 @@ class HPE3PARCommon(object): extra-specs. bug #1744025 4.0.6 - Monitor task of promoting a virtual copy. bug #1749642 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 = {} @@ -1472,7 +1473,15 @@ class HPE3PARCommon(object): # set in the child classes pools = [] - info = self.client.getStorageSystemInfo() + try: + 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 thin_support = True remotecopy_support = True @@ -1572,7 +1581,7 @@ class HPE3PARCommon(object): 'reserved_percentage': ( self.config.safe_get('reserved_percentage')), 'location_info': ('HPE3PARDriver:%(sys_id)s:%(dest_cpg)s' % - {'sys_id': info['serialNumber'], + {'sys_id': info.get('serialNumber'), 'dest_cpg': cpg_name}), 'total_volumes': total_volumes, 'capacity_utilization': capacity_utilization, @@ -1588,7 +1597,8 @@ class HPE3PARCommon(object): 'consistent_group_snapshot_enabled': True, 'compression': compression_support, 'consistent_group_replication_enabled': - self._replication_enabled + self._replication_enabled, + 'backend_state': backend_state } if remotecopy_support: @@ -1598,11 +1608,11 @@ class HPE3PARCommon(object): pools.append(pool) - self.stats = {'driver_version': '3.0', + self.stats = {'driver_version': '4.0', 'storage_protocol': None, 'vendor_name': 'Hewlett Packard Enterprise', 'volume_backend_name': None, - 'array_id': info['id'], + 'array_id': info.get('id'), 'replication_enabled': self._replication_enabled, 'replication_targets': self._get_replication_targets(), 'pools': pools} diff --git a/releasenotes/notes/report-backend-state-in-service-list-93e9f2b204b735c0.yaml b/releasenotes/notes/report-backend-state-in-service-list-93e9f2b204b735c0.yaml new file mode 100644 index 00000000000..4e045c03f67 --- /dev/null +++ b/releasenotes/notes/report-backend-state-in-service-list-93e9f2b204b735c0.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added flag 'backend_state' which will give backend state info in service list.