mirror of
https://github.com/ceph/ceph
synced 2025-01-11 21:50:26 +00:00
qa/cephfs: check for Ceph FS before mounting
If the given Ceph FS, or the default Ceph FS when no Ceph FS is given, is absent, abort the execution with AsssertionError and an error message. Signed-off-by: Rishabh Dave <ridave@redhat.com>
This commit is contained in:
parent
db0b85b440
commit
95eb0043bf
@ -123,6 +123,18 @@ class CephFSMount(object):
|
||||
def netns_name(self, name):
|
||||
self._netns_name = name
|
||||
|
||||
def assert_that_ceph_fs_exists(self):
|
||||
output = self.client_remote.run(args='ceph fs ls', stdout=StringIO()).\
|
||||
stdout.getvalue()
|
||||
if self.cephfs_name:
|
||||
assert self.cephfs_name in output, \
|
||||
'expected ceph fs is not present on the cluster'
|
||||
log.info(f'Mounting Ceph FS {self.cephfs_name}; just confirmed its presence on cluster')
|
||||
else:
|
||||
assert 'No filesystems enabled' not in output, \
|
||||
'ceph cluster has no ceph fs, not even the default ceph fs'
|
||||
log.info('Mounting default Ceph FS; just confirmed its presence on cluster')
|
||||
|
||||
def assert_and_log_minimum_mount_details(self):
|
||||
"""
|
||||
Make sure we have minimum details required for mounting. Ideally, this
|
||||
@ -136,6 +148,8 @@ class CephFSMount(object):
|
||||
'3. the remote machine where CephFS will be mounted.\n')
|
||||
raise RuntimeError(errmsg)
|
||||
|
||||
self.assert_that_ceph_fs_exists()
|
||||
|
||||
log.info('Mounting Ceph FS. Following are details of mount; remember '
|
||||
'"None" represents Python type None -')
|
||||
log.info(f'self.client_remote.hostname = {self.client_remote.hostname}')
|
||||
|
Loading…
Reference in New Issue
Block a user