]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/ceph: Make cephfs_setup cuttlefish-compatible 288/head
authorJohn Spray <jspray@redhat.com>
Thu, 10 Jul 2014 15:28:29 +0000 (16:28 +0100)
committerJohn Spray <jspray@redhat.com>
Thu, 10 Jul 2014 15:50:52 +0000 (16:50 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
Fixes: #8711
teuthology/task/ceph.py

index 5ed4efeae7157b33cb6014b6ba23eba9f9269b5a..e9e1d684862e260f9aeae6f238087fec096b0b4a 100644 (file)
@@ -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'])