Merge "Check ceph backend connection on driver setup"
This commit is contained in:
commit
d2cbb01669
@ -82,6 +82,11 @@ class CephFSNativeDriver(driver.ShareDriver,):
|
||||
|
||||
self.configuration.append_config_values(cephfs_native_opts)
|
||||
|
||||
def check_for_setup_error(self):
|
||||
# NOTE: make sure that we can really connect to the ceph,
|
||||
# otherwise an exception is raised
|
||||
self.volume_client
|
||||
|
||||
def _update_share_stats(self):
|
||||
stats = self.volume_client.rados.get_cluster_stats()
|
||||
|
||||
|
@ -449,3 +449,15 @@ class CephFSNativeDriverTestCase(test.TestCase):
|
||||
self._driver.create_share,
|
||||
self._context,
|
||||
self._share)
|
||||
|
||||
def test_check_for_setup_error(self):
|
||||
self._driver.check_for_setup_error()
|
||||
self._driver._volume_client.connect.assert_called_once_with(
|
||||
premount_evict='manila')
|
||||
|
||||
def test_check_for_setup_error_with_connection_error(self):
|
||||
cephfs_native.ceph_module_found = False
|
||||
cephfs_native.ceph_volume_client = None
|
||||
|
||||
self.assertRaises(exception.ManilaException,
|
||||
self._driver.check_for_setup_error)
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Added a check on driver startup for CEPHFS back ends to verify whether
|
||||
the back end is accessible.
|
Loading…
Reference in New Issue
Block a user