* extract send_report() out of tick() so it can be reused.
* add a commmand "mgr report-mon" for mgr, so we are able to flush the
the mgr stats to mon actively without waiting for the tick. this
could help with the tests.
Signed-off-by: Kefu Chai <kchai@redhat.com>
# test with dirty objects in the tier pool
# tier pool currently set to 'writeback'
rados -p cache put /etc/passwd /etc/passwd
- ceph tell osd.\* flush_pg_stats || true
- ceph tell mgr mgr report-mon
+ flush_pg_stats
# 1 dirty object in pool 'cache'
ceph osd tier cache-mode cache proxy
expect_false ceph osd tier cache-mode cache none
# remove object from tier pool
rados -p cache rm /etc/passwd
rados -p cache cache-flush-evict-all
- ceph tell osd.\* flush_pg_stats || true
- ceph tell mgr mgr report-mon
+ flush_pg_stats
# no dirty objects in pool 'cache'
ceph osd tier cache-mode cache proxy
ceph osd tier cache-mode cache none
rados -p cache4 put foo1 $tmpfile
rados -p cache4 put foo2 $tmpfile
rm -f $tmpfile
- ceph tell osd.\* flush_pg_stats || true
- ceph tell mgr mgr report-mon
+ flush_pg_stats
ceph df | grep datapool | grep ' 2 '
ceph osd tier remove-overlay datapool
ceph osd tier remove datapool cache4
#include "messages/PaxosServiceMessage.h"
#include "include/types.h"
-#include "mon/PGMap.h"
// health_status_t
static inline void encode(health_status_t hs, bufferlist& bl) {
~MMonMgrReport() override {}
public:
- bool needs_send = false;
const char *get_type_name() const override { return "monmgrreport"; }
void print(ostream& out) const override {
// that a cut-down set of functionality remains in PGMonitor
// while the full-blown PGMap lives only here.
}
-
-void ClusterState::tick(MMonMgrReport *m)
-{
- dout(10) << __func__ << dendl;
- // FIXME: no easy way to get mon features here. this will do for
- // now, though, as long as we don't make a backward-incompat change.
- pg_map.encode_digest(m->get_data(), CEPH_FEATURES_ALL);
-
- // FIXME: reporting health detail here might be a bad idea?
- with_osdmap([&](const OSDMap& osdmap) {
- pg_map.get_health(g_ceph_context, osdmap,
- m->health_summary,
- &m->health_detail);
- });
- m->needs_send = true;
-}
void notify_osdmap(const OSDMap &osd_map);
- void tick(MMonMgrReport *m);
-
bool have_fsmap() const {
Mutex::Locker l(lock);
return fsmap.get_epoch() > 0;
#include "messages/MMgrOpen.h"
#include "messages/MMgrConfigure.h"
+#include "messages/MMonMgrReport.h"
#include "messages/MCommand.h"
#include "messages/MCommandReply.h"
#include "messages/MPGStats.h"
return true;
}
}
+
+void DaemonServer::send_report()
+{
+ auto m = new MMonMgrReport();
+ cluster_state.with_pgmap([&](const PGMap& pg_map) {
+ // FIXME: no easy way to get mon features here. this will do for
+ // now, though, as long as we don't make a backward-incompat change.
+ pg_map.encode_digest(m->get_data(), CEPH_FEATURES_ALL);
+ // FIXME: reporting health detail here might be a bad idea?
+ cluster_state.with_osdmap([&](const OSDMap& osdmap) {
+ pg_map.get_health(g_ceph_context, osdmap,
+ m->health_summary,
+ &m->health_detail);
+ });
+ });
+ // TODO? We currently do not notify the PyModules
+ // TODO: respect needs_send, so we send the report only if we are asked to do
+ // so, or the state is updated.
+ monc->send_mon_message(m);
+}
bool handle_open(MMgrOpen *m);
bool handle_report(MMgrReport *m);
bool handle_command(MCommand *m);
- void tick(MMonMgrReport *m) {}
+ void send_report();
};
#endif
#include "DaemonServer.h"
#include "messages/MMgrBeacon.h"
#include "messages/MMgrDigest.h"
-#include "messages/MMonMgrReport.h"
#include "messages/MCommand.h"
#include "messages/MCommandReply.h"
#include "messages/MLog.h"
void Mgr::tick()
{
dout(0) << __func__ << dendl;
- MMonMgrReport *m = new MMonMgrReport();
- cluster_state.tick(m);
- server.tick(m);
- // TODO? We currently do not notify the PyModules
- if (m->needs_send) {
- monc->send_mon_message(m);
- }
+ server.send_report();
}