]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume lvm.listing create a helper that lists osds
authorAlfredo Deza <adeza@redhat.com>
Tue, 27 Mar 2018 11:51:03 +0000 (07:51 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Thu, 19 Apr 2018 16:31:20 +0000 (12:31 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit cee7612ce400ca4bc3e6e5dbcc1a158178edafe5)

src/ceph-volume/ceph_volume/devices/lvm/listing.py

index 71407d7ea9a3713c450f4f668f6f5823a26a5cd1..d1d96d7adb5a66968fdd3875f8c300bfbcb68146 100644 (file)
@@ -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'