From b1817831660d673bb50eb3634e6fcf8987075018 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 27 Aug 2015 23:20:25 +0200 Subject: [PATCH] ceph-deploy: implement keep_running When keep_running is true, do not shutdown the cluster, leave it as it is for other workunits or tasks to use. This effectively allows the ceph-deploy task to be used as a helper to deploy clusters. The call to build_ceph_cluster is simplified by giving it the whole configuration dictionary instead of re-building one with selected arguments. Signed-off-by: Loic Dachary --- tasks/ceph_deploy.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tasks/ceph_deploy.py b/tasks/ceph_deploy.py index f6a365f75af1e..25234f7e1ca39 100644 --- a/tasks/ceph_deploy.py +++ b/tasks/ceph_deploy.py @@ -371,6 +371,8 @@ def build_ceph_cluster(ctx, config): log.info(traceback.format_exc()) raise finally: + if config.get('keep_running'): + return log.info('Stopping ceph...') ctx.cluster.run(args=['sudo', 'stop', 'ceph-all', run.Raw('||'), 'sudo', 'service', 'ceph', 'stop' ]) @@ -613,6 +615,7 @@ def task(ctx, config): branch: stable: bobtail mon_initial_members: 1 + keep_running: true tasks: - install: @@ -651,13 +654,6 @@ def task(ctx, config): with contextutil.nested( lambda: install_fn.ship_utilities(ctx=ctx, config=None), lambda: download_ceph_deploy(ctx=ctx, config=config), - lambda: build_ceph_cluster(ctx=ctx, config=dict( - conf=config.get('conf', {}), - branch=config.get('branch',{}), - dmcrypt=config.get('dmcrypt',None), - separate_journal_disk=config.get('separate_journal_disk',None), - mon_initial_members=config.get('mon_initial_members', None), - test_mon_destroy=config.get('test_mon_destroy', None), - )), + lambda: build_ceph_cluster(ctx=ctx, config=config), ): yield -- 2.39.5