]> git.apps.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>
Wed, 20 Mar 2019 09:57:51 +0000 (04:57 -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>
src/mon/OSDMonitor.cc

index 695595e5c0e893db33755e2e5104ffbf444c234c..f98d74aa128ede6227f22c4900e6a4bf7a5c408d 100644 (file)
@@ -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();