From: Sage Weil Date: Thu, 14 Mar 2019 16:29:10 +0000 (-0500) Subject: mon/OSDMonitor: apply osd_crush_update_weight_set for reweight, create-or-move X-Git-Tag: v15.0.0~144^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50e4b818eac7d67e3307fdde90420334ecad512e;p=ceph.git mon/OSDMonitor: apply osd_crush_update_weight_set for reweight, create-or-move Since CrushWrapper no longer applies this setting at a low level, where it can't tell what the real intention is, we instead apply it at the top command level where we do. Specifically, we use it to control whether the weight-set weights are set for the commands osd crush reweight osd crush reweight-subtree osd crush move osd crush create-or-move Note that this (indirectly) affects the way weight-set weights are initialized for newly created OSDs, since those are added to the crush map via the 'osd crush create-or-move' command. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 695595e5c0e..f98d74aa128 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -9360,7 +9360,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, CrushWrapper newcrush; _get_pending_crush(newcrush); - err = newcrush.create_or_move_item(cct, osdid, weight, osd_name, loc); + err = newcrush.create_or_move_item(cct, osdid, weight, osd_name, loc, + g_conf()->osd_crush_update_weight_set); if (err == 0) { ss << "create-or-move updated item name '" << osd_name << "' weight " << weight @@ -9403,7 +9404,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, if (!newcrush.check_item_loc(cct, id, loc, (int *)NULL)) { if (id >= 0) { - err = newcrush.create_or_move_item(cct, id, 0, name, loc); + err = newcrush.create_or_move_item( + cct, id, 0, name, loc, + g_conf()->osd_crush_update_weight_set); } else { err = newcrush.move_bucket(cct, id, loc); } @@ -9624,7 +9627,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, goto reply; } - err = newcrush.adjust_item_weightf(cct, id, w); + err = newcrush.adjust_item_weightf(cct, id, w, + g_conf()->osd_crush_update_weight_set); if (err < 0) goto reply; pending_inc.crush.clear(); @@ -9662,7 +9666,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, goto reply; } - err = newcrush.adjust_subtree_weightf(cct, id, w); + err = newcrush.adjust_subtree_weightf(cct, id, w, + g_conf()->osd_crush_update_weight_set); if (err < 0) goto reply; pending_inc.crush.clear();