]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: add 'mon osd allow primary affinity' bool option
authorSage Weil <sage@inktank.com>
Mon, 3 Feb 2014 01:34:25 +0000 (17:34 -0800)
committerSage Weil <sage@inktank.com>
Sat, 15 Feb 2014 18:50:09 +0000 (10:50 -0800)
By default, disallow adjustment of primary affinity unless the user has
opted in by adjusting their monitor config.  This will avoid some user
pain because inadvertantly setting the affinity will prevent older clients
from connecting to and using the cluster.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc
src/vstart.sh

index b53aa7cd08e57f02ae90cf68fdbb83e4eef86ba9..fedf9270c0f00d6f136e15324339a977497f3530 100644 (file)
@@ -151,6 +151,7 @@ OPTION(mon_osd_min_up_ratio, OPT_DOUBLE, .3)    // min osds required to be up to
 OPTION(mon_osd_min_in_ratio, OPT_DOUBLE, .3)   // min osds required to be in to mark things out
 OPTION(mon_osd_max_op_age, OPT_DOUBLE, 32)     // max op age before we get concerned (make it a power of 2)
 OPTION(mon_osd_max_split_count, OPT_INT, 32) // largest number of PGs per "involved" OSD to let split create
+OPTION(mon_osd_allow_primary_affinity, OPT_BOOL, false)  // allow primary_affinity to be set in the osdmap
 OPTION(mon_stat_smooth_intervals, OPT_INT, 2)  // smooth stats over last N PGMap maps
 OPTION(mon_lease, OPT_FLOAT, 5)       // lease interval
 OPTION(mon_lease_renew_interval, OPT_FLOAT, 3) // on leader, to renew the lease
index 8d162add6ca75420443f2d251c158e0fedd7c4eb..17b67de57fc63f4d61b5514e1c7896721f968690 100644 (file)
@@ -3964,6 +3964,11 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
       err = -EINVAL;
       goto reply;
     }
+    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;
+    }
     if (osdmap.exists(id)) {
       pending_inc.new_primary_affinity[id] = ww;
       ss << "set osd." << id << " primary-affinity to " << w << " (" << ios::hex << ww << ios::dec << ")";
index 24eae198df2ca511389b7fa5cb31bd369b9562b6..181f812f8844365eefefa1abb2fe28e16abd06ee 100755 (executable)
@@ -369,6 +369,7 @@ $COSDMEMSTORE
 $extra_conf
 [mon]
         mon pg warn min per osd = 10
+        mon osd allow primary affinity = true
 $DAEMONOPTS
 $CMONDEBUG
 $extra_conf