From: Sage Weil Date: Thu, 25 Oct 2018 20:16:34 +0000 (-0500) Subject: crushtool: --reweight should only reweight nonshadow roots X-Git-Tag: v14.1.0~788^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c9921dc7e9da6e0b23a8c9a5652dcaa6963b54bc;p=ceph.git crushtool: --reweight should only reweight nonshadow roots The shadow roots will be then be rebuilt accordingly. Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 9129d6206981..b378b422a387 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -2024,17 +2024,20 @@ int CrushWrapper::get_new_bucket_id() void CrushWrapper::reweight(CephContext *cct) { set roots; - find_roots(&roots); - for (set::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,