From c9921dc7e9da6e0b23a8c9a5652dcaa6963b54bc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 25 Oct 2018 15:16:34 -0500 Subject: [PATCH] crushtool: --reweight should only reweight nonshadow roots The shadow roots will be then be rebuilt accordingly. Signed-off-by: Sage Weil --- src/crush/CrushWrapper.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 9129d620698..b378b422a38 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, -- 2.39.5