]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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" | |
9f95a23c | 19 | #include "mgr/MetricTypes.h" |
11fdf7f2 | 20 | #include "mgr/OSDPerfMetricTypes.h" |
7c673cae FG |
21 | |
22 | /** | |
23 | * This message is sent from ceph-mgr to MgrClient, instructing it | |
24 | * it about what data to send back to ceph-mgr at what frequency. | |
25 | */ | |
9f95a23c | 26 | class MMgrConfigure : public Message { |
11fdf7f2 | 27 | private: |
9f95a23c | 28 | static constexpr int HEAD_VERSION = 4; |
11fdf7f2 | 29 | static constexpr int COMPAT_VERSION = 1; |
7c673cae FG |
30 | |
31 | public: | |
11fdf7f2 TL |
32 | uint32_t stats_period = 0; |
33 | ||
3efd9988 FG |
34 | // Default 0 means if unspecified will include all stats |
35 | uint32_t stats_threshold = 0; | |
7c673cae | 36 | |
11fdf7f2 TL |
37 | std::map<OSDPerfMetricQuery, OSDPerfMetricLimits> osd_perf_metric_queries; |
38 | ||
9f95a23c TL |
39 | boost::optional<MetricConfigMessage> metric_config_message; |
40 | ||
7c673cae FG |
41 | void decode_payload() override |
42 | { | |
9f95a23c | 43 | using ceph::decode; |
11fdf7f2 TL |
44 | auto p = payload.cbegin(); |
45 | decode(stats_period, p); | |
3efd9988 | 46 | if (header.version >= 2) { |
11fdf7f2 TL |
47 | decode(stats_threshold, p); |
48 | } | |
49 | if (header.version >= 3) { | |
50 | decode(osd_perf_metric_queries, p); | |
3efd9988 | 51 | } |
9f95a23c TL |
52 | if (header.version >= 4) { |
53 | decode(metric_config_message, p); | |
54 | } | |
7c673cae FG |
55 | } |
56 | ||
57 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
58 | using ceph::encode; |
59 | encode(stats_period, payload); | |
60 | encode(stats_threshold, payload); | |
61 | encode(osd_perf_metric_queries, payload); | |
9f95a23c | 62 | encode(metric_config_message, payload); |
7c673cae FG |
63 | } |
64 | ||
11fdf7f2 | 65 | std::string_view get_type_name() const override { return "mgrconfigure"; } |
9f95a23c | 66 | void print(std::ostream& out) const override { |
3efd9988 | 67 | out << get_type_name() << "(period=" << stats_period |
9f95a23c | 68 | << ", threshold=" << stats_threshold << ")"; |
7c673cae FG |
69 | } |
70 | ||
9f95a23c | 71 | private: |
7c673cae | 72 | MMgrConfigure() |
9f95a23c | 73 | : Message{MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION} |
7c673cae | 74 | {} |
9f95a23c TL |
75 | using RefCountedObject::put; |
76 | using RefCountedObject::get; | |
77 | template<class T, typename... Args> | |
78 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
79 | }; |
80 | ||
81 | #endif | |
82 |