@@ -32,62 +32,99 @@ class Monitor;
3232class NVMeofGwMap
3333{
3434public:
35- Monitor* mon = NULL ;
36- epoch_t epoch = 0 ; // epoch is for Paxos synchronization mechanizm
37- bool delay_propose = false ;
38-
39- std::map<NvmeGroupKey, NvmeGwMonStates> created_gws;
40- std::map<NvmeGroupKey, NvmeGwTimers> fsm_timers;// map that handles timers started by all Gateway FSMs
41- void to_gmap (std::map<NvmeGroupKey, NvmeGwMonClientStates>& Gmap) const ;
42-
43- int cfg_add_gw (const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
44- int cfg_delete_gw (const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
45- void process_gw_map_ka (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, epoch_t & last_osd_epoch, bool &propose_pending);
46- int process_gw_map_gw_down (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool &propose_pending);
47- void update_active_timers (bool &propose_pending);
48- void handle_abandoned_ana_groups (bool &propose_pending);
49- void handle_removed_subsystems (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, const std::vector<NvmeNqnId> ¤t_subsystems, bool &propose_pending);
50- void start_timer (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId anagrpid, uint8_t value);
51- private:
52- void add_grp_id (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, const NvmeAnaGrpId grpid);
53- void remove_grp_id (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, const NvmeAnaGrpId grpid);
54- void fsm_handle_gw_down (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, gw_states_per_group_t state, NvmeAnaGrpId grpid, bool &map_modified);
55- void fsm_handle_gw_delete (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, gw_states_per_group_t state, NvmeAnaGrpId grpid, bool &map_modified);
56- void fsm_handle_gw_alive (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeGwMonState & gw_state, gw_states_per_group_t state,
57- NvmeAnaGrpId grpid, epoch_t & last_osd_epoch, bool &map_modified);
58- void fsm_handle_to_expired (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId grpid, bool &map_modified);
35+ Monitor *mon = NULL ;
36+
37+ // epoch is for Paxos synchronization mechanizm
38+ epoch_t epoch = 0 ;
39+ bool delay_propose = false ;
40+
41+ std::map<NvmeGroupKey, NvmeGwMonStates> created_gws;
42+
43+ // map that handles timers started by all Gateway FSMs
44+ std::map<NvmeGroupKey, NvmeGwTimers> fsm_timers;
45+
46+ void to_gmap (std::map<NvmeGroupKey, NvmeGwMonClientStates>& Gmap) const ;
5947
60- void find_failover_candidate (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId grpid, bool &propose_pending);
61- void find_failback_gw (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool &propose_pending);
62- void set_failover_gw_for_ANA_group (const NvmeGwId &failed_gw_id, const NvmeGroupKey& group_key, const NvmeGwId &gw_id,
63- NvmeAnaGrpId groupid);
48+ int cfg_add_gw (const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
49+ int cfg_delete_gw (const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
50+ void process_gw_map_ka (
51+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
52+ epoch_t & last_osd_epoch, bool &propose_pending);
53+ int process_gw_map_gw_down (
54+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
55+ bool &propose_pending);
56+ void update_active_timers (bool &propose_pending);
57+ void handle_abandoned_ana_groups (bool &propose_pending);
58+ void handle_removed_subsystems (
59+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
60+ const std::vector<NvmeNqnId> ¤t_subsystems, bool &propose_pending);
61+ void start_timer (
62+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
63+ NvmeAnaGrpId anagrpid, uint8_t value);
64+ private:
65+ void add_grp_id (
66+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
67+ const NvmeAnaGrpId grpid);
68+ void remove_grp_id (
69+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
70+ const NvmeAnaGrpId grpid);
71+ void fsm_handle_gw_down (
72+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
73+ gw_states_per_group_t state, NvmeAnaGrpId grpid, bool &map_modified);
74+ void fsm_handle_gw_delete (
75+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
76+ gw_states_per_group_t state, NvmeAnaGrpId grpid, bool &map_modified);
77+ void fsm_handle_gw_alive (
78+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
79+ NvmeGwMonState & gw_state, gw_states_per_group_t state,
80+ NvmeAnaGrpId grpid, epoch_t & last_osd_epoch, bool &map_modified);
81+ void fsm_handle_to_expired (
82+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
83+ NvmeAnaGrpId grpid, bool &map_modified);
6484
85+ void find_failover_candidate (
86+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
87+ NvmeAnaGrpId grpid, bool &propose_pending);
88+ void find_failback_gw (
89+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
90+ bool &propose_pending);
91+ void set_failover_gw_for_ANA_group (
92+ const NvmeGwId &failed_gw_id, const NvmeGroupKey& group_key,
93+ const NvmeGwId &gw_id, NvmeAnaGrpId groupid);
6594
66- int get_timer (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId anagrpid);
67- void cancel_timer (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId anagrpid);
68- void validate_gw_map (const NvmeGroupKey& group_key);
95+ int get_timer (
96+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
97+ NvmeAnaGrpId anagrpid);
98+ void cancel_timer (
99+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
100+ NvmeAnaGrpId anagrpid);
101+ void validate_gw_map (
102+ const NvmeGroupKey& group_key);
69103
70104public:
71- int blocklist_gw (const NvmeGwId &gw_id, const NvmeGroupKey& group_key, NvmeAnaGrpId ANA_groupid, epoch_t &epoch, bool failover);
72- void encode (ceph::buffer::list &bl) const {
73- using ceph::encode;
74- ENCODE_START (1 , 1 , bl);
75- encode (epoch, bl);// global map epoch
76-
77- encode (created_gws, bl); // Encode created GWs
78- encode (fsm_timers, bl);
79- ENCODE_FINISH (bl);
80- }
81-
82- void decode (ceph::buffer::list::const_iterator &bl) {
83- using ceph::decode;
84- DECODE_START (1 , bl);
85- decode (epoch, bl);
86-
87- decode (created_gws, bl);
88- decode (fsm_timers, bl);
89- DECODE_FINISH (bl);
90- }
105+ int blocklist_gw (
106+ const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
107+ NvmeAnaGrpId ANA_groupid, epoch_t &epoch, bool failover);
108+
109+ void encode (ceph::buffer::list &bl) const {
110+ using ceph::encode;
111+ ENCODE_START (1 , 1 , bl);
112+ encode (epoch, bl);// global map epoch
113+
114+ encode (created_gws, bl); // Encode created GWs
115+ encode (fsm_timers, bl);
116+ ENCODE_FINISH (bl);
117+ }
118+
119+ void decode (ceph::buffer::list::const_iterator &bl) {
120+ using ceph::decode;
121+ DECODE_START (1 , bl);
122+ decode (epoch, bl);
123+
124+ decode (created_gws, bl);
125+ decode (fsm_timers, bl);
126+ DECODE_FINISH (bl);
127+ }
91128};
92129
93130#include " NVMeofGwSerialize.h"
0 commit comments