]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: lvm list now works with raw devices
authorAndrew Schoen <aschoen@redhat.com>
Mon, 26 Feb 2018 20:43:40 +0000 (14:43 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 26 Feb 2018 20:43:40 +0000 (14:43 -0600)
If you used a raw device with --data to create an OSD
you can now use 'lvm list' to get information about that OSD
using the raw device name like:

ceph-volume lvm list /dev/sda

fixes http://tracker.ceph.com/issues/23140

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/devices/lvm/listing.py

index 6982f91bcdae298a84af18c6aa6f6769226c8bac..6c13526eb11754dc55bae6b7cc9f7d60f2c6cfa2 100644 (file)
@@ -119,11 +119,18 @@ class List(object):
         """
         Generate a report for a single device. This can be either a logical
         volume in the form of vg/lv or a device with an absolute path like
-        /dev/sda1
+        /dev/sda1 or /dev/sda
         """
         lvs = api.Volumes()
         report = {}
         lv = api.get_lv_from_argument(device)
+
+        # check if there was a pv created with the
+        # name of device
+        pv = api.get_pv(pv_name=device)
+        if pv and not lv:
+            lv = api.get_lv(vg_name=pv.vg_name)
+
         if lv:
             try:
                 _id = lv.tags['ceph.osd_id']