Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / tools / cephfs / MDSUtility.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) 2014 John Spray <john.spray@inktank.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 #ifndef MDS_UTILITY_H_
15 #define MDS_UTILITY_H_
16
17 #include "osdc/Objecter.h"
18 #include "mds/FSMap.h"
19 #include "messages/MFSMap.h"
20 #include "msg/Dispatcher.h"
21 #include "msg/Messenger.h"
22 #include "auth/Auth.h"
23 #include "common/Finisher.h"
24 #include "common/Timer.h"
25
26 /// MDS Utility
27 /**
28  * This class is the parent for MDS utilities, i.e. classes that
29  * need access the objects belonging to the MDS without actually
30  * acting as an MDS daemon themselves.
31  */
32 class MDSUtility : public Dispatcher {
33 protected:
34   Objecter *objecter;
35   FSMap *fsmap;
36   Messenger *messenger;
37   MonClient *monc;
38
39   Mutex lock;
40   Finisher finisher;
41
42   Context *waiting_for_mds_map;
43
44 public:
45   MDSUtility();
46   ~MDSUtility() override;
47
48   void handle_fs_map(MFSMap* m);
49   bool ms_dispatch(Message *m) override;
50   bool ms_handle_reset(Connection *con) override { return false; }
51   void ms_handle_remote_reset(Connection *con) override {}
52   bool ms_handle_refused(Connection *con) override { return false; }
53   bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer,
54                          bool force_new) override;
55   int init();
56   void shutdown();
57 };
58
59 #endif /* MDS_UTILITY_H_ */