From 5c14522a73cb03f1dc420100625b8001b49a97eb Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 24 Oct 2017 10:48:50 -0600 Subject: [PATCH] ceph_ansible: Support custom cluster names Signed-off-by: Zack Cerza --- teuthology/task/ceph_ansible.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/teuthology/task/ceph_ansible.py b/teuthology/task/ceph_ansible.py index 9c95bf80bf..25cce9784a 100644 --- a/teuthology/task/ceph_ansible.py +++ b/teuthology/task/ceph_ansible.py @@ -71,6 +71,7 @@ class CephAnsible(Task): vars['ceph_dev_key'] = 'https://download.ceph.com/keys/autobuild.asc' if 'ceph_dev_branch' not in vars: vars['ceph_dev_branch'] = ctx.config.get('branch', 'master') + self.cluster_name = vars.get('cluster', 'ceph') def setup(self): super(CephAnsible, self).setup() @@ -280,13 +281,21 @@ class CephAnsible(Task): with contextutil.safe_while(sleep=15, tries=6, action='check health') as proceed: (remote,) = self.ctx.cluster.only('mon.a').remotes - remote.run(args=['sudo', 'ceph', 'osd', 'tree']) - remote.run(args=['sudo', 'ceph', '-s']) + remote.run(args=[ + 'sudo', 'ceph', '--cluster', self.cluster_name, 'osd', 'tree' + ]) + remote.run(args=[ + 'sudo', 'ceph', '--cluster', self.cluster_name, '-s' + ]) log.info("Waiting for Ceph health to reach HEALTH_OK \ or HEALTH WARN") while proceed(): out = StringIO() - remote.run(args=['sudo', 'ceph', 'health'], stdout=out) + remote.run( + args=['sudo', 'ceph', '--cluster', self.cluster_name, + 'health'], + stdout=out, + ) out = out.getvalue().split(None, 1)[0] log.info("cluster in state: %s", out) if out in ('HEALTH_OK', 'HEALTH_WARN'): @@ -463,16 +472,15 @@ class CephAnsible(Task): def _create_rbd_pool(self): mon_node = self.ceph_installer - cluster_name = 'ceph' log.info('Creating RBD pool') mon_node.run( args=[ - 'sudo', 'ceph', '--cluster', cluster_name, + 'sudo', 'ceph', '--cluster', self.cluster_name, 'osd', 'pool', 'create', 'rbd', '128', '128'], check_status=False) mon_node.run( args=[ - 'sudo', 'ceph', '--cluster', cluster_name, + 'sudo', 'ceph', '--cluster', self.cluster_name, 'osd', 'pool', 'application', 'enable', 'rbd', 'rbd', '--yes-i-really-mean-it' ], @@ -485,7 +493,7 @@ class CephAnsible(Task): 'sudo', 'chmod', run.Raw('o+r'), - '/etc/ceph/ceph.client.admin.keyring' + '/etc/ceph/%s.client.admin.keyring' % self.cluster_name ]) -- 2.39.5