def get_or_create_dmcrypt_key(
- uuid,
+ _uuid,
key_dir,
):
- path = os.path.join(key_dir, uuid)
+ path = os.path.join(key_dir, _uuid)
# already have it?
if os.path.exists(path):
def dmcrypt_map(
rawdev,
keypath,
- uuid,
+ _uuid,
):
- dev = '/dev/mapper/'+ uuid
+ dev = '/dev/mapper/'+ _uuid
args = [
'cryptsetup',
'--key-file',
keypath,
'--key-size', '256',
'create',
- uuid,
+ _uuid,
rawdev,
]
try:
def dmcrypt_unmap(
- uuid
+ _uuid
):
args = [
'cryptsetup',
'remove',
- uuid
+ _uuid
]
try:
subprocess.check_call(args)
except subprocess.CalledProcessError as e:
- raise Error('unable to unmap device', uuid)
+ raise Error('unable to unmap device', _uuid)
def mount(
return (cluster, osd_id)
-def find_cluster_by_uuid(uuid):
+def find_cluster_by_uuid(_uuid):
"""
Find a cluster name by searching /etc/ceph/*.conf for a conf file
with the right uuid.
u = get_conf(cluster, 'fsid')
if u is None:
no_fsid.append(cluster)
- elif u == uuid:
+ elif u == _uuid:
return cluster
# be tolerant of /etc/ceph/ceph.conf without an fsid defined.
if len(no_fsid) == 1 and no_fsid[0] == 'ceph':