]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crushtool: --reweight should only reweight nonshadow roots
authorSage Weil <sage@redhat.com>
Thu, 25 Oct 2018 20:16:34 +0000 (15:16 -0500)
committerSage Weil <sage@redhat.com>
Wed, 28 Nov 2018 02:36:43 +0000 (20:36 -0600)
The shadow roots will be then be rebuilt accordingly.

Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc

index 9129d62069813a8f534c988ac8a78f6dc10a8614..b378b422a38779d30be4d33bb9951ea586175683 100644 (file)
@@ -2024,17 +2024,20 @@ int CrushWrapper::get_new_bucket_id()
 void CrushWrapper::reweight(CephContext *cct)
 {
   set<int> roots;
-  find_roots(&roots);
-  for (set<int>::iterator p = roots.begin(); p != roots.end(); ++p) {
-    if (*p >= 0)
+  find_nonshadow_roots(&roots);
+  for (auto id : roots) {
+    if (id >= 0)
       continue;
-    crush_bucket *b = get_bucket(*p);
-    ldout(cct, 5) << "reweight bucket " << *p << dendl;
+    crush_bucket *b = get_bucket(id);
+    ldout(cct, 5) << "reweight root bucket " << id << dendl;
     int r = crush_reweight_bucket(crush, b);
     ceph_assert(r == 0);
   }
+  int r = rebuild_roots_with_classes();
+  ceph_assert(r == 0);
 }
 
+
 int CrushWrapper::add_simple_rule_at(
   string name, string root_name,
   string failure_domain_name,