Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MMonMgrReport.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2017 Greg Farnum/Red Hat <gfarnum@redhat.com>
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15 #ifndef CEPH_MMONMGRREPORT_H
16 #define CEPH_MMONMGRREPORT_H
17
18 #include "messages/PaxosServiceMessage.h"
19 #include "include/types.h"
20 #include "include/health.h"
21 #include "mon/health_check.h"
22
23 class MMonMgrReport : public PaxosServiceMessage {
24
25   static const int HEAD_VERSION = 1;
26   static const int COMPAT_VERSION = 1;
27
28 public:
29   // PGMapDigest is in data payload
30   health_check_map_t health_checks;
31   bufferlist service_map_bl;  // encoded ServiceMap
32
33   MMonMgrReport()
34     : PaxosServiceMessage(MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION)
35   {}
36 private:
37   ~MMonMgrReport() override {}
38
39 public:
40   const char *get_type_name() const override { return "monmgrreport"; }
41
42   void print(ostream& out) const override {
43     out << get_type_name() << "(" << health_checks.checks.size() << " checks)";
44   }
45
46   void encode_payload(uint64_t features) override {
47     paxos_encode();
48     ::encode(health_checks, payload);
49     ::encode(service_map_bl, payload);
50   }
51   void decode_payload() override {
52     bufferlist::iterator p = payload.begin();
53     paxos_decode(p);
54     ::decode(health_checks, p);
55     ::decode(service_map_bl, p);
56   }
57 };
58
59 #endif