From: Sage Weil Date: Mon, 3 Feb 2014 01:34:25 +0000 (-0800) Subject: mon/OSDMonitor: add 'mon osd allow primary affinity' bool option X-Git-Tag: v0.78~173^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba3eef86d80096d6afaf4aa1b27683d375c46ce2;p=ceph.git mon/OSDMonitor: add 'mon osd allow primary affinity' bool option 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 --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index b53aa7cd08e..fedf9270c0f 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 8d162add6ca..17b67de57fc 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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 << ")"; diff --git a/src/vstart.sh b/src/vstart.sh index 24eae198df2..181f812f884 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -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