From: John Spray Date: Thu, 10 Jul 2014 15:28:29 +0000 (+0100) Subject: task/ceph: Make cephfs_setup cuttlefish-compatible X-Git-Tag: 1.1.0~1316^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cbc73f710f821938e49bfbfc9274aed9af831f8c;p=teuthology.git task/ceph: Make cephfs_setup cuttlefish-compatible Signed-off-by: John Spray Fixes: #8711 --- diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 5ed4efea..e9e1d684 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -17,6 +17,7 @@ from teuthology import misc as teuthology from teuthology import contextutil from ..orchestra import run import ceph_client as cclient +from teuthology.orchestra.run import CommandFailedError DEFAULT_CONF_PATH = '/etc/ceph/ceph.conf' @@ -449,12 +450,21 @@ def cephfs_setup(ctx, config): if mdss.remotes: log.info('Setting up CephFS filesystem...') - proc = mon_remote.run(args=['sudo', 'ceph', '--format=json-pretty', 'osd', 'lspools'], - stdout=StringIO()) - pools = json.loads(proc.stdout.getvalue()) + 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' in [p['poolname'] for p in pools]: + if metadata_pool_exists: log.info("Metadata pool already exists, skipping") else: mon_remote.run(args=['sudo', 'ceph', 'osd', 'pool', 'create', 'metadata', '256'])