]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
fix upgrade wip-leonidc-stretched-cluster-0302-3
authorLeonid Chernin <leonidc@il.ibm.com>
Sun, 1 Mar 2026 15:43:01 +0000 (17:43 +0200)
committerLeonid Chernin <leonidc@il.ibm.com>
Mon, 2 Mar 2026 12:07:57 +0000 (14:07 +0200)
 remove bad code from serialize.h ,add logs for debug,
 put encode decode at the end of NVmeofGwMap.h

Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
src/mon/NVMeofGwMap.cc
src/mon/NVMeofGwMap.h
src/mon/NVMeofGwSerialize.h

index a06fd5c98cf3396b0fe503f5a1d25d1d243f5e0f..718f928130ed2df2afc79a70d665d76057dd6efa 100755 (executable)
@@ -31,45 +31,6 @@ using std::string;
 #undef dout_prefix
 #define dout_prefix *_dout << "nvmeofgw " << __PRETTY_FUNCTION__ << " "
 
-void  NVMeofGwMap::encode(ceph::buffer::list &bl, uint64_t features) const {
-    using ceph::encode;
-    uint8_t version = 1;
-    if (HAVE_FEATURE(features, NVMEOFHAMAP)) {
-      version = 2;
-    }
-    if (HAVE_FEATURE(features, NVMEOF_BEACON_DIFF)) {
-      version = 3;
-    }
-    ENCODE_START(version, version, bl);
-    encode(epoch, bl);// global map epoch
-
-    encode(created_gws, bl, features); //Encode created GWs
-    encode(fsm_timers, bl, features);
-    if (version >= 2) {
-      encode(gw_epoch, bl);
-    }
-    if (version >=3) {
-      encode(disaster_locations, bl);
-    }
-    ENCODE_FINISH(bl);
-  }
-
-  void  NVMeofGwMap::decode(ceph::buffer::list::const_iterator &bl) {
-    using ceph::decode;
-    DECODE_START(3, bl);
-
-    decode(epoch, bl);
-    decode(created_gws, bl);
-    decode(fsm_timers, bl);
-    if (struct_v >= 2) {
-      decode(gw_epoch, bl);
-    }
-    if (struct_v >=3) {
-      decode(disaster_locations, bl);
-    }
-    DECODE_FINISH(bl);
-  }
-
 void NVMeofGwMap::to_gmap(
   std::map<NvmeGroupKey, NvmeGwMonClientStates>& Gmap) const
 {
index 4f3edf5e41b8d460aa372d7098be803ea627fb67..bf9074f3a61b1a1af1f8383fd5c0ee1ac166298e 100755 (executable)
 #include "NVMeofGwTypes.h"
 
 using ceph::coarse_mono_clock;
-
+#define dout_context g_ceph_context
+#define dout_subsys ceph_subsys_mon
+#undef dout_prefix
+#define MODULE_PREFFIX "nvmeofgw "
+#define dout_prefix *_dout << MODULE_PREFFIX << __PRETTY_FUNCTION__ << " "
 class health_check_map_t;
 
 class Monitor;
@@ -187,9 +191,50 @@ public:
     const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
     NvmeAnaGrpId ANA_groupid, epoch_t &epoch, bool failover);
 
-  void encode(ceph::buffer::list &bl, uint64_t features) const ;
+  void encode(ceph::buffer::list &bl, uint64_t features) const  {
+    using ceph::encode;
+    uint8_t version = 1;
+    if (HAVE_FEATURE(features, NVMEOFHAMAP)) {
+      version = 2;
+    }
+    if (HAVE_FEATURE(features, NVMEOF_BEACON_DIFF)) {
+      version = 3;
+    }
+    ENCODE_START(version, version, bl);
+    encode(epoch, bl);// global map epoch
+
+    encode(created_gws, bl, features); //Encode created GWs
+    encode(fsm_timers, bl, features);
+    if (version >= 2) {
+      encode(gw_epoch, bl);
+    }
+    if (version >=3) {
+      encode(disaster_locations, bl);
+    }
+    ENCODE_FINISH(bl);
+  }
+
+  void  decode(ceph::buffer::list::const_iterator &bl) {
+    using ceph::decode;
+    DECODE_START(3, bl);
+
+    decode(epoch, bl);
+    dout(10)  << "decode epoch "  << dendl;
+    decode(created_gws, bl);
+    dout(10)  << "decode created gws "  << dendl;
+    decode(fsm_timers, bl);
+    dout(10)  << "decode fsm timers "  << dendl;
+    if (struct_v >= 2) {
+      decode(gw_epoch, bl);
+      dout(10)  << "decode gw epoch "  << dendl;
+    }
+    if (struct_v >=3) {
+      decode(disaster_locations, bl);
+      dout(10)  << "decode  disaster location "  << dendl;
+    }
+    DECODE_FINISH(bl);
+  }
 
-  void decode(ceph::buffer::list::const_iterator &bl);
   void get_health_checks(health_check_map_t *checks);
 };
 
