]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
code changes for multiple rgw daemons in single host 1446/head
authorsunilkumarn417 <sunnagar@redhat.com>
Mon, 13 Apr 2020 19:06:01 +0000 (00:36 +0530)
committersunilkumarn417 <sunnagar@redhat.com>
Mon, 13 Apr 2020 19:06:01 +0000 (00:36 +0530)
Signed-off-by: sunilkumarn417 <sunnagar@redhat.com>
teuthology/orchestra/daemon/systemd.py
teuthology/task/ceph_ansible.py

index 7651808a2ea2a88081a8bb4b0bf6d8ea75998218..17b144d2010a720dd6fdff247bc340686234bf55 100644 (file)
@@ -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
index 781a55992dd3d209b5c69dbdf0c3a08d1baa5633..7bd30698dd4f663c7feba260ac39964996d32b39 100644 (file)
@@ -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)