]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tasks/cephfs: add test_standby_for_invalid_fscid
authorRamakrishnan <ramakrishnan@dhcp35-178.lab.eng.blr.redhat.com>
Wed, 9 Nov 2016 09:31:55 +0000 (15:01 +0530)
committerJohn Spray <john.spray@redhat.com>
Tue, 6 Dec 2016 23:34:22 +0000 (23:34 +0000)
Signed-off-by: Ramakrishnan Periyasamy <rperiyas@redhat.com>
tasks/cephfs/test_failover.py

index ff9919dce957c5aa1eca12702eefa1c6e3397844..f91822eb7ffa196bdf0dce382e3ff9ee35b12277 100644 (file)
@@ -3,6 +3,8 @@ import logging
 from unittest import case
 from cephfs_test_case import CephFSTestCase
 from teuthology.exceptions import CommandFailedError
+from tasks.ceph_manager import CephManager
+from teuthology import misc as teuthology
 
 log = logging.getLogger(__name__)
 
@@ -570,3 +572,60 @@ class TestMultiFilesystems(CephFSTestCase):
         fs_b.wait_for_daemons()
         self.assertEqual(set(fs_a.get_active_names()), {mds_a, mds_b})
         self.assertEqual(set(fs_b.get_active_names()), {mds_c, mds_d})
+
+    def test_standby_for_invalid_fscid(self):
+        # Set invalid standby_fscid with other mds standby_rank
+        # stopping active mds service should not end up in mon crash
+
+        # Get configured mons in the cluster
+        first_mon = teuthology.get_first_mon(self.ctx, self.configs_set)
+        (mon,) = self.ctx.cluster.only(first_mon).remotes.iterkeys()
+        manager = CephManager(
+            mon,
+            ctx=self.ctx,
+            logger=log.getChild('ceph_manager'),
+        )
+        configured_mons = manager.get_mon_quorum()
+
+        use_daemons = sorted(self.mds_cluster.mds_ids[0:3])
+        mds_a, mds_b, mds_c = use_daemons
+        log.info("Using MDS daemons: {0}".format(use_daemons))
+
+        def set_standby_for_rank(leader_rank, follower_id):
+            self.set_conf("mds.{0}".format(follower_id),
+                          "mds_standby_for_rank", leader_rank)
+
+        # Create one fs
+        fs_a = self.mds_cluster.newfs("cephfs")
+
+        # Set all the daemons to have a rank assignment but no other
+        # standby preferences.
+        set_standby_for_rank(0, mds_a)
+        set_standby_for_rank(0, mds_b)
+
+        # Set third daemon to have invalid fscid assignment and no other
+        # standby preferences
+        invalid_fscid = 123
+        self.set_conf("mds.{0}".format(mds_c), "mds_standby_for_fscid", invalid_fscid)
+
+        #Restart all the daemons to make the standby preference applied
+        self.mds_cluster.mds_restart(mds_a)
+        self.mds_cluster.mds_restart(mds_b)
+        self.mds_cluster.mds_restart(mds_c)
+        self.wait_for_daemon_start([mds_a, mds_b, mds_c])
+
+        #Stop active mds daemon service of fs
+        if (fs_a.get_active_names(), [mds_a]):
+            self.mds_cluster.mds_stop(mds_a)
+            self.mds_cluster.mds_fail(mds_a)
+            fs_a.wait_for_daemons()
+        else:
+            self.mds_cluster.mds_stop(mds_b)
+            self.mds_cluster.mds_fail(mds_b)
+            fs_a.wait_for_daemons()
+
+        #Get active mons from cluster
+        active_mons = manager.get_mon_quorum()
+
+        #Check for active quorum mon status and configured mon status
+        self.assertEqual(active_mons, configured_mons, "Not all mons are in quorum Invalid standby invalid fscid test failed!")