void NVMeofGwMap::set_failover_gw_for_ANA_group(const NvmeGwId &failed_gw_id, const NvmeGroupKey& group_key, const NvmeGwId &gw_id, NvmeAnaGrpId ANA_groupid)
{
NvmeGwCreated& gw_state = Created_gws[group_key][gw_id];
- gw_state.failover_peer[ANA_groupid] = failed_gw_id;
epoch_t epoch;
- dout(4) << "Found failower GW " << gw_id << " for ANA group " << (int)ANA_groupid << dendl;
+ dout(4) << "Found failover GW " << gw_id << " for ANA group " << (int)ANA_groupid << dendl;
int rc = blocklist_gw (failed_gw_id, group_key, ANA_groupid, epoch, true);
if(rc){
gw_state.active_state(ANA_groupid); //TODO check whether it is valid to start failover when nonces are empty !
auto& failback_gw_id = gw_state_it.first;
auto& st = gw_state_it.second;
if (st.sm_state[gw_state.ana_grp_id] == GW_STATES_PER_AGROUP_E::GW_ACTIVE_STATE) {
- ceph_assert(st.failover_peer[gw_state.ana_grp_id] == gw_id);
-
dout(4) << "Found Failback GW " << failback_gw_id << " that previously took over the ANAGRP " << gw_state.ana_grp_id << " of the available GW " << gw_id << dendl;
st.sm_state[gw_state.ana_grp_id] = GW_STATES_PER_AGROUP_E::GW_WAIT_FAILBACK_PREPARED;
start_timer(failback_gw_id, group_key, gw_state.ana_grp_id, 3);// Add timestamp of start Failback preparation
void NVMeofGwMon::init(){
dout(4) << "called " << dendl;
- g_conf().add_observer(this);
}
void NVMeofGwMon::on_restart(){
}
void NVMeofGwMon::on_shutdown() {
- g_conf().remove_observer(this);
+ dout(4) << "called " << dendl;
}
void NVMeofGwMon::tick(){
cmd_getval(cmdmap, "prefix", prefix);
dout(4) << "MonCommand : "<< prefix << dendl;
- /* MonSession *session = op->get_session();
- if (!session)
- {
- dout(4) << "MonCommand : "<< prefix << " access denied due to lack of session" << dendl;
- mon.reply_command(op, -EACCES, "access denied", rdata,
- get_last_committed());
- return true;
- }
- */
- string format = cmd_getval_or<string>(cmdmap, "format", "plain");
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
-
- // TODO need to check formatter per preffix - if f is NULL
-
return false;
}
bool NVMeofGwMon::preprocess_beacon(MonOpRequestRef op){
- //dout(4) << dendl;
auto m = op->get_req<MNVMeofGwBeacon>();
const BeaconSubsystems& sub = m->get_subsystems();
- //mon.no_reply(op); // we never reply to beacons
- dout(15) << "beacon from " << m->get_type() << " GW : " << m->get_gw_id() << " num subsystems " << sub.size() << dendl;
- MonSession *session = op->get_session();
- if (!session){
- dout(4) << "beacon no session " << dendl;
- return true;
- }
+ dout(15) << "beacon from " << m->get_type() << " GW : " << m->get_gw_id() << " num subsystems " << sub.size() << dendl;
return false; // allways return false to call leader's prepare beacon
}
for (size_t i = 0; i < num_ana_groups; i++) {
os << " " << anas[i] <<": " << value.sm_state[anas[i]] << ",";
}
- os << "]\n"<< MODULE_PREFFIX << " failover peers ";
- for (size_t i = 0; i < num_ana_groups; i++) {
- os << anas[i] <<": " << value.failover_peer[anas[i]] << ",";
- }
+
os << "]\n"<< MODULE_PREFFIX << "availability " << value.availability << "]";
return os;
for (int i = 0; i < MAX_SUPPORTED_ANA_GROUPS; i++) {
os << value.sm_state[i] << ",";
}
- os << "]\n"<< MODULE_PREFFIX << " failover peers ";
- for (int i = 0; i < MAX_SUPPORTED_ANA_GROUPS; i++) {
- os << value.failover_peer[i] << ",";
- }
+
os << "]\n"<< MODULE_PREFFIX << " beacon-subsystems ";
for (const auto& sub: value.subsystems) {
os << sub << ",";
for(int i = 0; i <MAX_SUPPORTED_ANA_GROUPS; i ++){
encode((uint32_t)(gw.second.sm_state[i]), bl);
}
- for(int i = 0; i <MAX_SUPPORTED_ANA_GROUPS; i ++){
- encode((gw.second.failover_peer[i]), bl);
- }
encode((uint32_t)gw.second.availability, bl);
encode((uint32_t)gw.second.last_gw_map_epoch_valid, bl);
encode(gw.second.subsystems, bl);
decode(sm_state, bl);
gw_created.sm_state[i] = (GW_STATES_PER_AGROUP_E) sm_state;
}
- for(int i = 0; i <MAX_SUPPORTED_ANA_GROUPS; i ++){
- decode(peer_name, bl);
- gw_created.failover_peer[i] = peer_name;
- }
uint32_t avail;
decode(avail, bl);
gw_created.availability = (GW_AVAILABILITY_E)avail;
NvmeAnaNonceMap nonce_map;
NvmeAnaNonceMap copied_nonce_map;
SM_STATE sm_state; // state machine states per ANA group
- NvmeGwId failover_peer[MAX_SUPPORTED_ANA_GROUPS];
struct{
epoch_t osd_epoch;
bool is_failover;
{
for (int i = 0; i < MAX_SUPPORTED_ANA_GROUPS; i++){
sm_state[i] = GW_STATES_PER_AGROUP_E::GW_STANDBY_STATE;
- failover_peer[i] = "";
blocklist_data[i].osd_epoch = 0;
blocklist_data[i].is_failover = true;
}
void standby_state(NvmeAnaGrpId grpid) {
sm_state[grpid] = GW_STATES_PER_AGROUP_E::GW_STANDBY_STATE;
- failover_peer[grpid] = "";
};
void active_state(NvmeAnaGrpId grpid) {
sm_state[grpid] = GW_STATES_PER_AGROUP_E::GW_ACTIVE_STATE;