]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/mgr: set mgr module option with --force 32588/head
authorKefu Chai <kchai@redhat.com>
Fri, 10 Jan 2020 05:28:10 +0000 (13:28 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 10 Jan 2020 05:28:34 +0000 (13:28 +0800)
if mgr is not active, monitor will refuse to set any option consumed by
mgr modules.

the reason the tests pass somtimes is that, we have a racing here:

1. stop all mgr daemons
2. MgrMonitor gets updated and updates its mgr_module_options
accordingly.
3. in TestDashboard.setUp(), we reset the port number for dashboard
using "ceph config set mgr mgr/dashboard/y/ssl_server_port 7789"
4. restart all mgr daemons

but the 2nd step and 3rd step could race with each other, if the 2nd
step happens after 3rd step, the test passes. otherwise it fails.

in this change, "--force" is passed to the "ceph config set" command,
so ConfigMonitor can bypass the sanity test for the option, and just
set this option.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/mgr/mgr_test_case.py

index 2830829e72506ba0c9e731c136efe7870a99c6f4..70faa2a2b4f98f2aa471bff5aed297262d25445a 100644 (file)
@@ -49,11 +49,13 @@ class MgrCluster(CephCluster):
                                              module, key
                                          ), val)
 
-    def set_module_localized_conf(self, module, mgr_id, key, val):
-        self.mon_manager.raw_cluster_cmd("config", "set", "mgr",
-                                         "mgr/{0}/{1}/{2}".format(
-                                             module, mgr_id, key
-                                         ), val)
+    def set_module_localized_conf(self, module, mgr_id, key, val, force):
+        cmd = ["config", "set", "mgr",
+               "/".join(["mgr", module, mgr_id, key]),
+               val]
+        if force:
+            cmd.append("--force")
+        self.mon_manager.raw_cluster_cmd(*cmd)
 
 
 class MgrTestCase(CephTestCase):
@@ -199,7 +201,8 @@ class MgrTestCase(CephTestCase):
             ))
             cls.mgr_cluster.set_module_localized_conf(module_name, mgr_id,
                                                       config_name,
-                                                      str(assign_port))
+                                                      str(assign_port),
+                                                      force=True)
             assign_port += 1
 
         for mgr_id in cls.mgr_cluster.mgr_ids: