]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/crushtool: skip device id if no name exists 18901/head
authorJan Fajerski <jfajerski@suse.com>
Wed, 8 Nov 2017 09:30:09 +0000 (10:30 +0100)
committerJan Fajerski <jfajerski@suse.com>
Tue, 14 Nov 2017 11:46:12 +0000 (12:46 +0100)
When an OSD with an id < max_id is removed, i.e. the osd ids are not
continuous, crushtool decompile prints bogus info. Skip any device ids
without a name.

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/crush/CrushCompiler.cc
src/test/cli/osdmaptool/create-racks.t

index 8825f7543c0f70383702bd0defc44a442d0ad4e3..6ac892a15be40a6f7e2bcda82be96ba245c24858 100644 (file)
@@ -314,10 +314,12 @@ int CrushCompiler::decompile(ostream &out)
 
   out << "\n# devices\n";
   for (int i=0; i<crush.get_max_devices(); i++) {
-    out << "device " << i << " ";
-    print_item_name(out, i, crush);
-    print_item_class(out, i, crush);
-    out << "\n";
+    const char *name = crush.get_item_name(i);
+    if (name) {
+      out << "device " << i << " " << name;
+      print_item_class(out, i, crush);
+      out << "\n";
+    }
   }
   
   out << "\n# types\n";
index f83475dce441ce1f383618be06074a0b871f9d79..fb13da65fc97eaaed0eaf8548d2eee387a2fbab2 100644 (file)
@@ -16,7 +16,6 @@
   tunable allowed_bucket_algs 54
   
   # devices
-  device 0 device0
   device 1 osd.1
   device 2 osd.2
   device 3 osd.3