]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
since the roles are mapped inside ceph-deploy, store the roles that
authorVasu Kulkarni <vasu@redhat.com>
Sat, 29 Jul 2017 06:11:41 +0000 (23:11 -0700)
committerVasu Kulkarni <vasu@redhat.com>
Thu, 7 Sep 2017 19:22:57 +0000 (12:22 -0700)
are mapped and use the new mapped role for upgrades during later
stage.

eg: mon.a is mapped to mon.mira002 during install, store this mapping
and durig upgrade map it back to appropriate name to find the hostname
with that role

Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
qa/tasks/ceph_deploy.py

index 7dd54d3c8c0aaef801e9b8591739459ada1a8fb8..fc17892a27ca99b2901acb6d348d3f66055a6fd8 100644 (file)
@@ -147,7 +147,7 @@ def get_nodes_using_role(ctx, target_role):
 
     # Prepare a modified version of cluster.remotes with ceph-deploy-ized names
     modified_remotes = {}
-
+    ceph_deploy_mapped = dict()
     for _remote, roles_for_host in ctx.cluster.remotes.iteritems():
         modified_remotes[_remote] = []
         for svc_id in roles_for_host:
@@ -158,13 +158,16 @@ def get_nodes_using_role(ctx, target_role):
                     nodes_of_interest.append(fqdn)
                 else:
                     nodes_of_interest.append(nodename)
-
-                modified_remotes[_remote].append(
-                    "{0}.{1}".format(target_role, nodename))
+                mapped_role = "{0}.{1}".format(target_role, nodename)
+                modified_remotes[_remote].append(mapped_role)
+                # keep dict of mapped role for later use by tasks
+                # eg. mon.a => mon.node1
+                ceph_deploy_mapped[svc_id] = mapped_role
             else:
                 modified_remotes[_remote].append(svc_id)
 
     ctx.cluster.remotes = modified_remotes
+    ctx.cluster.mapped_role = ceph_deploy_mapped
 
     return nodes_of_interest
 
@@ -707,6 +710,9 @@ def upgrade(ctx, config):
               osd.0
      """
     roles = config.get('roles')
+    # get the roles that are mapped as per ceph-deploy
+    # roles are mapped for mon/mds eg: mon.a  => mon.host_short_name
+    mapped_role = ctx.cluster.mapped_role
     if config.get('branch'):
         branch = config.get('branch')
         (var, val) = branch.items()[0]
@@ -715,10 +721,14 @@ def upgrade(ctx, config):
         # default to master
         ceph_branch = '--dev=master'
     # get the node used for initial deployment which is mon.a
-    (ceph_admin,) = ctx.cluster.only('mon.a').remotes.iterkeys()
+    mon_a = mapped_role.get('mon.a')
+    (ceph_admin,) = ctx.cluster.only(mon_a).remotes.iterkeys()
     testdir = teuthology.get_testdir(ctx)
     cmd = './ceph-deploy install ' + ceph_branch
     for role in roles:
+        # check if this role is mapped (mon or mds)
+        if mapped_role.get(role):
+            role = mapped_role.get(role)
         remotes_and_roles = ctx.cluster.only(role).remotes
         for remote, roles in remotes_and_roles.iteritems():
             nodename = remote.shortname