# Environment references
mounts = None
fs = None
+ ceph_cluster = None
mds_cluster = None
mgr_cluster = None
ctx = None
:param expected_pattern: a string that you expect to see in the log output
"""
- ceph_manager = self.fs.mon_manager
+ ceph_manager = self.ceph_cluster.mon_manager
class ContextManager(object):
def match(self):
Wait until 'ceph health' contains messages matching the pattern
"""
def seen_health_warning():
- health = self.fs.mon_manager.get_mon_health()
+ health = self.ceph_cluster.mon_manager.get_mon_health()
summary_strings = [s['summary'] for s in health['summary']]
if len(summary_strings) == 0:
log.debug("Not expected number of summary strings ({0})".format(summary_strings))
Wait until `ceph health` returns no messages
"""
def is_clear():
- health = self.fs.mon_manager.get_mon_health()
+ health = self.ceph_cluster.mon_manager.get_mon_health()
return len(health['summary']) == 0
self.wait_until_true(is_clear, timeout)
import unittest
from unittest import suite, loader, case
from teuthology.task import interactive
-from tasks.cephfs.filesystem import Filesystem, MDSCluster
+from teuthology import misc
+from tasks.cephfs.filesystem import Filesystem, MDSCluster, CephCluster
from tasks.mgr.mgr_test_case import MgrCluster
log = logging.getLogger(__name__)
fail_on_skip: false
"""
- fs = Filesystem(ctx)
- mds_cluster = MDSCluster(ctx)
- mgr_cluster = MgrCluster(ctx)
+
+ ceph_cluster = CephCluster(ctx)
+
+ if len(list(misc.all_roles_of_type(ctx.cluster, 'mds'))):
+ mds_cluster = MDSCluster(ctx)
+ fs = Filesystem(ctx)
+ else:
+ mds_cluster = None
+ fs = None
+
+ if len(list(misc.all_roles_of_type(ctx.cluster, 'mgr'))):
+ mgr_cluster = MgrCluster(ctx)
+ else:
+ mgr_cluster = None
# Mount objects, sorted by ID
- if (hasattr(ctx, 'mounts')):
+ if hasattr(ctx, 'mounts'):
mounts = [v for k, v in sorted(ctx.mounts.items(), lambda a, b: cmp(a[0], b[0]))]
else:
# The test configuration has a filesystem but no fuse/kclient mounts
"ctx": ctx,
"mounts": mounts,
"fs": fs,
+ "ceph_cluster": ceph_cluster,
"mds_cluster": mds_cluster,
"mgr_cluster": mgr_cluster,
})
if os.path.exists(mount.mountpoint):
os.rmdir(mount.mountpoint)
filesystem = LocalFilesystem(ctx)
+ ceph_cluster = LocalCephCluster(ctx)
mds_cluster = LocalMDSCluster(ctx)
mgr_cluster = LocalMgrCluster(ctx)
decorating_loader = DecoratingLoader({
"ctx": ctx,
"mounts": mounts,
+ "ceph_cluster": ceph_cluster,
"fs": filesystem,
"mds_cluster": mds_cluster,
"mgr_cluster": mgr_cluster,