From: Alfredo Deza Date: Thu, 1 Feb 2018 20:34:09 +0000 (-0500) Subject: ceph-volume util.encryption parse legacy encrypted with dirs too X-Git-Tag: v13.0.2~330^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32cb810f8ab7e4a710bfb2590a065dea41369fce;p=ceph.git ceph-volume util.encryption parse legacy encrypted with dirs too Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/util/encryption.py b/src/ceph-volume/ceph_volume/util/encryption.py index f86eb19a6339a..174da30e3ef80 100644 --- a/src/ceph-volume/ceph_volume/util/encryption.py +++ b/src/ceph-volume/ceph_volume/util/encryption.py @@ -2,7 +2,7 @@ import base64 import os import logging from ceph_volume import process, conf -from ceph_volume.util import constants +from ceph_volume.util import constants, system from .prepare import write_keyring from .disk import lsblk, device_family, get_part_entry_type @@ -206,6 +206,13 @@ def legacy_encrypted(device): This function assumes that ``device`` will be a partition. """ + if os.path.isdir(device): + mounts = system.get_mounts(paths=True) + # yes, rebind the device variable here because a directory isn't going + # to help with parsing + device = mounts.get(device, [None])[0] + if not device: + raise RuntimeError('unable to determine the device mounted at %s' % device) metadata = {'encrypted': False, 'type': None, 'lockbox': '', 'device': device} # check if the device is online/decrypted first active_mapper = status(device)