from teuthology import contextutil
from teuthology.orchestra import run
import ceph_client as cclient
-from teuthology.orchestra.run import CommandFailedError
from teuthology.orchestra.daemon import DaemonGroup
if mdss.remotes:
log.info('Setting up CephFS filesystem...')
- try:
- proc = mon_remote.run(args=['sudo', 'ceph', '--format=json-pretty', 'osd', 'lspools'],
- stdout=StringIO())
- pools = json.loads(proc.stdout.getvalue())
- metadata_pool_exists = 'metadata' in [p['poolname'] for p in pools]
- except CommandFailedError as e:
- # For use in upgrade tests, Ceph cuttlefish and earlier don't support
- # structured output (--format) from the CLI.
- if e.exitstatus == 22:
- metadata_pool_exists = True
- else:
- raise
-
- # In case we are using an older Ceph which creates FS by default
- if metadata_pool_exists:
- log.info("Metadata pool already exists, skipping")
- else:
- ceph_fs = Filesystem(ctx)
+ ceph_fs = Filesystem(ctx)
+ if not ceph_fs.legacy_configured():
ceph_fs.create()
is_active_mds = lambda role: role.startswith('mds.') and not role.endswith('-s') and role.find('-s-') == -1
self.mon_remote.run(args=['sudo', 'ceph', 'osd', 'pool', 'delete',
'data', 'data', '--yes-i-really-really-mean-it'])
+ def legacy_configured(self):
+ """
+ Check if a legacy (i.e. pre "fs new") filesystem configuration is present. If this is
+ the case, the caller should avoid using Filesystem.create
+ """
+ try:
+ proc = self.mon_remote.run(args=['sudo', 'ceph', '--format=json-pretty', 'osd', 'lspools'],
+ stdout=StringIO())
+ pools = json.loads(proc.stdout.getvalue())
+ metadata_pool_exists = 'metadata' in [p['poolname'] for p in pools]
+ except CommandFailedError as e:
+ # For use in upgrade tests, Ceph cuttlefish and earlier don't support
+ # structured output (--format) from the CLI.
+ if e.exitstatus == 22:
+ metadata_pool_exists = True
+ else:
+ raise
+
+ return metadata_pool_exists
+
def _df(self):
return json.loads(self.mon_manager.raw_cluster_cmd("df", "--format=json-pretty"))