diff options
author | John Spray <john.spray@redhat.com> | 2016-07-15 01:39:22 +0200 |
---|---|---|
committer | John Spray <john.spray@redhat.com> | 2016-09-29 18:26:58 +0200 |
commit | 7845f8d757adf63390d6cb0ff56afbc088bc508b (patch) | |
tree | 72043a3958d542e202a4b945e67c2a4b79f07807 /src/mon/MgrMonitor.h | |
parent | pybind/mgr: implement shutdown() in rest.py (diff) | |
download | ceph-7845f8d757adf63390d6cb0ff56afbc088bc508b.tar.xz ceph-7845f8d757adf63390d6cb0ff56afbc088bc508b.zip |
mgr: flesh out standby/HA
Signed-off-by: John Spray <john.spray@redhat.com>
Diffstat (limited to 'src/mon/MgrMonitor.h')
-rw-r--r-- | src/mon/MgrMonitor.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/mon/MgrMonitor.h b/src/mon/MgrMonitor.h index 51850893ed1..bd4ac4599bf 100644 --- a/src/mon/MgrMonitor.h +++ b/src/mon/MgrMonitor.h @@ -12,25 +12,53 @@ */ +#include "include/Context.h" #include "MgrMap.h" #include "PaxosService.h" + class MgrMonitor : public PaxosService { MgrMap map; MgrMap pending_map; + std::map<uint64_t, utime_t> 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(); + void drop_standby(uint64_t gid); + + Context *digest_callback; + public: MgrMonitor(Monitor *mn, Paxos *p, const string& service_name) - : PaxosService(mn, p, service_name) + : PaxosService(mn, p, service_name), digest_callback(nullptr) {} + void init(); + void on_shutdown(); + + const MgrMap &get_map() const { return map; } + + bool in_use() const { return map.epoch > 0; } + void create_initial(); void update_from_paxos(bool *need_bootstrap); void create_pending(); void encode_pending(MonitorDBStore::TransactionRef t); + bool preprocess_query(MonOpRequestRef op); bool prepare_update(MonOpRequestRef op); + + bool preprocess_command(MonOpRequestRef op); + bool prepare_command(MonOpRequestRef op); + void encode_full(MonitorDBStore::TransactionRef t) { } bool preprocess_beacon(MonOpRequestRef op); @@ -42,6 +70,8 @@ public: void tick(); + void print_summary(Formatter *f, std::ostream *ss) const; + friend class C_Updated; }; |