]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: unlock all partitions when activate 18625/head
authorKefu Chai <kchai@redhat.com>
Wed, 30 Aug 2017 10:46:49 +0000 (18:46 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 30 Oct 2017 12:30:39 +0000 (20:30 +0800)
should unlock all dmcrypted partitions when activating a device.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit ba2aa0cee9e077d8439ba31228b41beb2d827a04)

src/ceph-disk/ceph_disk/main.py

index 28b0a1189262cd6a9e328a069d4d2f69d7b9c7fe..6d1a555ead930e882fb1973aa012a1e3da7005fa 100644 (file)
@@ -3752,23 +3752,18 @@ def main_activate(args):
             osd_data = get_mount_point(cluster, osd_id)
 
             args.cluster = cluster
-
-            # Check if encrypted block device in journal
-
-            block_dmcrypt_path = os.path.join(osd_data, 'block_dmcrypt')
-
-            if args.dmcrypt and os.path.exists(block_dmcrypt_path):
-                partition = DevicePartition.factory(
-                    path=None,
-                    dev=os.path.join(osd_data, 'block_dmcrypt'),
-                    args=args)
-
-                partition.osd_dm_key = get_dmcrypt_key(
-                    get_partition_uuid(args.path),
-                    args.dmcrypt_key_dir,
-                    CryptHelpers.get_dmcrypt_type(args) == "luks")
-
-                partition.map()
+            if args.dmcrypt:
+                for name in Space.NAMES:
+                    # Check if encrypted device in journal
+                    dev_path = os.path.join(osd_data, name + '_dmcrypt')
+                    if not os.path.exists(dev_path):
+                        continue
+                    partition = DevicePartition.factory(
+                        path=None,
+                        dev=dev_path,
+                        args=args)
+                    partition.rawdev = args.path
+                    partition.map()
 
         elif stat.S_ISDIR(mode):
             (cluster, osd_id) = activate_dir(