]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: legacy_encrypted() shouldn't call lsblk() when device is 'tmpfs' 50162/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Sat, 18 Feb 2023 02:05:51 +0000 (03:05 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Sat, 18 Feb 2023 19:58:05 +0000 (20:58 +0100)
When the device variable is rebound and become 'tmpfs', lsblk() shouldn't be called.

Fixes: https://tracker.ceph.com/issues/58784
Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit c0369fbecee1a4d71004ee5e72ee0e2526d0fcf2)

src/ceph-volume/ceph_volume/util/disk.py
src/ceph-volume/ceph_volume/util/encryption.py

index 09db425e00ae838a9aa0594c632cf59910e70ade..1a76a8a05514e06ca4751e3d43bc436ec7a9f394 100644 (file)
@@ -238,9 +238,11 @@ def _udevadm_info(device):
 
 
 def lsblk(device, columns=None, abspath=False):
-    result = lsblk_all(device=device,
-                       columns=columns,
-                       abspath=abspath)
+    result = []
+    if not os.path.isdir(device):
+        result = lsblk_all(device=device,
+                           columns=columns,
+                           abspath=abspath)
     if not result:
         raise RuntimeError(f"{device} not found is lsblk report")
 
index cefd6094bd09eb7d4fcaafbc8e74f4819e4621ac..3310ab78c37f49a5a9144a3696904dc4a2098910 100644 (file)
@@ -234,6 +234,7 @@ def legacy_encrypted(device):
 
     This function assumes that ``device`` will be a partition.
     """
+    disk_meta = {}
     if os.path.isdir(device):
         mounts = system.Mounts(paths=True).get_mounts()
         # yes, rebind the device variable here because a directory isn't going
@@ -265,7 +266,8 @@ def legacy_encrypted(device):
     # parent device name for the device so that we can query all of its
     # associated devices and *then* look for one that has the 'lockbox' label
     # on it. Thanks for being awesome ceph-disk
-    disk_meta = lsblk(device, abspath=True)
+    if not device == 'tmpfs':
+        disk_meta = lsblk(device, abspath=True)
     if not disk_meta:
         return metadata
     parent_device = disk_meta['PKNAME']