Zero out SolidFire capacity when unreachable
If for some reason connectivity to the cluster goes down, we just return the cached capacity info. Then the scheduler still sees the cluster as an available resource in the pool. This change detects connectivity issues during the get_cluster_stats call and if the call fails, we report 0 available capacity to keep create calls from being scheduled to the cluster. Change-Id: I3f730e140c2b61fdd407c90b134916108312278a Closes-Bug: #1398877
This commit is contained in:
parent
8d9bef0de9
commit
cc325cb3f6
|
@ -823,6 +823,18 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||
self.assertEqual(99.0, sfv.cluster_stats['free_capacity_gb'])
|
||||
self.assertEqual(100.0, sfv.cluster_stats['total_capacity_gb'])
|
||||
|
||||
def test_update_cluster_status_mvip_unreachable(self):
|
||||
self.mock_object(solidfire.SolidFireDriver,
|
||||
'_issue_api_request',
|
||||
self.fake_issue_api_request)
|
||||
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
||||
with mock.patch.object(sfv,
|
||||
'_issue_api_request',
|
||||
side_effect=self.fake_issue_api_request_fails):
|
||||
sfv._update_cluster_status()
|
||||
self.assertEqual(0, sfv.cluster_stats['free_capacity_gb'])
|
||||
self.assertEqual(0, sfv.cluster_stats['total_capacity_gb'])
|
||||
|
||||
def test_manage_existing_volume(self):
|
||||
external_ref = {'name': 'existing volume', 'source-id': 5}
|
||||
testvol = {'project_id': 'testprjid',
|
||||
|
|
|
@ -1696,14 +1696,6 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||
"""Retrieve status info for the Cluster."""
|
||||
params = {}
|
||||
|
||||
# NOTE(jdg): The SF api provides an UNBELIEVABLE amount
|
||||
# of stats data, this is just one of the calls
|
||||
results = self._issue_api_request('GetClusterCapacity', params)
|
||||
|
||||
results = results['result']['clusterCapacity']
|
||||
free_capacity = (
|
||||
results['maxProvisionedSpace'] - results['usedSpace'])
|
||||
|
||||
data = {}
|
||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||
data["volume_backend_name"] = backend_name or self.__class__.__name__
|
||||
|
@ -1711,19 +1703,29 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||
data["driver_version"] = self.VERSION
|
||||
data["storage_protocol"] = 'iSCSI'
|
||||
data['consistencygroup_support'] = True
|
||||
# TODO(jdg): should we have a "replication_status" that includes
|
||||
# enabled, disabled, failed-over, error ?
|
||||
data['replication_enabled'] = self.replication_enabled
|
||||
if self.replication_enabled:
|
||||
data['replication'] = 'enabled'
|
||||
data['active_cluster_mvip'] = self.active_cluster_info['mvip']
|
||||
data['reserved_percentage'] = self.configuration.reserved_percentage
|
||||
data['QoS_support'] = True
|
||||
|
||||
try:
|
||||
results = self._issue_api_request('GetClusterCapacity', params)
|
||||
except exception.SolidFireAPIException:
|
||||
data['total_capacity_gb'] = 0
|
||||
data['free_capacity_gb'] = 0
|
||||
self.cluster_stats = data
|
||||
return
|
||||
|
||||
results = results['result']['clusterCapacity']
|
||||
free_capacity = (
|
||||
results['maxProvisionedSpace'] - results['usedSpace'])
|
||||
|
||||
data['total_capacity_gb'] = (
|
||||
float(results['maxProvisionedSpace'] / units.Gi))
|
||||
|
||||
data['free_capacity_gb'] = float(free_capacity / units.Gi)
|
||||
data['reserved_percentage'] = self.configuration.reserved_percentage
|
||||
data['QoS_support'] = True
|
||||
data['compression_percent'] = (
|
||||
results['compressionPercent'])
|
||||
data['deduplicaton_percent'] = (
|
||||
|
|
Loading…
Reference in New Issue