'libstoragemgmt'),
default=False,
)
+ parser.add_argument(
+ '--list-all',
+ action='store_true',
+ help=('Whether ceph-volume should list lvm devices'),
+ default=False
+ )
self.args = parser.parse_args(self.argv)
if self.args.path:
self.format_report(Device(self.args.path, with_lsm=self.args.with_lsm))
else:
self.format_report(Devices(filter_for_batch=self.args.filter_for_batch,
- with_lsm=self.args.with_lsm))
+ with_lsm=self.args.with_lsm,
+ list_all=self.args.list_all))
def get_report(self):
if self.args.path:
return Device(self.args.path, with_lsm=self.args.with_lsm).json_report()
else:
- return Devices(filter_for_batch=self.args.filter_for_batch, with_lsm=self.args.with_lsm).json_report()
+ return Devices(filter_for_batch=self.args.filter_for_batch,
+ with_lsm=self.args.with_lsm,
+ list_all=self.args.list_all).json_report()
def format_report(self, inventory):
if self.args.format == 'json':
A container for Device instances with reporting
"""
- def __init__(self, filter_for_batch=False, with_lsm=False):
+ def __init__(self,
+ filter_for_batch=False,
+ with_lsm=False,
+ list_all=False):
lvs = lvm.get_lvs()
lsblk_all = disk.lsblk_all()
all_devices_vgs = lvm.get_all_devices_vgs()
if not sys_info.devices:
sys_info.devices = disk.get_devices()
- self.devices = [Device(k,
- with_lsm,
- lvs=lvs,
- lsblk_all=lsblk_all,
- all_devices_vgs=all_devices_vgs) for k in
- sys_info.devices.keys()]
- if filter_for_batch:
- self.devices = [d for d in self.devices if d.available_lvm_batch]
+ self._devices = [Device(k,
+ with_lsm,
+ lvs=lvs,
+ lsblk_all=lsblk_all,
+ all_devices_vgs=all_devices_vgs) for k in
+ sys_info.devices.keys()]
+ self.devices = []
+ for device in self._devices:
+ if filter_for_batch and not device.available_lvm_batch:
+ continue
+ if device.is_lv and not list_all:
+ continue
+ self.devices.append(device)
def pretty_report(self):
output = [