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) 2016 John Spray <john.spray@redhat.com>
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.
15 #ifndef MGR_STANDBY_H_
16 #define MGR_STANDBY_H_
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"
24 #include "client/Client.h"
25 #include "mon/MonClient.h"
26 #include "osdc/Objecter.h"
27 #include "PyModuleRegistry.h"
28 #include "MgrClient.h"
34 class MgrStandby
: public Dispatcher
,
35 public md_config_obs_t
{
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
;
43 ceph::async::io_context_pool poolctx
;
45 std::unique_ptr
<Messenger
> client_messenger
;
52 LogChannelRef clog
, audit_clog
;
54 ceph::mutex lock
= ceph::make_mutex("MgrStandby::lock");
58 PyModuleRegistry py_module_registry
;
59 std::shared_ptr
<Mgr
> active_mgr
;
62 const char **orig_argv
;
64 std::string
state_str();
66 void handle_mgr_map(ceph::ref_t
<MMgrMap
> m
);
67 void _update_log_config();
70 bool available_in_map
;
73 MgrStandby(int argc
, const char **argv
);
74 ~MgrStandby() override
;
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
;
84 int main(std::vector
<const char *> args
);