Merge pull request #1531 from ogayot/fix-discarded-passphrase
storage: fix creation of encrypted VG in manual partitioning
This commit is contained in:
commit
9aeb3d2bb3
|
@ -123,7 +123,7 @@ class FilesystemManipulator:
|
|||
|
||||
def create_volgroup(self, spec):
|
||||
devices = set()
|
||||
key = spec.get('password')
|
||||
key = spec.get('passphrase')
|
||||
for device in spec['devices']:
|
||||
self.clear(device)
|
||||
if key:
|
||||
|
@ -277,7 +277,7 @@ class FilesystemManipulator:
|
|||
|
||||
def volgroup_handler(self, existing, spec):
|
||||
if existing is not None:
|
||||
key = spec.get('password')
|
||||
key = spec.get('passphrase')
|
||||
for d in existing.devices:
|
||||
if d.type == "dm_crypt":
|
||||
self.model.remove_dm_crypt(d)
|
||||
|
|
|
@ -82,7 +82,7 @@ class TestFilesystemManipulator(unittest.TestCase):
|
|||
def test_delete_encrypted_vg(self):
|
||||
manipulator, disk = make_manipulator_and_disk()
|
||||
spec = {
|
||||
'password': 'passw0rd',
|
||||
'passphrase': 'passw0rd',
|
||||
'devices': {disk},
|
||||
'name': 'vg0',
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
vg_name = 'ubuntu-vg-{}'.format(i)
|
||||
spec = dict(name=vg_name, devices=set([part]))
|
||||
if lvm_options and lvm_options['encrypt']:
|
||||
spec['password'] = lvm_options['luks_options']['password']
|
||||
spec['passphrase'] = lvm_options['luks_options']['passphrase']
|
||||
vg = self.create_volgroup(spec)
|
||||
# There's no point using LVM and unconditionally filling the
|
||||
# VG with a single LV, but we should use more of a smaller
|
||||
|
@ -352,14 +352,14 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
raise Exception(f'gap not found after resize, pgs={pgs}')
|
||||
return gap
|
||||
|
||||
def build_lvm_options(self, password):
|
||||
if password is None:
|
||||
def build_lvm_options(self, passphrase):
|
||||
if passphrase is None:
|
||||
return None
|
||||
else:
|
||||
return {
|
||||
'encrypt': True,
|
||||
'luks_options': {
|
||||
'password': password,
|
||||
'passphrase': passphrase,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue