From: Alexander Indenbaum Date: Sun, 2 Nov 2025 09:31:35 +0000 (+0200) Subject: mon/nvmeof: introduce HEAD_VERSION and COMPAT_VERSION constants X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b7482def8ec14d5955f09b89a967eb5dcf613eec;p=ceph-ci.git mon/nvmeof: introduce HEAD_VERSION and COMPAT_VERSION constants 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 --- diff --git a/src/messages/MNVMeofGwBeacon.h b/src/messages/MNVMeofGwBeacon.h index a8005658041..512fca40ed1 100644 --- a/src/messages/MNVMeofGwBeacon.h +++ b/src/messages/MNVMeofGwBeacon.h @@ -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(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