]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MMgrConfigure.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MMgrConfigure.h
CommitLineData
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 26class MMgrConfigure : public Message {
11fdf7f2 27private:
9f95a23c 28 static constexpr int HEAD_VERSION = 4;
11fdf7f2 29 static constexpr int COMPAT_VERSION = 1;
7c673cae
FG
30
31public:
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);
f67539c2
TL
62 if (metric_config_message && metric_config_message->should_encode(features)) {
63 encode(metric_config_message, payload);
64 } else {
65 boost::optional<MetricConfigMessage> empty;
66 encode(empty, payload);
67 }
7c673cae
FG
68 }
69
11fdf7f2 70 std::string_view get_type_name() const override { return "mgrconfigure"; }
9f95a23c 71 void print(std::ostream& out) const override {
3efd9988 72 out << get_type_name() << "(period=" << stats_period
9f95a23c 73 << ", threshold=" << stats_threshold << ")";
7c673cae
FG
74 }
75
9f95a23c 76private:
7c673cae 77 MMgrConfigure()
9f95a23c 78 : Message{MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION}
7c673cae 79 {}
9f95a23c
TL
80 using RefCountedObject::put;
81 using RefCountedObject::get;
82 template<class T, typename... Args>
83 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
84};
85
86#endif
87