The Observer class we defined to observe conf changes and thus avoid
triggering #5205 (as fixed by
eb86eebe1ba42f04b46f7c3e3419b83eb6fe7f9a),
was returning always the same const static array, which would lead us to
always populate the observer's list with an observer for 'public_addr'.
This would of course become a problem when trying to obtain the observer
for 'cluster_add' during md_config_t::set_val() -- thus triggering the
same assert as initially reported on #5205.
Backport: cuttlefish
Fixes: #5205
Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit
7ed6de9dd7aed59f3c5dd93e012cf080bcc36d8a)
// observe this change
struct Observer : public md_config_obs_t {
- const char *conf_var;
- Observer(const char *c) : conf_var(c) {}
+ const char *keys[2];
+ Observer(const char *c) {
+ keys[0] = c;
+ keys[1] = NULL;
+ }
const char** get_tracked_conf_keys() const {
- static const char *foo[] = {
- conf_var,
- NULL
- };
- return foo;
+ return (const char **)keys;
}
void handle_conf_change(const struct md_config_t *conf,
const std::set <std::string> &changed) {