From da2d185cf16847a9f0f4bbbe2c40f417cd24d53d Mon Sep 17 00:00:00 2001 From: sunilkumarn417 Date: Tue, 14 Apr 2020 00:36:01 +0530 Subject: [PATCH] code changes for multiple rgw daemons in single host Signed-off-by: sunilkumarn417 --- teuthology/orchestra/daemon/systemd.py | 6 +++++- teuthology/task/ceph_ansible.py | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/teuthology/orchestra/daemon/systemd.py b/teuthology/orchestra/daemon/systemd.py index 7651808a2e..17b144d201 100644 --- a/teuthology/orchestra/daemon/systemd.py +++ b/teuthology/orchestra/daemon/systemd.py @@ -101,6 +101,10 @@ class SystemDState(DaemonState): def pid(self): proc_name = 'ceph-%s' % self.type_ proc_regex = '"%s.*--id %s "' % (proc_name, self.id_) + + if self.type_ == "rgw": + proc_regex = "{}.*--name.*{}".format(self.daemon_type, self.id_) + args = ['ps', '-ef', run.Raw('|'), 'grep', @@ -110,13 +114,13 @@ class SystemDState(DaemonState): 'grep', run.Raw('|'), 'awk', run.Raw("{'print $2'}")] + proc = self.remote.run(args=args, stdout=StringIO()) pid_string = proc.stdout.getvalue().strip() if not pid_string.isdigit(): return None return int(pid_string) - def reset(self): """ Does nothing in this implementation diff --git a/teuthology/task/ceph_ansible.py b/teuthology/task/ceph_ansible.py index 781a55992d..7bd30698dd 100644 --- a/teuthology/task/ceph_ansible.py +++ b/teuthology/task/ceph_ansible.py @@ -508,11 +508,13 @@ class CephAnsible(Task): ceph_installer = self.ceph_installer from tasks.set_repo import GA_BUILDS, set_cdn_repo rhbuild = self.config.get('rhbuild') + # skip cdn's for rhel beta tests which will use GA builds from Repo if self.ctx.config.get('redhat').get('skip-subscription-manager', False) is False: if rhbuild in GA_BUILDS: set_cdn_repo(self.ctx, self.config) + # install ceph-ansible if ceph_installer.os.package_type == 'rpm': ceph_installer.run(args=[ @@ -782,6 +784,17 @@ class CephAnsible(Task): def _fix_roles_map(self): ctx = self.ctx + + # Find rhbuild from config and check for cluster version + # In case 4.x, support multiple RGW daemons in single node + # else, continue + multi_rgw_support = False + try: + if str(ctx.config.get('redhat', str()).get("rhbuild")).startswith("4"): + multi_rgw_support = True + except AttributeError: + pass + if not hasattr(ctx, 'managers'): ctx.managers = {} ctx.daemons = DaemonGroup(use_systemd=True) @@ -793,6 +806,7 @@ class CephAnsible(Task): for remote, roles in self.ready_cluster.remotes.iteritems(): new_remote_role[remote] = [] generate_osd_list = True + rgw_count = 0 for role in roles: cluster, rol, id = misc.split_role(role) if rol.startswith('osd'): @@ -835,10 +849,14 @@ class CephAnsible(Task): elif rol.startswith('rgw'): hostname = remote.shortname new_remote_role[remote].append(role) - log.info( - "Registering Daemon {rol} {id}".format( - rol=rol, id=id)) - ctx.daemons.add_daemon(remote, rol, id_='rgw.' + hostname) + id_ = "{}.{}".format('rgw', hostname) + if multi_rgw_support: + id_ = "{}.{}.rgw{}".format('rgw', hostname, rgw_count) + rgw_count += 1 + log.info("Registering Daemon {rol} {id}".format(rol=rol, + id=id_)) + ctx.daemons.add_daemon(remote, rol, id_=id_) + else: new_remote_role[remote].append(role) self.each_cluster.remotes.update(new_remote_role) -- 2.39.5