diff --git a/cinder/tests/unit/volume/drivers/test_rbd.py b/cinder/tests/unit/volume/drivers/test_rbd.py index 9ab97fb804e..ce832451a5c 100644 --- a/cinder/tests/unit/volume/drivers/test_rbd.py +++ b/cinder/tests/unit/volume/drivers/test_rbd.py @@ -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 diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 81b35d4e306..e2f5eaed5b7 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -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 diff --git a/releasenotes/notes/rbd-support-report-backend-state-4e124eb9efd36724.yaml b/releasenotes/notes/rbd-support-report-backend-state-4e124eb9efd36724.yaml new file mode 100644 index 00000000000..138fdd63b46 --- /dev/null +++ b/releasenotes/notes/rbd-support-report-backend-state-4e124eb9efd36724.yaml @@ -0,0 +1,3 @@ +--- +features: + - Allow rbd driver to report backend state.