Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MMgrConfigure.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) 2016 John Spray <john.spray@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_MMGRCONFIGURE_H_
16 #define CEPH_MMGRCONFIGURE_H_
17
18 #include "msg/Message.h"
19
20 /**
21  * This message is sent from ceph-mgr to MgrClient, instructing it
22  * it about what data to send back to ceph-mgr at what frequency.
23  */
24 class MMgrConfigure : public Message
25 {
26   static const int HEAD_VERSION = 2;
27   static const int COMPAT_VERSION = 1;
28
29 public:
30   uint32_t stats_period;
31   
32   // Default 0 means if unspecified will include all stats
33   uint32_t stats_threshold = 0;
34
35   void decode_payload() override
36   {
37     bufferlist::iterator p = payload.begin();
38     ::decode(stats_period, p);
39     if (header.version >= 2) {
40       ::decode(stats_threshold, p);
41     }
42   }
43
44   void encode_payload(uint64_t features) override {
45     ::encode(stats_period, payload);
46     ::encode(stats_threshold, payload);
47   }
48
49   const char *get_type_name() const override { return "mgrconfigure"; }
50   void print(ostream& out) const override {
51     out << get_type_name() << "(period=" << stats_period
52                            << ", threshold=" << stats_threshold << ")";
53   }
54
55   MMgrConfigure()
56     : Message(MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION)
57   {}
58 };
59
60 #endif
61