Disable btrfs snapshots when no subvolumes defined (#3736)

This commit is contained in:
Daniel Girtler 2025-08-27 18:28:17 +10:00 committed by GitHub
parent 663e46f86e
commit e4e30b31d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View File

@ -118,7 +118,7 @@ class DiskLayoutConfigurationMenu(AbstractSubMenu[DiskLayoutConfiguration]):
disk_layout_conf: DiskLayoutConfiguration | None = self._menu_item_group.find_by_key('disk_config').value
if disk_layout_conf:
return disk_layout_conf.is_default_btrfs()
return disk_layout_conf.has_default_btrfs_vols()
return False

View File

@ -193,19 +193,20 @@ class DiskLayoutConfiguration:
if (enc_config := disk_config.get('disk_encryption', None)) is not None:
config.disk_encryption = DiskEncryption.parse_arg(config, enc_config, enc_password)
if config.is_default_btrfs():
if config.has_default_btrfs_vols():
if (btrfs_arg := disk_config.get('btrfs_options', None)) is not None:
config.btrfs_options = BtrfsOptions.parse_arg(btrfs_arg)
return config
def is_default_btrfs(self) -> bool:
def has_default_btrfs_vols(self) -> bool:
if self.config_type == DiskLayoutType.Default:
for mod in self.device_modifications:
for part in mod.partitions:
if part.is_create_or_modify():
if part.fs_type == FilesystemType.Btrfs:
return True
if len(part.btrfs_subvols) > 0:
return True
return False

View File

@ -150,7 +150,7 @@ def perform_installation(mountpoint: Path) -> None:
if servies := config.services:
installation.enable_service(servies)
if disk_config.is_default_btrfs():
if disk_config.has_default_btrfs_vols():
btrfs_options = disk_config.btrfs_options
snapshot_config = btrfs_options.snapshot_config if btrfs_options else None
snapshot_type = snapshot_config.snapshot_type if snapshot_config else None