skip_failovers_for_group(group_key, 5);
process_gw_map_gw_down(gw_id, group_key, propose_pending);
}
+ st.gw_admin_state = state;
propose_pending = true;
}
} else if (state == gw_admin_state_t::GW_ADMIN_ENABLED) {
if (st.gw_admin_state == gw_admin_state_t::GW_ADMIN_DISABLED) {
dout(4) << "GW-id set admin Enabled " << group_key
<< " " << gw_id << dendl;
+ st.gw_admin_state = state;
propose_pending = true;
}
}
- st.gw_admin_state = state;
} else {
dout(4) << "GW-id not created yet " << group_key << " " << gw_id << dendl;
return -EINVAL;
bool NVMeofGwMap::is_location_in_disaster(const NvmeGroupKey& group_key,
NvmeLocation& location, bool &cleanup_in_process) {
auto grp_it = disaster_locations.find(group_key);
+ cleanup_in_process = false;
if (grp_it != disaster_locations.end()) {
auto &loc_states = grp_it->second;
if (loc_states.find(location) != loc_states.end()) {
<< group_key << dendl;
return -EINVAL;
}
- bool cleanup_in_process;
+ bool cleanup_in_process = false;
bool location_exists = false;
auto& gws_states = created_gws[group_key];
if (is_location_in_disaster(group_key, location, cleanup_in_process)) {
}
auto& gws_states = created_gws[group_key];
bool accept = false;
- bool cleanup_in_process;
+ bool cleanup_in_process = false;
// for all the gateways of the subsystem
if (!is_location_in_disaster(group_key, location, cleanup_in_process)) {
dout(4) << "command cannot be accepted: in a group " << group_key
{
NvmeGwMonState& gw_state = created_gws[group_key][gw_id];
NvmeGwMonState& failed_gw_state = created_gws[group_key][failed_gw_id];
- epoch_t epoch;
+ epoch_t epoch = 0;
dout(10) << "Found failover GW " << gw_id
<< " for ANA group " << (int)ANA_groupid << dendl;
if (failed_gw_state.availability == gw_availability_t::GW_CREATED) {
auto& gw_state = created_gws[group_key][gw_id];
bool do_failback = false;
bool allow_inter_location = true;
- bool cleanup_in_process;
+ bool cleanup_in_process = false;
if (is_location_in_disaster(group_key, gw_state.location, cleanup_in_process)) {
if (!cleanup_in_process) {
allow_inter_location = false;
(ignore_locations || st.location == location)) {
num_gws ++;
active_ana_groups_in_gw = 0;
- bool cleanup_in_process;
+ bool cleanup_in_process = false;
if (is_location_in_disaster(group_key, st.location, cleanup_in_process)) {
continue;
}
}
else {
st.standby_state(grpid);
- dout(10) << "GW failed durind failback/relocation persistency interval"
+ dout(10) << "GW failed during failback/relocation persistency interval"
<< gw_state.first << dendl;
}
}
if (rc == -EEXIST) {
sstrm.str("command already set please wait until completed");
}
- if (rc == EINVAL) {
+ if (rc == -EINVAL) {
sstrm.str("command cannot be executed");
}
}
response = true;
}
} else if (prefix == "nvme-gw disaster-clear") {
- std::string id, pool, group, location;
+ std::string pool, group, location;
bool propose = false;
cmd_getval(cmdmap, "pool", pool);
cmd_getval(cmdmap, "group", group);
cmd_getval(cmdmap, "location", location);
auto group_key = std::make_pair(pool, group);
- dout(10) << id <<" pool "<< pool << " group "<< group
+ dout(10) << " pool "<< pool << " group "<< group
<<" location "<< location << dendl;
rc = pending_map.cfg_location_disaster_clear(group_key,
location, propose);
if (rc == -EEXIST) {
sstrm.str("command already set please wait until completed");
}
- if (rc == EINVAL) {
+ if (rc == -EINVAL) {
sstrm.str("command cannot be executed");
}
}
DECODE_FINISH(bl);
}
-inline void encode(
- const std::map<NvmeGroupKey, LocationStates> &disaster_locations, ceph::bufferlist &bl) {
- ENCODE_START(1, 1, bl);
- encode ((uint32_t)disaster_locations.size(), bl); // number of groups
- for (auto& group_disaster: disaster_locations) {
- auto& group_key = group_disaster.first;
- encode(group_key.first, bl); // pool
- encode(group_key.second, bl); // group
- const LocationStates &locations = group_disaster.second;
- encode((uint32_t)locations.size(), bl);
- for( auto &locations_it: locations) {
- NvmeLocation location = locations_it.first;
- encode(location, bl);
- encode(locations_it.second.failbacks_in_process, bl);
- }
- }
- ENCODE_FINISH(bl);
+inline void encode(const LocationState &locationstate, ceph::bufferlist &bl) {
+ encode(locationstate.failbacks_in_process, bl);
}
-inline void decode(
- std::map<NvmeGroupKey, LocationStates> &disaster_locations,
- ceph::buffer::list::const_iterator &bl) {
- disaster_locations.clear();
- uint32_t ngroups;
- DECODE_START(1, bl);
- decode(ngroups, bl);
- for (uint32_t i = 0; i<ngroups; i++) {
- std::string pool, group;
- decode(pool, bl);
- decode(group, bl);
- uint32_t nlocations;
- decode(nlocations, bl);
- for (uint32_t i = 0; i<nlocations; i++) {
- NvmeLocation location;
- bool failback_in_progress;
- decode(location, bl);
- decode(failback_in_progress, bl);
- disaster_locations[std::make_pair(pool, group)][location]
- .failbacks_in_process = failback_in_progress;
- }
- }
- DECODE_FINISH(bl);
+inline void decode(LocationState &locationstate,
+ ceph::buffer::list::const_iterator &bl) {
+ decode(locationstate.failbacks_in_process, bl);
}
inline void encode(