]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: split get_dmcrypt_key_path from key creation
authorDavid Disseldorp <ddiss@suse.de>
Wed, 13 May 2015 10:58:50 +0000 (12:58 +0200)
committerSage Weil <sage@redhat.com>
Sat, 1 Aug 2015 13:58:34 +0000 (09:58 -0400)
In preparation for mapping dmcrypt cyphertext devs during activation.

Signed-off-by: David Disseldorp <ddiss@suse.de>
src/ceph-disk

index 36cb2b7b4a57ab10cca1a091f9293bcba01a9702..46f4e058aeb410595f1128537c148ea06d6408d2 100755 (executable)
@@ -796,23 +796,36 @@ def get_fsid(cluster):
     return fsid.lower()
 
 
-def get_or_create_dmcrypt_key(
+def get_dmcrypt_key_path(
     _uuid,
     key_dir,
-    key_size,
     luks
     ):
     """
-    Get path to dmcrypt key or create a new key file.
+    Get path to dmcrypt key file.
 
-    :return: Path to the dmcrypt key file.
+    :return: Path to the dmcrypt key file, callers should check for existence.
     """
     if luks:
         path = os.path.join(key_dir, _uuid + ".luks.key")
     else:
         path = os.path.join(key_dir, _uuid)
 
-    # already have it?
+    return path
+
+
+def get_or_create_dmcrypt_key(
+    _uuid,
+    key_dir,
+    key_size,
+    luks
+    ):
+    """
+    Get path to existing dmcrypt key or create a new key file.
+
+    :return: Path to the dmcrypt key file.
+    """
+    path = get_dmcrypt_key_path(_uuid, key_dir, luks)
     if os.path.exists(path):
         return path