X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fmon%2FMgrMonitor.h;fp=src%2Fceph%2Fsrc%2Fmon%2FMgrMonitor.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=82315d3550de574d3d7ebb627ffd7cb6b6370a4f;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/mon/MgrMonitor.h b/src/ceph/src/mon/MgrMonitor.h deleted file mode 100644 index 82315d3..0000000 --- a/src/ceph/src/mon/MgrMonitor.h +++ /dev/null @@ -1,128 +0,0 @@ -// -*- 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 - * - * 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 CEPH_MGRMONITOR_H -#define CEPH_MGRMONITOR_H - -#include -#include - -#include "include/Context.h" -#include "MgrMap.h" -#include "PaxosService.h" -#include "MonCommand.h" - -class MgrMonitor: public PaxosService -{ - MgrMap map; - MgrMap pending_map; - bool ever_had_active_mgr = false; - - std::map pending_metadata; - std::set pending_metadata_rm; - - utime_t first_seen_inactive; - - std::map last_beacon; - - /** - * If a standby is available, make it active, given that - * there is currently no active daemon. - * - * @return true if a standby was promoted - */ - bool promote_standby(); - void drop_active(); - - /** - * Remove this gid from the list of standbys. By default, - * also remove metadata (i.e. forget the daemon entirely). - * - * Set `drop_meta` to false if you would like to keep - * the daemon's metadata, for example if you're dropping - * it as a standby before reinstating it as the active daemon. - */ - void drop_standby(uint64_t gid, bool drop_meta=true); - - Context *digest_event = nullptr; - void cancel_timer(); - - bool check_caps(MonOpRequestRef op, const uuid_d& fsid); - - health_status_t should_warn_about_mgr_down(); - - // Command descriptions we've learned from the active mgr - std::vector command_descs; - std::vector pending_command_descs; - -public: - MgrMonitor(Monitor *mn, Paxos *p, const string& service_name) - : PaxosService(mn, p, service_name) - {} - ~MgrMonitor() override {} - - void init() override; - void on_shutdown() override; - - const MgrMap &get_map() const { return map; } - - bool in_use() const { return map.epoch > 0; } - - void create_initial() override; - void get_store_prefixes(std::set& s) override; - void update_from_paxos(bool *need_bootstrap) override; - void create_pending() override; - void encode_pending(MonitorDBStore::TransactionRef t) override; - - bool preprocess_query(MonOpRequestRef op) override; - bool prepare_update(MonOpRequestRef op) override; - - bool preprocess_command(MonOpRequestRef op); - bool prepare_command(MonOpRequestRef op); - - void encode_full(MonitorDBStore::TransactionRef t) override { } - - bool preprocess_beacon(MonOpRequestRef op); - bool prepare_beacon(MonOpRequestRef op); - - void check_sub(Subscription *sub); - void check_subs(); - void send_digests(); - - void on_active() override; - void on_restart() override; - - void get_health(list >& summary, - list > *detail, - CephContext *cct) const override; - void tick() override; - - void print_summary(Formatter *f, std::ostream *ss) const; - - const std::vector &get_command_descs() const; - - int load_metadata(const string& name, std::map& m, - ostream *err); - int dump_metadata(const string& name, Formatter *f, ostream *err); - void count_metadata(const string& field, Formatter *f); - void count_metadata(const string& field, std::map *out); - - friend class C_Updated; - - // When did the mon last call into our tick() method? Used for detecting - // when the mon was not updating us for some period (e.g. during slow - // election) to reset last_beacon timeouts - ceph::coarse_mono_clock::time_point last_tick; -}; - -#endif