From 3988ab8ecbb61c28bb5ba98fd7390f8fa76733a7 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Wed, 8 Apr 2020 10:41:56 +0200 Subject: [PATCH] ceph-volume/batch: check lvs list before access Fixes: https://tracker.ceph.com/issues/44989 Signed-off-by: Jan Fajerski (cherry picked from commit c6dcf3161b2d69b88acdda473b85c9dd2c8433e3) --- src/ceph-volume/ceph_volume/devices/lvm/batch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/batch.py b/src/ceph-volume/ceph_volume/devices/lvm/batch.py index 27ee5bb47e006..84cbfad554b3d 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/batch.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/batch.py @@ -106,9 +106,12 @@ def filter_devices(args): if len(unused_devices) == 1: last_device = unused_devices[0] if not last_device.rotational and last_device.is_lvm_member: - reason = "Used by ceph as a %s already and there are no devices left for data/block" % ( - last_device.lvs[0].tags.get("ceph.type"), - ) + if last_device.lvs: + reason = "Used by ceph as a %s already and there are no devices left for data/block" % ( + last_device.lvs[0].tags.get("ceph.type"), + ) + else: + reason = "Disk is an LVM member already, skipping" filtered_devices[last_device.abspath] = {"reasons": [reason]} logger.info(reason + ": %s" % last_device.abspath) unused_devices = [] -- 2.39.5