mon: emit clog messages on manager changes

Signed-off-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2017-06-29 08:05:54 -04:00
parent f25763208f
commit ba45fba01c

View File

@ -181,6 +181,8 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
&& m->get_gid() != pending_map.active_gid)
{
dout(4) << "Active daemon restart (mgr." << m->get_name() << ")" << dendl;
mon->clog->info() << "Active manager daemon " << m->get_name()
<< " restarted";
drop_active();
}
@ -189,6 +191,8 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
const StandbyInfo &s = i.second;
if (s.name == m->get_name() && s.gid != m->get_gid()) {
dout(4) << "Standby daemon restart (mgr." << m->get_name() << ")" << dendl;
mon->clog->debug() << "Standby manager daemon " << m->get_name()
<< " restarted";
drop_standby(i.first);
break;
}
@ -210,6 +214,8 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
if (pending_map.get_available() != m->get_available()) {
dout(4) << "available " << m->get_gid() << dendl;
mon->clog->info() << "Manager daemon " << pending_map.active_name
<< " is now available";
pending_map.available = m->get_available();
updated = true;
}
@ -232,6 +238,9 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
pending_map.active_name = m->get_name();
pending_map.available_modules = m->get_available_modules();
mon->clog->info() << "Activating manager daemon "
<< pending_map.active_name;
updated = true;
} else {
if (pending_map.standbys.count(m->get_gid()) > 0) {
@ -248,8 +257,8 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
}
} else {
dout(10) << "new standby " << m->get_gid() << dendl;
pending_map.standbys[m->get_gid()] = {m->get_gid(), m->get_name(),
m->get_available_modules()};
mon->clog->debug() << "Standby manager daemon " << m->get_name()
<< " started";
updated = true;
}
}
@ -418,18 +427,25 @@ void MgrMonitor::tick()
if (pending_map.active_gid != 0
&& last_beacon.at(pending_map.active_gid) < cutoff) {
const std::string old_active_name = pending_map.active_name;
drop_active();
propose = true;
dout(4) << "Dropping active" << pending_map.active_gid << dendl;
if (promote_standby()) {
dout(4) << "Promoted standby " << pending_map.active_gid << dendl;
mon->clog->info() << "Manager daemon " << old_active_name
<< " is unresponsive, replacing it with standby"
<< " daemon " << pending_map.active_name;
} else {
dout(4) << "Active is laggy but have no standbys to replace it" << dendl;
mon->clog->warn() << "Manager daemon " << old_active_name
<< " is unresponsive. No standby daemons available.";
}
} else if (pending_map.active_gid == 0) {
if (promote_standby()) {
dout(4) << "Promoted standby " << pending_map.active_gid << dendl;
mon->clog->info() << "Activating manager daemon "
<< pending_map.active_name;
propose = true;
}
}