]>
git.proxmox.com Git - ceph.git/blob - 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
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2016 John Spray <john.spray@redhat.com>
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.
15 #ifndef CEPH_MMGRCONFIGURE_H_
16 #define CEPH_MMGRCONFIGURE_H_
18 #include "msg/Message.h"
19 #include "mgr/MetricTypes.h"
20 #include "mgr/OSDPerfMetricTypes.h"
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.
26 class MMgrConfigure
: public Message
{
28 static constexpr int HEAD_VERSION
= 4;
29 static constexpr int COMPAT_VERSION
= 1;
32 uint32_t stats_period
= 0;
34 // Default 0 means if unspecified will include all stats
35 uint32_t stats_threshold
= 0;
37 std::map
<OSDPerfMetricQuery
, OSDPerfMetricLimits
> osd_perf_metric_queries
;
39 boost::optional
<MetricConfigMessage
> metric_config_message
;
41 void decode_payload() override
44 auto p
= payload
.cbegin();
45 decode(stats_period
, p
);
46 if (header
.version
>= 2) {
47 decode(stats_threshold
, p
);
49 if (header
.version
>= 3) {
50 decode(osd_perf_metric_queries
, p
);
52 if (header
.version
>= 4) {
53 decode(metric_config_message
, p
);
57 void encode_payload(uint64_t features
) override
{
59 encode(stats_period
, payload
);
60 encode(stats_threshold
, payload
);
61 encode(osd_perf_metric_queries
, payload
);
62 if (metric_config_message
&& metric_config_message
->should_encode(features
)) {
63 encode(metric_config_message
, payload
);
65 boost::optional
<MetricConfigMessage
> empty
;
66 encode(empty
, payload
);
70 std::string_view
get_type_name() const override
{ return "mgrconfigure"; }
71 void print(std::ostream
& out
) const override
{
72 out
<< get_type_name() << "(period=" << stats_period
73 << ", threshold=" << stats_threshold
<< ")";
78 : Message
{MSG_MGR_CONFIGURE
, HEAD_VERSION
, COMPAT_VERSION
}
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
);
84 template<class T
, typename
... Args
>
85 friend MURef
<T
> crimson::make_message(Args
&&... args
);