Skip to content

Commit

Permalink
Do not raise libblockdev errors in FSMinSize tasks (#2314637)
Browse files Browse the repository at this point in the history
Follow up for #1255. We need to raise FSError in case of errors
because libblockdev errors are not caught in FS.update_size_info.
  • Loading branch information
vojtechtrefny committed Sep 25, 2024
1 parent 85785ce commit 4c03ebd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions blivet/tasks/fsminsize.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def do_task(self): # pylint: disable=arguments-differ
if error_msgs:
raise FSError("\n".join(error_msgs))

return Size(BlockDev.fs.ext2_get_min_size(self.fs.device))
try:
min_size = Size(BlockDev.fs.ext2_get_min_size(self.fs.device))
except BlockDev.FSError as e:
raise FSError("failed to get fs min size: %s" % e)
return min_size


class NTFSMinSize(FSMinSize):
Expand All @@ -69,7 +73,11 @@ def do_task(self): # pylint: disable=arguments-differ
if error_msgs:
raise FSError("\n".join(error_msgs))

return Size(BlockDev.fs.ntfs_get_min_size(self.fs.device))
try:
min_size = Size(BlockDev.fs.ntfs_get_min_size(self.fs.device))
except BlockDev.FSError as e:
raise FSError("failed to get fs min size: %s" % e)
return min_size


class UnimplementedFSMinSize(fstask.UnimplementedFSTask):
Expand Down

0 comments on commit 4c03ebd

Please sign in to comment.