}
});
+ want_bootstrap_config = true;
+ auto shutdown_config = make_scope_guard([this] {
+ std::unique_lock l(monc_lock);
+ want_bootstrap_config = false;
+ bootstrap_config.reset();
+ });
+
+ ceph::ref_t<MConfig> config;
while (tries-- > 0) {
r = init();
if (r < 0) {
r = 0;
break;
}
- while ((!got_config || monmap.get_epoch() == 0) && r == 0) {
+ while ((!bootstrap_config || monmap.get_epoch() == 0) && r == 0) {
ldout(cct,20) << __func__ << " waiting for monmap|config" << dendl;
map_cond.wait_for(l, ceph::make_timespan(
cct->_conf->mon_client_hunt_interval));
}
- if (got_config) {
+
+ if (bootstrap_config) {
ldout(cct,10) << __func__ << " success" << dendl;
+ config = std::move(bootstrap_config);
r = 0;
break;
}
continue;
}
+ if (config) {
+ // apply the bootstrap config to ensure its applied prior to completing
+ // the bootstrap
+ cct->_conf.set_mon_vals(cct, config->config, config_cb);
+ }
+
shutdown();
return r;
}
void MonClient::handle_config(MConfig *m)
{
ldout(cct,10) << __func__ << " " << *m << dendl;
+
+ if (want_bootstrap_config) {
+ // get_monmap_and_config is waiting for config which it will apply
+ // synchronously
+ bootstrap_config = ceph::ref_t<MConfig>(m, false);
+ map_cond.notify_all();
+ return;
+ }
+
// Take the sledgehammer approach to ensuring we don't depend on
// anything in MonClient.
boost::asio::defer(finish_strand,
}
m->put();
});
- got_config = true;
- map_cond.notify_all();
}
// ----------------------
bool want_monmap;
ceph::condition_variable map_cond;
bool passthrough_monmap = false;
- bool got_config = false;
+
+ bool want_bootstrap_config = false;
+ ceph::ref_t<MConfig> bootstrap_config;
// authenticate
std::unique_ptr<AuthClientHandler> auth;