2016-07-14 23:39:22 +00:00
|
|
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
|
|
|
// vim: ts=8 sw=2 smarttab
|
|
|
|
/*
|
|
|
|
* Ceph - scalable distributed file system
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 John Spray <john.spray@redhat.com>
|
|
|
|
*
|
|
|
|
* This is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software
|
|
|
|
* Foundation. See file COPYING.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef MGR_STANDBY_H_
|
|
|
|
#define MGR_STANDBY_H_
|
|
|
|
|
|
|
|
#include "auth/Auth.h"
|
2020-04-28 21:32:56 +00:00
|
|
|
#include "common/async/context_pool.h"
|
2016-07-14 23:39:22 +00:00
|
|
|
#include "common/Finisher.h"
|
|
|
|
#include "common/Timer.h"
|
2017-03-22 01:24:24 +00:00
|
|
|
#include "common/LogClient.h"
|
2016-07-14 23:39:22 +00:00
|
|
|
|
2017-05-04 07:39:55 +00:00
|
|
|
#include "client/Client.h"
|
|
|
|
#include "mon/MonClient.h"
|
|
|
|
#include "osdc/Objecter.h"
|
2017-08-14 10:31:18 +00:00
|
|
|
#include "PyModuleRegistry.h"
|
2018-01-05 20:55:12 +00:00
|
|
|
#include "MgrClient.h"
|
2016-07-14 23:39:22 +00:00
|
|
|
|
2016-07-16 21:04:39 +00:00
|
|
|
class MMgrMap;
|
2016-07-14 23:39:22 +00:00
|
|
|
class Mgr;
|
2018-02-16 10:51:11 +00:00
|
|
|
class PyModuleConfig;
|
2016-07-14 23:39:22 +00:00
|
|
|
|
2017-03-22 01:24:24 +00:00
|
|
|
class MgrStandby : public Dispatcher,
|
|
|
|
public md_config_obs_t {
|
|
|
|
public:
|
|
|
|
// config observer bits
|
|
|
|
const char** get_tracked_conf_keys() const override;
|
2018-07-06 15:08:00 +00:00
|
|
|
void handle_conf_change(const ConfigProxy& conf,
|
2018-06-26 07:09:28 +00:00
|
|
|
const std::set <std::string> &changed) override;
|
2017-03-22 01:24:24 +00:00
|
|
|
|
2016-07-14 23:39:22 +00:00
|
|
|
protected:
|
2020-04-28 21:32:56 +00:00
|
|
|
ceph::async::io_context_pool poolctx;
|
2017-05-04 07:39:55 +00:00
|
|
|
MonClient monc;
|
|
|
|
std::unique_ptr<Messenger> client_messenger;
|
|
|
|
Objecter objecter;
|
|
|
|
Client client;
|
2017-03-22 01:24:24 +00:00
|
|
|
|
2018-01-05 20:55:12 +00:00
|
|
|
MgrClient mgrc;
|
|
|
|
|
2017-03-22 01:24:24 +00:00
|
|
|
LogClient log_client;
|
|
|
|
LogChannelRef clog, audit_clog;
|
2016-07-14 23:39:22 +00:00
|
|
|
|
2019-07-07 03:14:49 +00:00
|
|
|
ceph::mutex lock = ceph::make_mutex("MgrStandby::lock");
|
2019-01-24 09:04:24 +00:00
|
|
|
Finisher finisher;
|
2016-07-14 23:39:22 +00:00
|
|
|
SafeTimer timer;
|
|
|
|
|
2017-08-14 10:31:18 +00:00
|
|
|
PyModuleRegistry py_module_registry;
|
2017-05-25 22:25:27 +00:00
|
|
|
std::shared_ptr<Mgr> active_mgr;
|
2016-07-14 23:39:22 +00:00
|
|
|
|
2017-06-07 20:54:19 +00:00
|
|
|
int orig_argc;
|
|
|
|
const char **orig_argv;
|
|
|
|
|
2016-07-14 23:39:22 +00:00
|
|
|
std::string state_str();
|
|
|
|
|
2019-04-15 06:39:11 +00:00
|
|
|
void handle_mgr_map(ceph::ref_t<MMgrMap> m);
|
2017-03-22 01:24:24 +00:00
|
|
|
void _update_log_config();
|
2017-03-10 23:02:50 +00:00
|
|
|
void send_beacon();
|
2016-07-16 21:04:39 +00:00
|
|
|
|
2017-06-29 19:11:12 +00:00
|
|
|
bool available_in_map;
|
|
|
|
|
2016-07-14 23:39:22 +00:00
|
|
|
public:
|
2017-06-07 20:54:19 +00:00
|
|
|
MgrStandby(int argc, const char **argv);
|
2017-02-22 11:52:46 +00:00
|
|
|
~MgrStandby() override;
|
2016-07-14 23:39:22 +00:00
|
|
|
|
2019-04-15 06:39:11 +00:00
|
|
|
bool ms_dispatch2(const ceph::ref_t<Message>& m) override;
|
2017-02-22 11:52:46 +00:00
|
|
|
bool ms_handle_reset(Connection *con) override { return false; }
|
|
|
|
void ms_handle_remote_reset(Connection *con) override {}
|
|
|
|
bool ms_handle_refused(Connection *con) override;
|
2016-09-20 15:34:37 +00:00
|
|
|
|
2016-07-14 23:39:22 +00:00
|
|
|
int init();
|
|
|
|
void shutdown();
|
2017-06-07 20:54:19 +00:00
|
|
|
void respawn();
|
2016-07-14 23:39:22 +00:00
|
|
|
int main(vector<const char *> args);
|
2017-03-10 23:02:50 +00:00
|
|
|
void tick();
|
2016-07-14 23:39:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|