timer(g_ceph_context, lock),
active_mgr(nullptr),
orig_argc(argc),
- orig_argv(argv)
+ orig_argv(argv),
+ available_in_map(false)
{
}
set<string> modules;
PyModules::list_modules(&modules);
+
+ // Whether I think I am available (request MgrMonitor to set me
+ // as available in the map)
bool available = active_mgr != nullptr && active_mgr->is_initialized();
+
auto addr = available ? active_mgr->get_server_addr() : entity_addr_t();
dout(10) << "sending beacon as gid " << monc.get_global_id()
<< " modules " << modules << dendl;
+ map<string,string> metadata;
+ collect_sys_info(&metadata, g_ceph_context);
+
MMgrBeacon *m = new MMgrBeacon(monc.get_fsid(),
monc.get_global_id(),
g_conf->name.get_id(),
addr,
available,
- modules);
+ modules,
+ std::move(metadata));
+
+ if (available && !available_in_map) {
+ // We are informing the mon that we are done initializing: inform
+ // it of our command set. This has to happen after init() because
+ // it needs the python modules to have loaded.
+ m->set_command_descs(active_mgr->get_command_set());
+ dout(4) << "going active, including " << m->get_command_descs().size()
+ << " commands in beacon" << dendl;
+ }
+
monc.send_mon_message(m);
}
void MgrStandby::handle_mgr_map(MMgrMap* mmap)
{
- auto map = mmap->get_map();
+ auto &map = mmap->get_map();
dout(4) << "received map epoch " << map.get_epoch() << dendl;
const bool active_in_map = map.active_gid == monc.get_global_id();
dout(4) << "active in map: " << active_in_map
respawn();
}
}
+
+ if (!available_in_map && map.get_available()) {
+ dout(4) << "Map now says I am available" << dendl;
+ available_in_map = true;
+ }
} else {
if (active_mgr != nullptr) {
derr << "I was active but no longer am" << dendl;