From: Andrew Schoen Date: Mon, 26 Feb 2018 20:43:40 +0000 (-0600) Subject: ceph-volume: lvm list now works with raw devices X-Git-Tag: v12.2.5~154^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=59b031eb84d6ac6ed2458e82d8b6af6ec3d60ff6;p=ceph.git ceph-volume: lvm list now works with raw devices 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 (cherry picked from commit 3d447dbf2befc1fab7b8888eb670f9f2dfe5555a) --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py index 6982f91bcdae..6c13526eb117 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py @@ -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']