mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
qa/tasks/ceph: simplify mon_health_to_clog suppression during restart
This only does one thing--do that. More simply. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
10ffeef1fb
commit
be05f210e7
@ -1532,37 +1532,27 @@ def created_pool(ctx, config):
|
|||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def tweaked_option(ctx, config):
|
def suppress_mon_health_to_clog(ctx, config):
|
||||||
"""
|
"""
|
||||||
set an option, and then restore it with its original value
|
set the option, and then restore it with its original value
|
||||||
|
|
||||||
Note, due to the way how tasks are executed/nested, it's not suggested to
|
Note, due to the way how tasks are executed/nested, it's not suggested to
|
||||||
use this method as a standalone task. otherwise, it's likely that it will
|
use this method as a standalone task. otherwise, it's likely that it will
|
||||||
restore the tweaked option at the /end/ of 'tasks' block.
|
restore the tweaked option at the /end/ of 'tasks' block.
|
||||||
"""
|
"""
|
||||||
saved_options = {}
|
if config.get('mon-health-to-clog', 'true') == 'false':
|
||||||
# we can complicate this when necessary
|
saved_options = {}
|
||||||
options = ['mon-health-to-clog']
|
cluster = config.get('cluster', 'ceph')
|
||||||
type_, id_ = 'mon', '*'
|
manager = ctx.managers[cluster]
|
||||||
cluster = config.get('cluster', 'ceph')
|
manager.raw_cluster_command(
|
||||||
manager = ctx.managers[cluster]
|
'config', 'set', 'mon', 'mon_health_to_clog', 'false'
|
||||||
if id_ == '*':
|
)
|
||||||
get_from = next(teuthology.all_roles_of_type(ctx.cluster, type_))
|
yield
|
||||||
|
manager.raw_cluster_command(
|
||||||
|
'config', 'rm', 'mon', 'mon_health_to_clog'
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
get_from = id_
|
yield
|
||||||
for option in options:
|
|
||||||
if option not in config:
|
|
||||||
continue
|
|
||||||
value = 'true' if config[option] else 'false'
|
|
||||||
option = option.replace('-', '_')
|
|
||||||
old_value = manager.get_config(type_, get_from, option)
|
|
||||||
if value != old_value:
|
|
||||||
saved_options[option] = old_value
|
|
||||||
manager.inject_args(type_, id_, option, value)
|
|
||||||
yield
|
|
||||||
for option, value in saved_options.items():
|
|
||||||
manager.inject_args(type_, id_, option, value)
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def restart(ctx, config):
|
def restart(ctx, config):
|
||||||
@ -1596,7 +1586,7 @@ def restart(ctx, config):
|
|||||||
daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES, True)
|
daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES, True)
|
||||||
clusters = set()
|
clusters = set()
|
||||||
|
|
||||||
with tweaked_option(ctx, config):
|
with suppress_mon_health_to_clog(ctx, config):
|
||||||
for role in daemons:
|
for role in daemons:
|
||||||
cluster, type_, id_ = teuthology.split_role(role)
|
cluster, type_, id_ = teuthology.split_role(role)
|
||||||
ctx.daemons.get_daemon(type_, id_, cluster).stop()
|
ctx.daemons.get_daemon(type_, id_, cluster).stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user