2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-04-01 15:03:31 +00:00

Explicitly mknodes for pack/unpack

In some contexts, udev may be asleep
at the wheel. Explictly have dmsetup
refresh the devnodes.
This commit is contained in:
Jarrod Johnson
2026-01-15 15:15:11 -05:00
parent 61d7a49163
commit 048780e16d

View File

@@ -386,6 +386,7 @@ def encrypt_image(plainfile, cryptfile, keyfile):
loopdev = subprocess.check_output(['losetup', '-f']).decode('utf8').strip()
subprocess.check_call(['losetup', loopdev, cryptfile])
subprocess.check_call(['dmsetup', 'create', dmname, '--table', '0 {} crypt aes-xts-plain64 {} 0 {} 8'.format(neededblocks, key, loopdev)])
subprocess.check_call(['dmsetup', 'mknodes', dmname])
with open('/dev/mapper/{}'.format(dmname), 'wb') as cryptout:
with open(plainfile, 'rb+') as plainin:
lastoffset = 0
@@ -1295,6 +1296,7 @@ def prep_decrypt(indir):
tempfile.mktemp()
subprocess.check_call(['dmsetup', 'create', dmname, '--table', '0 {0} crypt {1} {2} 0 {3} 8'.format(
imglen, cipher, key, loopdev)])
subprocess.check_call(['dmsetup', 'mknodes', dmname])
return '/dev/mapper/{0}'.format(dmname), loopdev