]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-nvmeof-mon fixes
authorLeonid Chernin <leonidc@il.ibm.com>
Sun, 31 Mar 2024 13:37:26 +0000 (13:37 +0000)
committerAlexander Indenbaum <aindenba@redhat.com>
Thu, 20 Nov 2025 08:55:26 +0000 (10:55 +0200)
- remove observer from NVMeofMon
Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
  (cherry picked from commit a20fb90357990abac6d2696949e48ef4fa5a7880)

- fix assert issue in find_failback_gw - failover_peers array was removed
Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
  (cherry picked from commit 4c6a9b3ed194eb7837e6b341aba227042e497078)

- try to resolve slow ops
  It seems that if monitor preprocess_query(MonOpRequestRef op) returns
  true, then  mon.reply_command() should be called. Remove path which
  returns true without mon.reply_command() call.
  (cherry picked from commit 99a345cb0d70851addc33aa3fa7fe07ed5d67b94)

  Resolves: rhbz#2272663

Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
(cherry picked from commit f0b748db48dbe704de320974c40ea851e8ac061f)

src/mon/NVMeofGwMap.cc
src/mon/NVMeofGwMon.cc
src/mon/NVMeofGwSerialize.h
src/mon/NVMeofGwTypes.h

index 869c3784ca1df0d0ef985bd89d33db7e1dd87643..4a495758565f4455d5e1215816e3a431a25b7a0c 100755 (executable)
@@ -198,9 +198,8 @@ void NVMeofGwMap::handle_abandoned_ana_groups(bool& propose)
 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 !
@@ -242,8 +241,6 @@ void  NVMeofGwMap::find_failback_gw(const NvmeGwId &gw_id, const NvmeGroupKey& g
         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
index 6170d4810690c69d5374929c4f23520898dd71d9..4f3ba16261d24ee886bd31d287f43d9accbe0433 100644 (file)
@@ -26,7 +26,6 @@ using std::string;
 
 void NVMeofGwMon::init(){
     dout(4) <<  "called " << dendl;
-    g_conf().add_observer(this);
 }
 
 void NVMeofGwMon::on_restart(){
@@ -56,7 +55,7 @@ void NVMeofGwMon::synchronize_last_beacon(){
 }
 
 void NVMeofGwMon::on_shutdown() {
-     g_conf().remove_observer(this);
+    dout(4) <<  "called " << dendl;
 }
 
 void NVMeofGwMon::tick(){
@@ -277,20 +276,6 @@ bool NVMeofGwMon::preprocess_command(MonOpRequestRef op)
     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;
 }
 
@@ -424,16 +409,9 @@ bool NVMeofGwMon::prepare_command(MonOpRequestRef op)
 
 
 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
 }
index 0c8414e6b7f5ec9a153eb11e3c96977ef8570f59..905d9090d1e005f78fb992a233d755b9a7ce3c1b 100755 (executable)
@@ -134,10 +134,7 @@ inline std::ostream& print_gw_created_t(std::ostream& os, const NvmeGwCreated va
     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;
@@ -153,10 +150,7 @@ inline std::ostream& operator<<(std::ostream& os, const NvmeGwCreated value) {
     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 << ",";
@@ -333,9 +327,6 @@ inline void encode(const NvmeGwCreatedMap& gws,  ceph::bufferlist &bl) {
         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);
@@ -369,10 +360,6 @@ inline void decode(NvmeGwCreatedMap& gws, ceph::buffer::list::const_iterator &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;
index 5eb1a3ba622b6c7e45e2f71ba7bf7428c33a363f..5539b2eaf61bb9ca13404a070ecfa96a1dec54a4 100755 (executable)
@@ -82,7 +82,6 @@ struct NvmeGwCreated {
     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;
@@ -94,7 +93,6 @@ struct NvmeGwCreated {
     {
         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;
         }
@@ -102,7 +100,6 @@ struct NvmeGwCreated {
 
     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;