ceph-volume util.encryption robust blkid+lsblk detection of lockbox

Signed-off-by: Alfredo Deza <adeza@redhat.com>
This commit is contained in:
Alfredo Deza 2018-11-02 15:03:45 -04:00 committed by Alfredo Deza
parent 59db1dc303
commit fc3e6ea3d9

View File

@ -3,6 +3,7 @@ import os
import logging
from ceph_volume import process, conf
from ceph_volume.util import constants, system
from ceph_volume.util.device import Device
from .prepare import write_keyring
from .disk import lsblk, device_family, get_part_entry_type
@ -251,9 +252,9 @@ def legacy_encrypted(device):
return metadata
parent_device = disk_meta['PKNAME']
# With the parent device set, we can now look for the lockbox listing associated devices
devices = device_family(parent_device)
for i in devices:
if 'lockbox' in i.get('PARTLABEL', ''):
metadata['lockbox'] = i['NAME']
devices = [Device(i['NAME']) for i in device_family(parent_device)]
for d in devices:
if d.ceph_disk.type == 'lockbox':
metadata['lockbox'] = d.abspath
break
return metadata