]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: apply osd_crush_update_weight_set for reweight, create-or-move
authorSage Weil <sage@redhat.com>
Thu, 14 Mar 2019 16:29:10 +0000 (11:29 -0500)
committerSage Weil <sage@redhat.com>
Fri, 22 Mar 2019 10:02:15 +0000 (05:02 -0500)
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 <sage@redhat.com>
(cherry picked from commit 50e4b818eac7d67e3307fdde90420334ecad512e)

src/mon/OSDMonitor.cc

index 1b5f4d30e39ac8a4b630eabd21431c7787247174..5e995d4bc857e013aa9c2155bae8f8b1f2e6f9e1 100644 (file)
@@ -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();