]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/MDSDaemon.h
86d116da291895a52c3bd7760eaf1aaa340ba2b7
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
{
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 // tick and other timer fun
97 Context
*tick_event
= nullptr;
100 void wait_for_omap_osds();
103 bool ms_dispatch2(const Message::ref
&m
) override
;
104 bool ms_get_authorizer(int dest_type
, AuthAuthorizer
**authorizer
) override
;
105 int ms_handle_authentication(Connection
*con
) override
;
106 KeyStore
*ms_get_auth1_authorizer_keystore() override
;
107 void ms_handle_accept(Connection
*con
) override
;
108 void ms_handle_connect(Connection
*con
) override
;
109 bool ms_handle_reset(Connection
*con
) override
;
110 void ms_handle_remote_reset(Connection
*con
) override
;
111 bool ms_handle_refused(Connection
*con
) override
;
114 // admin socket handling
115 friend class MDSSocketHook
;
116 class MDSSocketHook
*asok_hook
;
117 void set_up_admin_socket();
118 void clean_up_admin_socket();
119 void check_ops_in_flight(); // send off any slow ops to monitor
120 bool asok_command(std::string_view command
, const cmdmap_t
& cmdmap
,
121 std::string_view format
, ostream
& ss
);
123 void dump_status(Formatter
*f
);
126 * Terminate this daemon process.
128 * This function will return, but once it does so the calling thread
129 * must do no more work as all subsystems will have been shut down.
134 * Start a new daemon process with the same command line parameters that
135 * this process was run with, then terminate this process
142 bool handle_core_message(const Message::const_ref
&m
);
144 // special message types
145 friend class C_MDS_Send_Command_Reply
;
146 static void send_command_reply(const MCommand::const_ref
&m
, MDSRank
* mds_rank
, int r
,
147 bufferlist outbl
, std::string_view outs
);
149 const cmdmap_t
&cmdmap
,
150 const MCommand::const_ref
&m
,
155 void handle_command(const MCommand::const_ref
&m
);
156 void handle_mds_map(const MMDSMap::const_ref
&m
);
157 void _handle_mds_map(const MDSMap
&oldmap
);
161 MDSCommand(std::string_view signature
, std::string_view help
)
162 : cmdstring(signature
), helpstring(help
)
165 std::string cmdstring
;
166 std::string helpstring
;
167 std::string module
= "mds";
170 static const std::vector
<MDSCommand
>& get_commands();
172 bool parse_caps(const AuthCapsInfo
&, MDSAuthCaps
&);
174 mono_time starttime
= mono_clock::zero();