From: Andrew Schoen Date: Fri, 5 Oct 2018 21:18:48 +0000 (-0500) Subject: ceph-volume: add info about filtered devices to batch pretty reports X-Git-Tag: v12.2.9~5^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2bc72a21446791b7c046ae9a8c61d6d5ff2b4999;p=ceph.git ceph-volume: add info about filtered devices to batch pretty reports Signed-off-by: Andrew Schoen (cherry picked from commit 62426db799c54436c50b5751c8e72b3dbd710a2a) --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/batch.py b/src/ceph-volume/ceph_volume/devices/lvm/batch.py index 113c40149ceee..e85ab9d1456cd 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/batch.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/batch.py @@ -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) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/strategies/bluestore.py b/src/ceph-volume/ceph_volume/devices/lvm/strategies/bluestore.py index 0b54447a3561c..efd2956dd84e6 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/strategies/bluestore.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/strategies/bluestore.py @@ -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 ) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py b/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py index 2960f75fec0c4..2309414da0dee 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py @@ -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 ) diff --git a/src/ceph-volume/ceph_volume/util/templates.py b/src/ceph-volume/ceph_volume/util/templates.py index 90858d62dab68..78edd63d702a6 100644 --- a/src/ceph-volume/ceph_volume/util/templates.py +++ b/src/ceph-volume/ceph_volume/util/templates.py @@ -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}