From 14d26adf7563beda7f04a06c8d72b8fd226e4199 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 17 Nov 2018 06:50:17 -0600 Subject: [PATCH] mon/MonClient: add callback for (any) config change This is a coarse "there was some config update". It's fired whether or not it values are observed. Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 3 +++ src/mon/MonClient.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index e78cd9d0420..b408f95c5d4 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -374,6 +374,9 @@ void MonClient::handle_config(MConfig *m) ldout(cct,10) << __func__ << " " << *m << dendl; finisher.queue(new FunctionContext([this, m](int r) { cct->_conf.set_mon_vals(cct, m->config, config_cb); + if (config_notify_cb) { + config_notify_cb(); + } m->put(); })); got_config = true; diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 4d0755c1469..b16a7f22f1a 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -439,6 +439,9 @@ public: } void register_config_callback(md_config_t::config_callback fn); + void register_config_notify_callback(std::function f) { + config_notify_cb = f; + } md_config_t::config_callback get_config_callback(); private: @@ -453,6 +456,7 @@ private: void handle_get_version_reply(MMonGetVersionReply* m); md_config_t::config_callback config_cb; + std::function config_notify_cb; }; #endif -- 2.39.5