]>
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 MGR_STANDBY_H_ | |
16 | #define MGR_STANDBY_H_ | |
17 | ||
18 | #include "auth/Auth.h" | |
f67539c2 | 19 | #include "common/async/context_pool.h" |
7c673cae FG |
20 | #include "common/Finisher.h" |
21 | #include "common/Timer.h" | |
22 | #include "common/LogClient.h" | |
23 | ||
24 | #include "client/Client.h" | |
25 | #include "mon/MonClient.h" | |
26 | #include "osdc/Objecter.h" | |
3efd9988 | 27 | #include "PyModuleRegistry.h" |
11fdf7f2 | 28 | #include "MgrClient.h" |
7c673cae FG |
29 | |
30 | class MMgrMap; | |
31 | class Mgr; | |
11fdf7f2 | 32 | class PyModuleConfig; |
7c673cae FG |
33 | |
34 | class MgrStandby : public Dispatcher, | |
35 | public md_config_obs_t { | |
36 | public: | |
37 | // config observer bits | |
38 | const char** get_tracked_conf_keys() const override; | |
11fdf7f2 TL |
39 | void handle_conf_change(const ConfigProxy& conf, |
40 | const std::set <std::string> &changed) override; | |
7c673cae FG |
41 | |
42 | protected: | |
f67539c2 | 43 | ceph::async::io_context_pool poolctx; |
7c673cae FG |
44 | MonClient monc; |
45 | std::unique_ptr<Messenger> client_messenger; | |
46 | Objecter objecter; | |
47 | Client client; | |
48 | ||
11fdf7f2 TL |
49 | MgrClient mgrc; |
50 | ||
7c673cae FG |
51 | LogClient log_client; |
52 | LogChannelRef clog, audit_clog; | |
53 | ||
9f95a23c | 54 | ceph::mutex lock = ceph::make_mutex("MgrStandby::lock"); |
11fdf7f2 | 55 | Finisher finisher; |
7c673cae FG |
56 | SafeTimer timer; |
57 | ||
3efd9988 | 58 | PyModuleRegistry py_module_registry; |
31f18b77 FG |
59 | std::shared_ptr<Mgr> active_mgr; |
60 | ||
61 | int orig_argc; | |
62 | const char **orig_argv; | |
7c673cae FG |
63 | |
64 | std::string state_str(); | |
65 | ||
9f95a23c | 66 | void handle_mgr_map(ceph::ref_t<MMgrMap> m); |
7c673cae | 67 | void _update_log_config(); |
31f18b77 | 68 | void send_beacon(); |
7c673cae | 69 | |
c07f9fc5 FG |
70 | bool available_in_map; |
71 | ||
7c673cae | 72 | public: |
31f18b77 | 73 | MgrStandby(int argc, const char **argv); |
7c673cae FG |
74 | ~MgrStandby() override; |
75 | ||
9f95a23c | 76 | bool ms_dispatch2(const ceph::ref_t<Message>& m) override; |
7c673cae FG |
77 | bool ms_handle_reset(Connection *con) override { return false; } |
78 | void ms_handle_remote_reset(Connection *con) override {} | |
7c673cae FG |
79 | bool ms_handle_refused(Connection *con) override; |
80 | ||
81 | int init(); | |
82 | void shutdown(); | |
31f18b77 | 83 | void respawn(); |
20effc67 | 84 | int main(std::vector<const char *> args); |
31f18b77 | 85 | void tick(); |
7c673cae FG |
86 | }; |
87 | ||
88 | #endif | |
89 |