From: Leonid Chernin Date: Tue, 21 Oct 2025 07:00:50 +0000 (+0300) Subject: nvmeofgw : beacon-diff cr changes 2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b1b1c2434a319976344747573b3998bfa2f45bf0;p=ceph-ci.git nvmeofgw : beacon-diff cr changes 2 Signed-off-by: Leonid Chernin --- diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index b9ca2690abe..9e51419e643 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -162,7 +162,6 @@ DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_PROXY_FEATURES, JEWEL, LUMINOUS) // overl DEFINE_CEPH_FEATURE(49, 2, SERVER_SQUID); DEFINE_CEPH_FEATURE_RETIRED(50, 1, MON_METADATA, MIMIC, OCTOPUS) DEFINE_CEPH_FEATURE(50, 2, SERVER_TENTACLE); -DEFINE_CEPH_FEATURE_RETIRED(51, 1, OSD_BITWISE_HOBJ_SORT, MIMIC, OCTOPUS) DEFINE_CEPH_FEATURE(51, 2, NVMEOF_BEACON_DIFF) // available DEFINE_CEPH_FEATURE_RETIRED(52, 1, OSD_PROXY_WRITE_FEATURES, MIMIC, OCTOPUS) diff --git a/src/messages/MNVMeofGwBeacon.h b/src/messages/MNVMeofGwBeacon.h index f18bb3cd7c8..a8005658041 100644 --- a/src/messages/MNVMeofGwBeacon.h +++ b/src/messages/MNVMeofGwBeacon.h @@ -55,7 +55,7 @@ public: uint64_t sequence_ = 0, // default sequence for backward compatibility bool enable_diff = false) // default to legacy behavior for backward compatibility : PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, - static_cast(enable_diff ? 1 : 0), // user_version: 1=enhanced, 0=legacy + 0, enable_diff ? BEACON_VERSION_ENHANCED : BEACON_VERSION_LEGACY, BEACON_VERSION_LEGACY},// Minimum compatible version gw_id(gw_id_), gw_pool(gw_pool_), gw_group(gw_group_), subsystems(subsystems_), diff --git a/src/mon/NVMeofGwMap.cc b/src/mon/NVMeofGwMap.cc index b2202705a58..5d1a42089e4 100755 --- a/src/mon/NVMeofGwMap.cc +++ b/src/mon/NVMeofGwMap.cc @@ -83,10 +83,10 @@ void NVMeofGwMap::remove_grp_id( } int NVMeofGwMap::cfg_add_gw( - const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool test) + const NvmeGwId &gw_id, const NvmeGroupKey& group_key, uint64_t features) { std::set allocated; - if (test || HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOFHAMAP)) { + if (HAVE_FEATURE(features, NVMEOFHAMAP)) { auto gw_epoch_it = gw_epoch.find(group_key); if (gw_epoch_it == gw_epoch.end()) { gw_epoch[group_key] = epoch; @@ -170,11 +170,8 @@ int NVMeofGwMap::cfg_add_gw( } int NVMeofGwMap::cfg_delete_gw( - const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool test) + const NvmeGwId &gw_id, const NvmeGroupKey& group_key) { - if (test) - return do_delete_gw(gw_id, group_key); - if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOFHA)) { dout(10) << " has NVMEOFHA: 1" << dendl; for (auto& gws_states: created_gws[group_key]) { diff --git a/src/mon/NVMeofGwMap.h b/src/mon/NVMeofGwMap.h index 0328b126117..bfc45a00985 100755 --- a/src/mon/NVMeofGwMap.h +++ b/src/mon/NVMeofGwMap.h @@ -68,14 +68,13 @@ public: void check_all_gws_in_deleting_state(const NvmeGwId &gw_id, const NvmeGroupKey& group_key); int cfg_add_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key, - bool test = false); - int cfg_delete_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key, - bool test = false); + uint64_t features); + int cfg_delete_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key); void process_gw_map_ka( const NvmeGwId &gw_id, const NvmeGroupKey& group_key, epoch_t& last_osd_epoch, bool &propose_pending); int process_gw_map_gw_down( - const NvmeGwId &gw_id, const Nv/meGroupKey& group_key, + const NvmeGwId &gw_id, const NvmeGroupKey& group_key, bool &propose_pending); int process_gw_map_gw_no_subsys_no_listeners( const NvmeGwId &gw_id, const NvmeGroupKey& group_key, diff --git a/src/mon/NVMeofGwMon.cc b/src/mon/NVMeofGwMon.cc index 2b029f8cf24..1e4d5525b9d 100644 --- a/src/mon/NVMeofGwMon.cc +++ b/src/mon/NVMeofGwMon.cc @@ -578,7 +578,8 @@ bool NVMeofGwMon::prepare_command(MonOpRequestRef op) auto group_key = std::make_pair(pool, group); dout(10) << " id "<< id <<" pool "<< pool << " group "<< group << dendl; if (prefix == "nvme-gw create") { - rc = pending_map.cfg_add_gw(id, group_key); + rc = pending_map.cfg_add_gw(id, group_key, + mon.get_quorum_con_features()); if (rc == -EINVAL) { err = rc; dout (4) << "Error: GW cannot be created " << id diff --git a/src/mon/NVMeofGwSerialize.h b/src/mon/NVMeofGwSerialize.h index 244524c299c..f9aabeb985d 100755 --- a/src/mon/NVMeofGwSerialize.h +++ b/src/mon/NVMeofGwSerialize.h @@ -337,12 +337,10 @@ inline void decode( decode(state.gw_map_epoch, bl); decode(state.subsystems, bl); uint32_t avail; - uint64_t last_beacon_seq_number; decode(avail, bl); state.availability = (gw_availability_t)avail; if (struct_v >= 2) { - decode(last_beacon_seq_number, bl); - state.last_beacon_seq_number = last_beacon_seq_number; + decode(state.last_beacon_seq_number, bl); decode(state.last_beacon_seq_ooo, bl); } DECODE_FINISH(bl); diff --git a/src/test/test_nvmeof_mon_encoding.cc b/src/test/test_nvmeof_mon_encoding.cc index e03df6c852e..9d936b8021d 100644 --- a/src/test/test_nvmeof_mon_encoding.cc +++ b/src/test/test_nvmeof_mon_encoding.cc @@ -40,9 +40,9 @@ void test_NVMeofGwMap() { BeaconSubsystem sub = { nqn, {}, {}, subsystem_change_t::SUBSYSTEM_CHANGED }; BeaconSubsystems subs = {sub}; - pending_map.cfg_add_gw("GW1" ,group_key, true); - pending_map.cfg_add_gw("GW2" ,group_key, true); - pending_map.cfg_add_gw("GW3" ,group_key, true); + pending_map.cfg_add_gw("GW1" ,group_key, CEPH_FEATURES_ALL); + pending_map.cfg_add_gw("GW2" ,group_key, CEPH_FEATURES_ALL); + pending_map.cfg_add_gw("GW3" ,group_key, CEPH_FEATURES_ALL); NvmeNonceVector new_nonces = {"abc", "def","hij"}; pending_map.created_gws[group_key]["GW1"].nonce_map[1] = new_nonces; pending_map.created_gws[group_key]["GW1"].performed_full_startup = true; @@ -104,9 +104,9 @@ void test_MNVMeofGwMap() { int epoch = msg1->get_gwmap_epoch(); dout(0) << "after decode empty msg: " << *msg1 << " epoch " << epoch << dendl; - pending_map.cfg_add_gw("GW1" ,group_key, true); - pending_map.cfg_add_gw("GW2" ,group_key, true); - pending_map.cfg_add_gw("GW3" ,group_key, true); + pending_map.cfg_add_gw("GW1" ,group_key, CEPH_FEATURES_ALL); + pending_map.cfg_add_gw("GW2" ,group_key, CEPH_FEATURES_ALL); + pending_map.cfg_add_gw("GW3" ,group_key, CEPH_FEATURES_ALL); NvmeNonceVector new_nonces = {"abc", "def","hij"}; pending_map.created_gws[group_key]["GW1"].nonce_map[1] = new_nonces; pending_map.created_gws[group_key]["GW1"].subsystems.push_back(sub);