From: Kefu Chai Date: Fri, 10 Jan 2020 05:28:10 +0000 (+0800) Subject: qa/tasks/mgr: set mgr module option with --force X-Git-Tag: v15.1.0~265^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7210d7f951c479436147a63aef43a54e27eda70d;p=ceph.git qa/tasks/mgr: set mgr module option with --force 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 --- diff --git a/qa/tasks/mgr/mgr_test_case.py b/qa/tasks/mgr/mgr_test_case.py index 2830829e72506..70faa2a2b4f98 100644 --- a/qa/tasks/mgr/mgr_test_case.py +++ b/qa/tasks/mgr/mgr_test_case.py @@ -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: