if len(unused_devices) == 1:
last_device = unused_devices[0]
if not last_device.rotational and last_device.is_lvm_member:
- reason = "Used by ceph as a %s already and there are no devices left for data/block" % (
- last_device.lvs[0].tags.get("ceph.type"),
- )
+ if last_device.lvs:
+ reason = "Used by ceph as a %s already and there are no devices left for data/block" % (
+ last_device.lvs[0].tags.get("ceph.type"),
+ )
+ else:
+ reason = "Disk is an LVM member already, skipping"
filtered_devices[last_device.abspath] = {"reasons": [reason]}
logger.info(reason + ": %s" % last_device.abspath)
unused_devices = []
self.filtered_devices.update({d: used_reason for d in
getattr(self.args, dev_list_prop)
if d.used_by_ceph})
- if self.args.yes and dev_list and devs != usable:
+ # only fail if non-interactive, this iteration concerns
+ # non-data devices, there are usable data devices (or not all
+ # data devices were filtered) and non-data devices were filtered
+ # so in short this branch is not taken if all data devices are
+ # filtered
+ if self.args.yes and dev_list and self.usable and devs != usable:
err = '{} devices were filtered in non-interactive mode, bailing out'
raise RuntimeError(err.format(len(devs) - len(usable)))