expect_false ceph osd reweight 0 -1
ceph osd reweight 0 1
+ceph osd primary-affinity osd.0 .9
+expect_false ceph osd primary-affinity osd.0 -2
+ceph osd primary-affinity osd.0 1
+
for s in pg_num pgp_num size min_size crash_replay_interval crush_ruleset; do
ceph osd pool get data $s
done
"name=id,type=CephInt,range=0 " \
"type=CephFloat,name=weight,range=0.0|1.0", \
"reweight osd to 0.0 < <weight> < 1.0", "osd", "rw", "cli,rest")
+COMMAND("osd primary-affinity " \
+ "name=id,type=CephOsdName " \
+ "type=CephFloat,name=weight,range=0.0|1.0", \
+ "adjust osd primary-affinity from 0.0 <= <weight> <= 1.0", \
+ "osd", "rw", "cli,rest")
COMMAND("osd lost " \
"name=id,type=CephInt,range=0 " \
"name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
get_last_committed() + 1));
return true;
}
+ } else if (prefix == "osd primary-affinity") {
+ int64_t id;
+ if (!cmd_getval(g_ceph_context, cmdmap, "id", id)) {
+ ss << "invalid osd id";
+ err = -EINVAL;
+ goto reply;
+ }
+ double w;
+ cmd_getval(g_ceph_context, cmdmap, "weight", w);
+ long ww = (int)((double)CEPH_OSD_MAX_PRIMARY_AFFINITY*w);
+ if (ww < 0L) {
+ ss << "weight must be >= 0";
+ err = -EINVAL;
+ 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 << ")";
+ getline(ss, rs);
+ wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, rs, get_last_committed()));
+ return true;
+ }
} else if (prefix == "osd reweight") {
int64_t id;
cmd_getval(g_ceph_context, cmdmap, "id", id);
cmd_getval(g_ceph_context, cmdmap, "weight", w);
long ww = (int)((double)CEPH_OSD_IN*w);
if (ww < 0L) {
- ss << "weight must be > 0";
+ ss << "weight must be >= 0";
err = -EINVAL;
goto reply;
}