Validate output of list_logical_volumes

The charm was checking for the zeroth value of the return value of
list_logical_volumes. However, if no logical volumes are found it
returns an empty list.

This change validates that the list has an entry.

Change-Id: I75a6b1dda15dd7c2cece8cfe97b28317b3d5162b
Partial-Bug: #1819382
This commit is contained in:
David Ames 2019-05-15 10:58:18 -07:00
parent 55b79ddd66
commit cd5360736d
1 changed files with 4 additions and 1 deletions

View File

@ -1692,7 +1692,10 @@ def is_active_bluestore_device(dev):
return False
vg_name = lvm.list_lvm_volume_group(dev)
lv_name = lvm.list_logical_volumes('vg_name={}'.format(vg_name))[0]
try:
lv_name = lvm.list_logical_volumes('vg_name={}'.format(vg_name))[0]
except IndexError:
return False
block_symlinks = glob.glob('/var/lib/ceph/osd/ceph-*/block')
for block_candidate in block_symlinks: