]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/MDSDaemon.h
916062fd0609f22feb9b8059b4f27a68fb6e1160
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) 2004-2006 Sage Weil <sage@newdream.net>
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.
18 #include <string_view>
20 #include "messages/MCommand.h"
21 #include "messages/MCommandReply.h"
22 #include "messages/MGenericMessage.h"
23 #include "messages/MMDSMap.h"
24 #include "messages/MMonCommand.h"
26 #include "common/LogClient.h"
27 #include "common/Mutex.h"
28 #include "common/Timer.h"
29 #include "include/Context.h"
30 #include "include/types.h"
31 #include "mgr/MgrClient.h"
32 #include "msg/Dispatcher.h"
38 #define CEPH_MDS_PROTOCOL 34 /* cluster internal */
43 class MDSDaemon
: public Dispatcher
, public md_config_obs_t
{
45 /* Global MDS lock: every time someone takes this, they must
46 * also check the `stopping` flag. If stopping is true, you
47 * must either do nothing and immediately drop the lock, or
48 * never drop the lock again (i.e. call respawn()) */
53 std::string gss_ktfile_client
{};
55 mono_time
get_starttime() const {
58 chrono::duration
<double> get_uptime() const {
59 mono_time now
= mono_clock::now();
60 return chrono::duration
<double>(now
-starttime
);
71 std::unique_ptr
<MDSMap
> mdsmap
;
75 MDSRankDispatcher
*mds_rank
;
78 MDSDaemon(std::string_view n
, Messenger
*m
, MonClient
*mc
);
79 ~MDSDaemon() override
;
81 const char **orig_argv
;
83 // handle a signal (e.g., SIGTERM)
84 void handle_signal(int signum
);
89 * Hint at whether we were shutdown gracefully (i.e. we were only
90 * in standby, or our rank was stopped). Should be removed once
91 * we handle shutdown properly (e.g. clear out all message queues)
92 * such that deleting xlists doesn't assert.
94 bool is_clean_shutdown();
96 // config observer bits
97 const char** get_tracked_conf_keys() const override
;
98 void handle_conf_change(const ConfigProxy
& conf
,
99 const std::set
<std::string
> &changed
) override
;
101 // tick and other timer fun
102 Context
*tick_event
= nullptr;
105 void wait_for_omap_osds();
108 bool ms_dispatch2(const Message::ref
&m
) override
;
109 bool ms_get_authorizer(int dest_type
, AuthAuthorizer
**authorizer
) override
;
110 int ms_handle_authentication(Connection
*con
) override
;
111 KeyStore
*ms_get_auth1_authorizer_keystore() override
;
112 void ms_handle_accept(Connection
*con
) override
;
113 void ms_handle_connect(Connection
*con
) override
;
114 bool ms_handle_reset(Connection
*con
) override
;
115 void ms_handle_remote_reset(Connection
*con
) override
;
116 bool ms_handle_refused(Connection
*con
) override
;
119 // admin socket handling
120 friend class MDSSocketHook
;
121 class MDSSocketHook
*asok_hook
;
122 void set_up_admin_socket();
123 void clean_up_admin_socket();
124 void check_ops_in_flight(); // send off any slow ops to monitor
125 bool asok_command(std::string_view command
, const cmdmap_t
& cmdmap
,
126 std::string_view format
, ostream
& ss
);
128 void dump_status(Formatter
*f
);
131 * Terminate this daemon process.
133 * This function will return, but once it does so the calling thread
134 * must do no more work as all subsystems will have been shut down.
139 * Start a new daemon process with the same command line parameters that
140 * this process was run with, then terminate this process
147 bool handle_core_message(const Message::const_ref
&m
);
149 // special message types
150 friend class C_MDS_Send_Command_Reply
;
151 static void send_command_reply(const MCommand::const_ref
&m
, MDSRank
* mds_rank
, int r
,
152 bufferlist outbl
, std::string_view outs
);
154 const cmdmap_t
&cmdmap
,
155 const MCommand::const_ref
&m
,
160 void handle_command(const MCommand::const_ref
&m
);
161 void handle_mds_map(const MMDSMap::const_ref
&m
);
162 void _handle_mds_map(const MDSMap
&oldmap
);
166 MDSCommand(std::string_view signature
, std::string_view help
)
167 : cmdstring(signature
), helpstring(help
)
170 std::string cmdstring
;
171 std::string helpstring
;
172 std::string module
= "mds";
175 static const std::vector
<MDSCommand
>& get_commands();
177 bool parse_caps(const AuthCapsInfo
&, MDSAuthCaps
&);
179 mono_time starttime
= mono_clock::zero();