]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: add info about filtered devices to batch pretty reports
authorAndrew Schoen <aschoen@redhat.com>
Fri, 5 Oct 2018 21:18:48 +0000 (16:18 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 10 Oct 2018 19:30:29 +0000 (15:30 -0400)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/devices/lvm/batch.py
src/ceph-volume/ceph_volume/devices/lvm/strategies/bluestore.py
src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py
src/ceph-volume/ceph_volume/util/templates.py

index 113c40149ceee39127fd7b0a33686c7ff1dae4de..e85ab9d1456cdc1c3de4abd66ccc395c0ebac632 100644 (file)
@@ -159,18 +159,18 @@ class Batch(object):
         if used_devices:
             for device in used_devices:
                 args.filtered_devices[device] = {"reasons": ["Used by ceph as a data device already"]}
-            if not args.report:
-                mlogger.info("Ignoring devices already used by ceph: %s" % ",".join(used_devices))
-        if not unused_devices and not args.report:
+            if args.yes and unused_devices:
+                mlogger.info("Ignoring devices already used by ceph: %s" % ", ".join(used_devices))
+        if not unused_devices and not args.format == 'json':
             # report nothing changed
             mlogger.info("All devices are already used by ceph. No OSDs will be created.")
             raise SystemExit(0)
         else:
             new_strategy = get_strategy(args, unused_devices)
-            if strategy != new_strategy:
+            if new_strategy and strategy != new_strategy:
                 if args.report:
                     mlogger.info("Ignoring devices already used by ceph: %s" % ",".join(used_devices))
-                mlogger.error("aborting because strategy changed from %s to %s after filtering" % (strategy.type(), new_strategy.type()))
+                mlogger.error("Aborting because strategy changed from %s to %s after filtering" % (strategy.type(), new_strategy.type()))
                 raise SystemExit(1)
 
         return strategy(unused_devices, args)
index 0b54447a3561c13b33f5113d4914fcbb2aadf6d8..efd2956dd84e62d21ae8db66b87a1ae566a72261 100644 (file)
@@ -40,6 +40,8 @@ class SingleType(object):
 
     def report_pretty(self):
         string = ""
+        if self.args.filtered_devices:
+            string += templates.filtered_devices(self.args.filtered_devices)
         string += templates.total_osds.format(
             total_osds=self.total_osds,
         )
@@ -166,6 +168,8 @@ class MixedType(object):
         db_size = str(disk.Size(b=(vg_extents['sizes'])))
 
         string = ""
+        if self.args.filtered_devices:
+            string += templates.filtered_devices(self.args.filtered_devices)
         string += templates.total_osds.format(
             total_osds=len(self.hdds) * self.osds_per_device
         )
index 2960f75fec0c4cafabd0fd5f5d2b39de389d3f3b..2309414da0deebf6cef68ea260e2034a16a93fdc 100644 (file)
@@ -52,6 +52,8 @@ class SingleType(object):
 
     def report_pretty(self):
         string = ""
+        if self.args.filtered_devices:
+            string += templates.filtered_devices(self.args.filtered_devices)
         string += templates.total_osds.format(
             total_osds=self.total_osds
         )
@@ -206,6 +208,8 @@ class MixedType(object):
 
     def report_pretty(self):
         string = ""
+        if self.args.filtered_devices:
+            string += templates.filtered_devices(self.args.filtered_devices)
         string += templates.total_osds.format(
             total_osds=self.total_osds
         )
index 90858d62dab683bc0f2b63fed018efa252815220..78edd63d702a6b580f3ac49493c926b9f23f3ab0 100644 (file)
@@ -15,6 +15,22 @@ total_osds = """
 Total OSDs: {total_osds}
 """
 
+
+def filtered_devices(devices):
+    string = """
+Filtered Devices:"""
+    for device, info in devices.iteritems():
+        string += """
+  %s""" % device
+
+        for reason in info['reasons']:
+            string += """
+    %s""" % reason
+
+    string += "\n"
+    return string
+
+
 ssd_volume_group = """
 Solid State VG:
   Targets:   {target: <25} Total size: {total_lv_size: <25}