]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add option to use sudo to check ceph health when required 1060/head
authorVasu Kulkarni <vasu@redhat.com>
Tue, 11 Apr 2017 20:34:13 +0000 (13:34 -0700)
committerVasu Kulkarni <vasu@redhat.com>
Wed, 12 Apr 2017 21:06:47 +0000 (14:06 -0700)
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
teuthology/misc.py

index 909988826cb445fcb7ed8ec68b87f8774b63589c..9bbf97eee884dfabf4b5f2ae80b9cccf56cf99d5 100644 (file)
@@ -885,22 +885,24 @@ def get_scratch_devices(remote):
     return retval
 
 
-def wait_until_healthy(ctx, remote, ceph_cluster='ceph'):
+def wait_until_healthy(ctx, remote, ceph_cluster='ceph', use_sudo=False):
     """
     Wait until a Ceph cluster is healthy. Give up after 15min.
     """
     testdir = get_testdir(ctx)
+    # when cluster is setup using ceph-deploy or ansible
+    # access to admin key is readonly for ceph user
+    cmd = ['ceph', '--cluster', ceph_cluster, 'health']
+    if use_sudo:
+        cmd.insert(0, 'sudo')
+    args = ['adjust-ulimits',
+            'ceph-coverage',
+            '{tdir}/archive/coverage'.format(tdir=testdir)]
+    args.extend(cmd)
     with safe_while(tries=(900 / 6), action="wait_until_healthy") as proceed:
         while proceed():
             r = remote.run(
-                args=[
-                    'adjust-ulimits',
-                    'ceph-coverage',
-                    '{tdir}/archive/coverage'.format(tdir=testdir),
-                    'ceph',
-                    '--cluster', ceph_cluster,
-                    'health',
-                ],
+                args=args,
                 stdout=StringIO(),
                 logger=log.getChild('health'),
             )