]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/ceph2: add support for packaged ceph-daemon
authorSage Weil <sage@redhat.com>
Mon, 2 Dec 2019 21:19:09 +0000 (21:19 +0000)
committerSage Weil <sage@redhat.com>
Mon, 2 Dec 2019 21:19:09 +0000 (21:19 +0000)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/suites/rados/ssh/mode/packaged.yaml [new file with mode: 0644]
qa/suites/rados/ssh/mode/root.yaml [new file with mode: 0644]
qa/suites/rados/ssh/start.yaml
qa/tasks/ceph2.py
qa/tasks/ceph_manager.py

diff --git a/qa/suites/rados/ssh/mode/packaged.yaml b/qa/suites/rados/ssh/mode/packaged.yaml
new file mode 100644 (file)
index 0000000..80cb2c4
--- /dev/null
@@ -0,0 +1,3 @@
+overrides:
+  ceph2:
+    ceph_daemon_mode: packaged-ceph-daemon
diff --git a/qa/suites/rados/ssh/mode/root.yaml b/qa/suites/rados/ssh/mode/root.yaml
new file mode 100644 (file)
index 0000000..061fe84
--- /dev/null
@@ -0,0 +1,3 @@
+overrides:
+  ceph2:
+    ceph_daemon_mode: root
index d43d570915f844b154a12bbf9fcaf70f4414fe1f..653842fef537ce9ad85aa312ab280a0b2a5bd4b9 100644 (file)
@@ -1,3 +1,4 @@
 tasks:
 - install:
+    extra_packages: [ceph-daemon]
 - ceph2:
index 40ce636104f549fb4e2f93c324bfee21d241db4a..c9ef661c0dc9496545de028690eb5f88f507ba9a 100644 (file)
@@ -42,7 +42,7 @@ def _shell(ctx, cluster_name, remote, args, **kwargs):
     return remote.run(
         args=[
             'sudo',
-            '{}/ceph-daemon'.format(testdir),
+            ctx.ceph_daemon,
             '--image', ctx.ceph[cluster_name].image,
             'shell',
             '-c', '{}/{}.conf'.format(testdir, cluster_name),
@@ -95,27 +95,28 @@ def download_ceph_daemon(ctx, config, ref):
     cluster_name = config['cluster']
     testdir = teuthology.get_testdir(ctx)
 
-    ref = config.get('ceph_daemon_branch', ref)
-    git_url = teuth_config.get_ceph_git_url()
-    log.info('Downloading ceph-daemon (repo %s ref %s)...' % (git_url, ref))
-    ctx.cluster.run(
-        args=[
-            'git', 'archive',
-            '--remote=' + git_url,
-            ref,
-            'src/ceph-daemon/ceph-daemon',
-            run.Raw('|'),
-            'tar', '-xO', 'src/ceph-daemon/ceph-daemon',
-            run.Raw('>'),
-            '{tdir}/ceph-daemon'.format(tdir=testdir),
-            run.Raw('&&'),
-            'test', '-s',
-            '{tdir}/ceph-daemon'.format(tdir=testdir),
-            run.Raw('&&'),
-            'chmod', '+x',
-            '{tdir}/ceph-daemon'.format(tdir=testdir),
-        ],
-    )
+    if config.get('ceph_daemon_mode') != 'packaged-ceph-daemon':
+        ref = config.get('ceph_daemon_branch', ref)
+        git_url = teuth_config.get_ceph_git_url()
+        log.info('Downloading ceph-daemon (repo %s ref %s)...' % (git_url, ref))
+        ctx.cluster.run(
+            args=[
+                'git', 'archive',
+                '--remote=' + git_url,
+                ref,
+                'src/ceph-daemon/ceph-daemon',
+                run.Raw('|'),
+                'tar', '-xO', 'src/ceph-daemon/ceph-daemon',
+                run.Raw('>'),
+                ctx.ceph_daemon,
+                run.Raw('&&'),
+                'test', '-s',
+                ctx.ceph_daemon,
+                run.Raw('&&'),
+                'chmod', '+x',
+                ctx.ceph_daemon,
+            ],
+        )
 
     try:
         yield
@@ -123,20 +124,21 @@ def download_ceph_daemon(ctx, config, ref):
         log.info('Removing cluster...')
         ctx.cluster.run(args=[
             'sudo',
-            '{}/ceph-daemon'.format(testdir),
+            ctx.ceph_daemon,
             'rm-cluster',
             '--fsid', ctx.ceph[cluster_name].fsid,
             '--force',
         ])
 
-        log.info('Removing ceph-daemon ...')
-        ctx.cluster.run(
-            args=[
-                'rm',
-                '-rf',
-                '{tdir}/ceph-daemon'.format(tdir=testdir),
-            ],
-        )
+        if config.get('ceph_daemon_mode') == 'root':
+            log.info('Removing ceph-daemon ...')
+            ctx.cluster.run(
+                args=[
+                    'rm',
+                    '-rf',
+                    ctx.ceph_daemon,
+                ],
+            )
 
 @contextlib.contextmanager
 def ceph_log(ctx, config):
@@ -261,7 +263,7 @@ def ceph_bootstrap(ctx, config):
         log.info('Bootstrapping...')
         cmd = [
             'sudo',
-            '{}/ceph-daemon'.format(testdir),
+            ctx.ceph_daemon,
             '--image', ctx.ceph[cluster_name].image,
             'bootstrap',
             '--fsid', fsid,
@@ -769,8 +771,6 @@ def task(ctx, config):
     first_ceph_cluster = False
     if not hasattr(ctx, 'daemons'):
         first_ceph_cluster = True
-        ctx.daemons = DaemonGroup(
-            use_ceph_daemon='{}/ceph-daemon'.format(testdir))
     if not hasattr(ctx, 'ceph'):
         ctx.ceph = {}
         ctx.managers = {}
@@ -779,7 +779,19 @@ def task(ctx, config):
     cluster_name = config['cluster']
     ctx.ceph[cluster_name] = argparse.Namespace()
 
-    #validate_config(ctx, config)
+    # ceph-daemon mode?
+    if 'ceph_daemon_mode' not in config:
+        config['ceph_daemon_mode'] = 'root'
+    assert config['ceph_daemon_mode'] in ['root', 'packaged-ceph-daemon']
+    if config['ceph_daemon_mode'] == 'root':
+        ctx.ceph_daemon = testdir + '/ceph-daemon'
+    else:
+        ctx.ceph_daemon = 'ceph-daemon'  # in the path
+
+    if first_ceph_cluster:
+        # FIXME: this is global for all clusters
+        ctx.daemons = DaemonGroup(
+            use_ceph_daemon=ctx.ceph_daemon)
 
     # image
     ctx.ceph[cluster_name].image = config.get('image')
index 3204a07dee5f2eabf890d666099fdb8ebf6dddc7..e7d3c8b1afe6a8aeb4642345e597612bf0eab310 100644 (file)
@@ -39,7 +39,7 @@ def shell(ctx, cluster_name, remote, args, **kwargs):
     return remote.run(
         args=[
             'sudo',
-            '{}/ceph-daemon'.format(testdir),
+            ctx.ceph_daemon,
             '--image', ctx.ceph[cluster_name].image,
             'shell',
             '-c', '{}/{}.conf'.format(testdir, cluster_name),