]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crushtool: crush_finalize on any map modification
authorSage Weil <sage.weil@dreamhost.com>
Fri, 23 Sep 2011 04:00:52 +0000 (21:00 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 23 Sep 2011 04:02:39 +0000 (21:02 -0700)
This recalculates max_devices and the parent maps.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/crushtool.cc

index 06429363f0ce0a0e84f5ac9ceedcb806b5784c81..b3275efccce1c5aefbc37200b3a2087551a52b8f 100644 (file)
@@ -94,9 +94,6 @@ void parse_device(iter_t const& i, CrushWrapper &crush)
   id_item[id] = name;
 
   if (verbose) cout << "device " << id << " '" << name << "'" << std::endl;
-
-  if (id >= crush.get_max_devices())
-    crush.set_max_devices(id+1);
 }
 
 void parse_bucket_type(iter_t const& i, CrushWrapper &crush)
@@ -1142,9 +1139,6 @@ int main(int argc, const char **argv)
     int rno = crush_add_rule(crush.crush, rule, -1);
     crush.set_rule_name(rno, "data");
 
-    crush.finalize();
-    dout(0) << "crush max_devices " << crush.crush->max_devices << dendl;
-
     modified = true;
   }
 
@@ -1200,6 +1194,8 @@ int main(int argc, const char **argv)
   }
 
   if (modified) {
+    crush.finalize();
+
     if (outfn.empty()) {
       cout << me << " successfully built or modified map.  Use '-o <file>' to write it out." << std::endl;
     } else {