From 729ed7c98ec9833b3826d42d91d9a7e4cbf876b2 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 27 Feb 2018 09:02:12 -0600 Subject: [PATCH] ceph-volume: if using lvm list on a device with many lvs, show them all Signed-off-by: Andrew Schoen --- src/ceph-volume/ceph_volume/devices/lvm/listing.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/listing.py b/src/ceph-volume/ceph_volume/devices/lvm/listing.py index 6c13526eb1175..71407d7ea9a37 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/listing.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/listing.py @@ -6,6 +6,7 @@ from textwrap import dedent from ceph_volume import decorators from ceph_volume.util import disk from ceph_volume.api import lvm as api +from ceph_volume.exceptions import MultipleLVsError logger = logging.getLogger(__name__) @@ -129,7 +130,11 @@ class List(object): # name of device pv = api.get_pv(pv_name=device) if pv and not lv: - lv = api.get_lv(vg_name=pv.vg_name) + try: + lv = api.get_lv(vg_name=pv.vg_name) + except MultipleLVsError: + lvs.filter(vg_name=pv.vg_name) + return self.full_report(lvs=lvs) if lv: try: @@ -165,12 +170,13 @@ class List(object): ) return report - def full_report(self): + def full_report(self, lvs=None): """ Generate a report for all the logical volumes and associated devices that have been previously prepared by Ceph """ - lvs = api.Volumes() + if lvs is None: + lvs = api.Volumes() report = {} for lv in lvs: try: -- 2.39.5