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: v14.2.1~117^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc6748ea65cdd631ab88597240501bb3704ddfc6;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 (cherry picked from commit 50e4b818eac7d67e3307fdde90420334ecad512e) --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 1b5f4d30e39a..5e995d4bc857 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -9369,7 +9369,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 @@ -9412,7 +9413,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); } @@ -9633,7 +9636,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(); @@ -9671,7 +9675,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();