ceph-volume: add info about filtered devices to batch pretty reports

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
This commit is contained in:
Andrew Schoen 2018-10-05 16:18:48 -05:00
parent 3b6d82afe7
commit 62426db799
4 changed files with 29 additions and 5 deletions

View 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)

View 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
)

View 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
)

View 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}