Fix 2337 (and similar) - Ignore existing partitions (#2342)
* Fix 2337 * Update
This commit is contained in:
parent
9b1fd2e44f
commit
21dd295259
|
|
@ -296,15 +296,15 @@ class DeviceHandler(object):
|
||||||
the formatting functionality and in essence the support for the given filesystem.
|
the formatting functionality and in essence the support for the given filesystem.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# don't touch existing partitions
|
# only verify partitions that are being created or modified
|
||||||
filtered_part = [p for p in device_mod.partitions if not p.exists()]
|
create_or_modify_parts = [p for p in device_mod.partitions if p.is_create_or_modify()]
|
||||||
|
|
||||||
self._validate_partitions(filtered_part)
|
self._validate_partitions(create_or_modify_parts)
|
||||||
|
|
||||||
# make sure all devices are unmounted
|
# make sure all devices are unmounted
|
||||||
self._umount_all_existing(device_mod.device_path)
|
self._umount_all_existing(device_mod.device_path)
|
||||||
|
|
||||||
for part_mod in filtered_part:
|
for part_mod in create_or_modify_parts:
|
||||||
# partition will be encrypted
|
# partition will be encrypted
|
||||||
if enc_conf is not None and part_mod in enc_conf.partitions:
|
if enc_conf is not None and part_mod in enc_conf.partitions:
|
||||||
self._perform_enc_formatting(
|
self._perform_enc_formatting(
|
||||||
|
|
|
||||||
|
|
@ -793,6 +793,9 @@ class PartitionModification:
|
||||||
def is_exists_or_modify(self) -> bool:
|
def is_exists_or_modify(self) -> bool:
|
||||||
return self.status in [ModificationStatus.Exist, ModificationStatus.Modify]
|
return self.status in [ModificationStatus.Exist, ModificationStatus.Modify]
|
||||||
|
|
||||||
|
def is_create_or_modify(self) -> bool:
|
||||||
|
return self.status in [ModificationStatus.Create, ModificationStatus.Modify]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mapper_name(self) -> Optional[str]:
|
def mapper_name(self) -> Optional[str]:
|
||||||
if self.dev_path:
|
if self.dev_path:
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@ class FilesystemHandler:
|
||||||
device_handler.format(mod, enc_conf=self._enc_config)
|
device_handler.format(mod, enc_conf=self._enc_config)
|
||||||
|
|
||||||
for part_mod in mod.partitions:
|
for part_mod in mod.partitions:
|
||||||
if part_mod.fs_type == FilesystemType.Btrfs:
|
if part_mod.is_create_or_modify():
|
||||||
device_handler.create_btrfs_volumes(part_mod, enc_conf=self._enc_config)
|
if part_mod.fs_type == FilesystemType.Btrfs:
|
||||||
|
device_handler.create_btrfs_volumes(part_mod, enc_conf=self._enc_config)
|
||||||
|
|
||||||
def _do_countdown(self) -> bool:
|
def _do_countdown(self) -> bool:
|
||||||
SIG_TRIGGER = False
|
SIG_TRIGGER = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue