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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2020-01-10 13:28:10 +08:00
parent cf2d411251
commit 7210d7f951

View 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: