From cee7612ce400ca4bc3e6e5dbcc1a158178edafe5 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 27 Mar 2018 07:51:03 -0400 Subject: [PATCH] ceph-volume lvm.listing create a helper that lists osds Signed-off-by: Alfredo Deza --- .../ceph_volume/devices/lvm/listing.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py index 71407d7ea9a3..d1d96d7adb5a 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py @@ -52,6 +52,21 @@ def pretty_report(report): print(''.join(output)) +def direct_report(): + """ + Other non-cli consumers of listing information will want to consume the + report without the need to parse arguments or other flags. This helper + bypasses the need to deal with the class interface which is meant for cli + handling. + """ + _list = List([]) + # this is crucial: make sure that all paths will reflect current + # information. In the case of a system that has migrated, the disks will + # have changed paths + _list.update() + return _list.full_report() + + class List(object): help = 'list logical volumes and devices associated with Ceph' -- 2.47.3