]> git.proxmox.com Git - ceph.git/blob - ceph/src/mgr/MgrStandby.h
bump version to 18.2.2-pve1
[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/async/context_pool.h"
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"
27 #include "PyModuleRegistry.h"
28 #include "MgrClient.h"
29
30 class MMgrMap;
31 class Mgr;
32 class PyModuleConfig;
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;
39 void handle_conf_change(const ConfigProxy& conf,
40 const std::set <std::string> &changed) override;
41
42 protected:
43 ceph::async::io_context_pool poolctx;
44 MonClient monc;
45 std::unique_ptr<Messenger> client_messenger;
46 Objecter objecter;
47 Client client;
48
49 MgrClient mgrc;
50
51 LogClient log_client;
52 LogChannelRef clog, audit_clog;
53
54 ceph::mutex lock = ceph::make_mutex("MgrStandby::lock");
55 Finisher finisher;
56 SafeTimer timer;
57
58 PyModuleRegistry py_module_registry;
59 std::shared_ptr<Mgr> active_mgr;
60
61 int orig_argc;
62 const char **orig_argv;
63
64 std::string state_str();
65
66 void handle_mgr_map(ceph::ref_t<MMgrMap> m);
67 void _update_log_config();
68 void send_beacon();
69
70 bool available_in_map;
71
72 public:
73 MgrStandby(int argc, const char **argv);
74 ~MgrStandby() override;
75
76 bool ms_dispatch2(const ceph::ref_t<Message>& m) override;
77 bool ms_handle_reset(Connection *con) override { return false; }
78 void ms_handle_remote_reset(Connection *con) override {}
79 bool ms_handle_refused(Connection *con) override;
80
81 int init();
82 void shutdown();
83 void respawn();
84 int main(std::vector<const char *> args);
85 void tick();
86 };
87
88 #endif
89