]> git.proxmox.com Git - ceph.git/blob - ceph/src/mgr/MgrStandby.h
79cdaa0c00dbc10e7d47cb0b7c8b337eba4db3b4
[ceph.git] / ceph / src / mgr / MgrStandby.h
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"
19 #include "common/Finisher.h"
20 #include "common/Timer.h"
21 #include "common/LogClient.h"
22
23 #include "client/Client.h"
24 #include "mon/MonClient.h"
25 #include "osdc/Objecter.h"
26
27 #include "DaemonServer.h"
28 #include "PyModules.h"
29
30 #include "DaemonState.h"
31 #include "ClusterState.h"
32
33 class MMgrMap;
34 class Mgr;
35
36 class MgrStandby : public Dispatcher,
37 public md_config_obs_t {
38 public:
39 // config observer bits
40 const char** get_tracked_conf_keys() const override;
41 void handle_conf_change(const struct md_config_t *conf,
42 const std::set <std::string> &changed) override;
43
44 protected:
45 MonClient monc;
46 std::unique_ptr<Messenger> client_messenger;
47 Objecter objecter;
48 Client client;
49
50 LogClient log_client;
51 LogChannelRef clog, audit_clog;
52
53 Mutex lock;
54 SafeTimer timer;
55
56 std::shared_ptr<Mgr> active_mgr;
57
58 int orig_argc;
59 const char **orig_argv;
60
61 std::string state_str();
62
63 void handle_mgr_map(MMgrMap *m);
64 void _update_log_config();
65 void send_beacon();
66
67 public:
68 MgrStandby(int argc, const char **argv);
69 ~MgrStandby() override;
70
71 bool ms_dispatch(Message *m) override;
72 bool ms_handle_reset(Connection *con) override { return false; }
73 void ms_handle_remote_reset(Connection *con) override {}
74 bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer,
75 bool force_new) override;
76 bool ms_handle_refused(Connection *con) override;
77
78 int init();
79 void shutdown();
80 void respawn();
81 int main(vector<const char *> args);
82 void handle_signal(int signum);
83 void tick();
84 };
85
86 #endif
87