From: Sage Weil Date: Mon, 2 Dec 2019 21:19:09 +0000 (+0000) Subject: tasks/ceph2: add support for packaged ceph-daemon X-Git-Tag: v15.1.0~677^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3342436177fda452d0066a110bac83aebebe45b5;p=ceph.git tasks/ceph2: add support for packaged ceph-daemon Signed-off-by: Sage Weil --- diff --git a/qa/suites/rados/ssh/mode/packaged.yaml b/qa/suites/rados/ssh/mode/packaged.yaml new file mode 100644 index 000000000000..80cb2c49b555 --- /dev/null +++ b/qa/suites/rados/ssh/mode/packaged.yaml @@ -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 index 000000000000..061fe8483785 --- /dev/null +++ b/qa/suites/rados/ssh/mode/root.yaml @@ -0,0 +1,3 @@ +overrides: + ceph2: + ceph_daemon_mode: root diff --git a/qa/suites/rados/ssh/start.yaml b/qa/suites/rados/ssh/start.yaml index d43d570915f8..653842fef537 100644 --- a/qa/suites/rados/ssh/start.yaml +++ b/qa/suites/rados/ssh/start.yaml @@ -1,3 +1,4 @@ tasks: - install: + extra_packages: [ceph-daemon] - ceph2: diff --git a/qa/tasks/ceph2.py b/qa/tasks/ceph2.py index 40ce636104f5..c9ef661c0dc9 100644 --- a/qa/tasks/ceph2.py +++ b/qa/tasks/ceph2.py @@ -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') diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index 3204a07dee5f..e7d3c8b1afe6 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -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),