Merge "RBD: support to report backend state"

This commit is contained in:
Zuul 2018-06-16 02:46:36 +00:00 committed by Gerrit Code Review
commit 941501f10e
3 changed files with 12 additions and 3 deletions

View File

@ -1201,7 +1201,8 @@ class RBDTestCase(test.TestCase):
provisioned_capacity_gb=mock.sentinel.provisioned_capacity_gb,
max_over_subscription_ratio=1.0,
multiattach=False,
location_info=expected_location_info)
location_info=expected_location_info,
backend_state='up')
if replication_enabled:
targets = [{'backend_id': 'secondary-backend'},
@ -1244,7 +1245,8 @@ class RBDTestCase(test.TestCase):
thin_provisioning_support=True,
max_over_subscription_ratio=1.0,
multiattach=False,
location_info=expected_location_info)
location_info=expected_location_info,
backend_state='up')
my_safe_get = MockDriverConfig(rbd_exclusive_cinder_pool=True)
self.mock_object(self.driver.configuration, 'safe_get',
@ -1280,7 +1282,8 @@ class RBDTestCase(test.TestCase):
multiattach=False,
max_over_subscription_ratio=1.0,
thin_provisioning_support=True,
location_info=expected_location_info)
location_info=expected_location_info,
backend_state='down')
with mock.patch.object(self.driver, '_get_fsid') as mock_get_fsid:
mock_get_fsid.return_value = expected_fsid

View File

@ -495,6 +495,7 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
'max_over_subscription_ratio': (
self.configuration.safe_get('max_over_subscription_ratio')),
'location_info': location_info,
'backend_state': 'down'
}
backend_name = self.configuration.safe_get('volume_backend_name')
@ -514,6 +515,8 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
if not self.configuration.safe_get('rbd_exclusive_cinder_pool'):
total_gbi = self._get_usage_info()
stats['provisioned_capacity_gb'] = total_gbi
stats['backend_state'] = 'up'
except self.rados.Error:
# just log and return unknown capacities and let scheduler set
# provisioned_capacity_gb = allocated_capacity_gb

View File

@ -0,0 +1,3 @@
---
features:
- Allow rbd driver to report backend state.