index 5926fd8521d0f9b27c8486a6df7c3d9f2e2cd197..892dd11b62f798f49a26cea23357813cbcd3ed0a 100755 (executable)
@@ -577,16 +577,16 @@ inline void decode(
   gws.clear();
   uint32_t num_created_gws;
   DECODE_START(4, bl);
-  dout(20) << "decode NvmeGwMonStates. struct_v: " << struct_v << dendl;
+  dout(10) << "decode NvmeGwMonStates. struct_v: " << struct_v << dendl;
   decode(num_created_gws, bl);
-  dout(20) << "decode NvmeGwMonStates. num gws  " << num_created_gws << dendl;
+  dout(10) << "decode NvmeGwMonStates. num gws  " << num_created_gws << dendl;
   std::set<uint32_t> created_anagrps;
   for (uint32_t i = 0; i<num_created_gws; i++) {
     std::string gw_name;
     decode(gw_name, bl);
     NvmeAnaGrpId ana_grp_id;
     decode(ana_grp_id, bl);
-    dout(20) << "decode NvmeGwMonStates. GW-id " << gw_name << " ana grpid "<< ana_grp_id <<  dendl;
+    dout(10) << "decode NvmeGwMonStates. GW-id " << gw_name << " ana grpid "<< ana_grp_id <<  dendl;
     NvmeGwMonState gw_created(ana_grp_id);
     uint32_t sm_state;
     uint32_t sm_key;
@@ -602,7 +602,7 @@ inline void decode(
       created_anagrps.insert(ana_grp_id);
       for (uint32_t i = 0; i <MAX_SUPPORTED_ANA_GROUPS; i ++) {
         decode(sm_state, bl);
-        dout(20) << "decode NvmeGwMonStates state: "
+        dout(10) << "decode NvmeGwMonStates state: "
                  << i << " " << sm_state << dendl;
         gw_created.sm_state[i] = ((gw_states_per_group_t)sm_state);
         //here create all 16 states but need to erase not relevant states after loop on created GW
@@ -611,7 +611,7 @@ inline void decode(
     // common code
     uint32_t avail;
     decode(avail, bl);
-    dout(20) << "decode NvmeGwMonStates avail : " << avail << dendl;
+    dout(10) << "decode NvmeGwMonStates avail : " << avail << dendl;
     gw_created.availability = (gw_availability_t)avail;
     uint16_t performed_startup;
     decode(performed_startup, bl);
@@ -650,10 +650,10 @@ inline void decode(
     }
     decode(gw_created.nonce_map, bl);
     if (struct_v >= 3) {
-      dout(20) << "decode addr_vect and beacon_index" << dendl;
+      dout(10) << "decode addr_vect and beacon_index" << dendl;
       gw_created.addr_vect.decode(bl);
       decode(gw_created.beacon_index, bl);
-      dout(20) << "decoded beacon_index " << gw_created.beacon_index << dendl;
+      dout(10) << "decoded beacon_index " << gw_created.beacon_index << dendl;
     }
     if (struct_v >= 4) {
       dout(20) << "decode admin state and location" << dendl;
@@ -661,7 +661,7 @@ inline void decode(
       decode(admin_state, bl);
       gw_created.gw_admin_state = (gw_admin_state_t)admin_state;
       decode(gw_created.location, bl);
-      dout(20) << "decoded location " << gw_created.location << dendl;
+      dout(10) << "decoded location " << gw_created.location << dendl;
     }
 
     gws[gw_name] = gw_created;
@@ -911,18 +911,19 @@ inline void encode(const BeaconSubsystem& sub,  ceph::bufferlist &bl, uint64_t f
     version = 2;
   }
   // For legacy encoding, skip deleted subsystems to maintain compatibility
+  /* ======
   if (version == 1 &&
       sub.change_descriptor != subsystem_change_t::SUBSYSTEM_ADDED) {
     dout(4) << "encode BeaconSubsystem: skipping subsystem " << sub.nqn
             << " with change_descriptor " << (int)sub.change_descriptor
             << " in legacy mode" << dendl;
     return; // Skip encoding this subsystem entirely
-  }
+  } */
 
   ENCODE_START(version, version, bl);
   encode(sub.nqn, bl);
-  dout(20) << "encode BeaconSubsystems " << sub.nqn <<" features " <<  features
-           << " version " << (int)version << dendl;
+  dout(10) << "encode BeaconSubsystems " << sub.nqn <<" features " <<  features
+           << " version " << (int)version << "change_descr" << (int)sub.change_descriptor<< dendl;
   encode((uint32_t)sub.listeners.size(), bl);
   for (const auto& ls: sub.listeners)
     encode(ls, bl);
@@ -939,10 +940,11 @@ inline void encode(const BeaconSubsystem& sub,  ceph::bufferlist &bl, uint64_t f
 inline void decode(BeaconSubsystem& sub, ceph::buffer::list::const_iterator &bl) {
   DECODE_START(2, bl);
   decode(sub.nqn, bl);
-  dout(20) << "decode BeaconSubsystems " << sub.nqn << dendl;
+  dout(10) << "decode BeaconSubsystem nqn " << sub.nqn << dendl;
   uint32_t s;
   sub.listeners.clear();
   decode(s, bl);
+  dout(10) << "decode Nlisteners " << s << dendl;
   for (uint32_t i = 0; i < s; i++) {
     BeaconListener ls;
     decode(ls, bl);
@@ -960,7 +962,7 @@ inline void decode(BeaconSubsystem& sub, ceph::buffer::list::const_iterator &bl)
     uint32_t change_desc;
     decode(change_desc, bl);
     sub.change_descriptor = static_cast<subsystem_change_t>(change_desc);
-    dout(20) << "decode BeaconSubsystems version >= " << 2 << dendl;
+    dout(10) << "decode BeaconSubsystems version >= " << 2 << dendl;
   }
   DECODE_FINISH(bl);
 }