From 5dcf3676a6de4adac507bff8f597a2d5ca8951fb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 12 Apr 2019 15:58:35 -0500 Subject: [PATCH] common/options: mark cluster log options with FLAG_RUNTIME, use get_val We already have observers set up for these; switch to using the runtime-safe accessor and flag them. Signed-off-by: Sage Weil --- .../dashboard/test_cluster_configuration.py | 10 ++-- src/common/LogClient.cc | 33 ++++++----- src/common/options.cc | 18 ++++++ src/mon/LogMonitor.cc | 56 +++++++++++-------- 4 files changed, 75 insertions(+), 42 deletions(-) diff --git a/qa/tasks/mgr/dashboard/test_cluster_configuration.py b/qa/tasks/mgr/dashboard/test_cluster_configuration.py index fd9298f56bc..2a718447c1c 100644 --- a/qa/tasks/mgr/dashboard/test_cluster_configuration.py +++ b/qa/tasks/mgr/dashboard/test_cluster_configuration.py @@ -66,7 +66,7 @@ class ClusterConfigurationTest(DashboardTestCase): self._reset_original_values(config_name, orig_value) def test_create_cant_update_at_runtime(self): - config_name = 'clog_to_syslog' # not updatable + config_name = 'public_bind_addr' # not updatable config_value = [{'section': 'global', 'value': 'true'}] orig_value = self._get_config_by_name(config_name) @@ -183,8 +183,8 @@ class ClusterConfigurationTest(DashboardTestCase): def test_bulk_set_cant_update_at_runtime(self): config_options = { - 'clog_to_syslog': {'section': 'global', 'value': 'true'}, # not updatable - 'clog_to_graylog': {'section': 'global', 'value': 'true'} # not updatable + 'public_bind_addr': {'section': 'global', 'value': '1.2.3.4:567'}, # not updatable + 'public_network': {'section': 'global', 'value': '10.0.0.0/8'} # not updatable } orig_values = dict() @@ -207,7 +207,7 @@ class ClusterConfigurationTest(DashboardTestCase): def test_bulk_set_cant_update_at_runtime_partial(self): config_options = { - 'clog_to_syslog': {'section': 'global', 'value': 'true'}, # not updatable + 'public_bind_addr': {'section': 'global', 'value': 'true'}, # not updatable 'log_to_stderr': {'section': 'global', 'value': 'true'} # updatable } orig_values = dict() @@ -221,7 +221,7 @@ class ClusterConfigurationTest(DashboardTestCase): self.assertError(code='config_option_not_updatable_at_runtime', component='cluster_configuration', detail='Config option {} is/are not updatable at runtime'.format( - 'clog_to_syslog')) + 'public_bind_addr')) # check if config option values are still the original ones for config_name, value in orig_values.items(): diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index 951588ff44b..982bbe35b49 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -35,50 +35,57 @@ int parse_log_client_options(CephContext *cct, { ostringstream oss; - int r = get_conf_str_map_helper(cct->_conf->clog_to_monitors, oss, - &log_to_monitors, CLOG_CONFIG_DEFAULT_KEY); + int r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_monitors"), oss, + &log_to_monitors, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_monitors'" << dendl; return r; } - r = get_conf_str_map_helper(cct->_conf->clog_to_syslog, oss, + r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_syslog"), oss, &log_to_syslog, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_syslog'" << dendl; return r; } - r = get_conf_str_map_helper(cct->_conf->clog_to_syslog_facility, oss, - &log_channels, CLOG_CONFIG_DEFAULT_KEY); + r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_syslog_facility"), oss, + &log_channels, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_syslog_facility'" << dendl; return r; } - r = get_conf_str_map_helper(cct->_conf->clog_to_syslog_level, oss, - &log_prios, CLOG_CONFIG_DEFAULT_KEY); + r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_syslog_level"), oss, + &log_prios, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_syslog_level'" << dendl; return r; } - r = get_conf_str_map_helper(cct->_conf->clog_to_graylog, oss, - &log_to_graylog, CLOG_CONFIG_DEFAULT_KEY); + r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_graylog"), oss, + &log_to_graylog, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_graylog'" << dendl; return r; } - r = get_conf_str_map_helper(cct->_conf->clog_to_graylog_host, oss, - &log_to_graylog_host, CLOG_CONFIG_DEFAULT_KEY); + r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_graylog_host"), oss, + &log_to_graylog_host, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_graylog_host'" << dendl; return r; } - r = get_conf_str_map_helper(cct->_conf->clog_to_graylog_port, oss, - &log_to_graylog_port, CLOG_CONFIG_DEFAULT_KEY); + r = get_conf_str_map_helper( + cct->_conf.get_val("clog_to_graylog_port"), oss, + &log_to_graylog_port, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_graylog_port'" << dendl; return r; diff --git a/src/common/options.cc b/src/common/options.cc index 4be614f1711..dd025aac2c4 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -634,67 +634,80 @@ std::vector