Rework has_default_btrfs_vols (#4147)

This commit is contained in:
codefiles 2026-01-19 19:18:22 -05:00 committed by GitHub
parent 38462db2db
commit c7dbf0105e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 7 deletions

View File

@ -201,13 +201,13 @@ class DiskLayoutConfiguration:
return config
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:
if len(part.btrfs_subvols) > 0:
return True
for mod in self.device_modifications:
for part in mod.partitions:
if not (part.is_create_or_modify() and part.fs_type == FilesystemType.Btrfs):
continue
if any(subvol.is_default_root() for subvol in part.btrfs_subvols):
return True
return False
@ -668,6 +668,9 @@ class SubvolumeModification:
return self.mountpoint == Path('/')
return False
def is_default_root(self) -> bool:
return self.name == Path('@') and self.is_root()
def json(self) -> _SubvolumeModificationSerialization:
return {'name': str(self.name), 'mountpoint': str(self.mountpoint)}