]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/nvmeof: introduce HEAD_VERSION and COMPAT_VERSION constants
authorAlexander Indenbaum <aindenba@redhat.com>
Sun, 2 Nov 2025 09:31:35 +0000 (11:31 +0200)
committerAlexander Indenbaum <aindenba@redhat.com>
Sun, 2 Nov 2025 09:33:17 +0000 (11:33 +0200)
Replace direct usage of BEACON_VERSION_ENHANCED and BEACON_VERSION_LEGACY
with standard Ceph message style HEAD_VERSION and COMPAT_VERSION constants
in MNVMeofGwBeacon class.

address 1. Alex will send Leonid the diff for https://github.com/ceph/ceph/pull/65563#discussion_r2445611905

Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
src/messages/MNVMeofGwBeacon.h

index a8005658041a23f9bf076b91a33ca9917344e6d0..512fca40ed1129f916ad64fcc74c92a2044f7934 100644 (file)
@@ -26,6 +26,8 @@
 
 class MNVMeofGwBeacon final : public PaxosServiceMessage {
 private:
+  static constexpr int HEAD_VERSION = BEACON_VERSION_ENHANCED;
+  static constexpr int COMPAT_VERSION = BEACON_VERSION_LEGACY;
 
 protected:
     std::string       gw_id;
@@ -39,8 +41,8 @@ protected:
 
 public:
   MNVMeofGwBeacon()
-    : PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, 0, BEACON_VERSION_ENHANCED,
-      BEACON_VERSION_LEGACY}, sequence(0)
+    : PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, 0, HEAD_VERSION,
+      COMPAT_VERSION}, sequence(0)
   {
     set_priority(CEPH_MSG_PRIO_HIGH);
   }
@@ -56,8 +58,8 @@ public:
         bool enable_diff = false)  // default to legacy behavior for backward compatibility
     : PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON,
                           0,
-                          enable_diff ? BEACON_VERSION_ENHANCED :
-                          BEACON_VERSION_LEGACY, BEACON_VERSION_LEGACY},// Minimum compatible version
+                          enable_diff ? HEAD_VERSION : COMPAT_VERSION,
+                          COMPAT_VERSION},
       gw_id(gw_id_), gw_pool(gw_pool_), gw_group(gw_group_), subsystems(subsystems_),
       availability(availability_), last_osd_epoch(last_osd_epoch_),
       last_gwmap_epoch(last_gwmap_epoch_), sequence(sequence_)
@@ -103,8 +105,8 @@ public:
     encode((uint32_t)availability, payload);
     encode(last_osd_epoch, payload);
     encode(last_gwmap_epoch, payload);
-    // Only encode sequence for enhanced beacons (HEAD_VERSION >= 2)
-    if (get_header().version >= BEACON_VERSION_ENHANCED) {
+    // Only encode sequence for enhanced beacons (version >= HEAD_VERSION)
+    if (get_header().version >= HEAD_VERSION) {
       encode(sequence, payload);
     }
   }
@@ -123,8 +125,8 @@ public:
     availability = static_cast<gw_availability_t>(tmp);
     decode(last_osd_epoch, p);
     decode(last_gwmap_epoch, p);
-    // Only decode sequence for enhanced beacons (HEAD_VERSION >= 2)
-    if (get_header().version >= BEACON_VERSION_ENHANCED && !p.end()) {
+    // Only decode sequence for enhanced beacons (version >= HEAD_VERSION)
+    if (get_header().version >= HEAD_VERSION && !p.end()) {
       decode(sequence, p);
     } else {
       sequence = 0;  // Legacy beacons don't have sequence field