From f3fa3c0158bfe2a448be6ecf2dea6346d3775a92 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 4 May 2017 12:19:13 -0500 Subject: [PATCH] mon/OSDMonitor: switch primary-{affinity,temp} checks to require_min_compat_client If require_min_compat_client is set (we've finished luminous upgrade), use that to enforce primary_temp and primary_affinity settings. Otherwise, use the legacy config option. Drop the assert in update_from_paxos. After luminous we can remove the config options entirely. Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index f55d5349590c8..288933b4c8f97 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -430,9 +430,6 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) } // XXX: need to trim MonSession connected with a osd whose id > max_osd? - /** we don't have any of the feature bit infrastructure in place for - * supporting primary_temp mappings without breaking old clients/OSDs.*/ - assert(g_conf->mon_osd_allow_primary_temp || osdmap.primary_temp->empty()); if (mon->is_leader()) { // kick pgmon, make sure it's seen the latest map mon->pgmon()->check_osd_map(osdmap.epoch); @@ -7562,7 +7559,13 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, goto reply; } - if (!g_conf->mon_osd_allow_primary_temp) { + if (osdmap.require_min_compat_client.length() && + osdmap.require_min_compat_client < "firefly") { + ss << "require_min_compat_client " << osdmap.require_min_compat_client + << " < firefly, which is required for primary-temp"; + err = -EPERM; + goto reply; + } else if (!g_conf->mon_osd_allow_primary_temp) { ss << "you must enable 'mon osd allow primary temp = true' on the mons before you can set primary_temp mappings. note that this is for developers only: older clients/OSDs will break and there is no feature bit infrastructure in place."; err = -EPERM; goto reply; @@ -7815,7 +7818,13 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, err = -EINVAL; goto reply; } - if (!g_conf->mon_osd_allow_primary_affinity) { + if (osdmap.require_min_compat_client.length() && + osdmap.require_min_compat_client < "firefly") { + ss << "require_min_compat_client " << osdmap.require_min_compat_client + << " < firefly, which is required for primary-affinity"; + err = -EPERM; + goto reply; + } else if (!g_conf->mon_osd_allow_primary_affinity) { ss << "you must enable 'mon osd allow primary affinity = true' on the mons before you can adjust primary-affinity. note that older clients will no longer be able to communicate with the cluster."; err = -EPERM; goto reply; -- 2.39.5