Skip to content

Commit

Permalink
fstab: Fix setting mount options for devices
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Feb 6, 2025
1 parent 3fefa2b commit fe7af80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions blivet/fstab.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ def entry_from_device(self, device):
else:
entry.vfstype = device.format.type

entry.mntops = device.format.options

return entry

def entry_from_action(self, action):
Expand Down Expand Up @@ -445,6 +447,8 @@ def entry_from_action(self, action):
else:
entry.vfstype = action.device.format.type

entry.mntops = action.device.format.options

return entry

def read(self):
Expand Down
8 changes: 6 additions & 2 deletions tests/unit_tests/fstab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ def test_entry_from_device(self):
device.format.mountpoint = "/media/fstab_test"

_entry = self.fstab.entry_from_device(device)
self.assertEqual(_entry, FSTabEntry('/dev/test_device', '/media/fstab_test', 'ext4', None, 0, 0))
self.assertEqual(_entry, FSTabEntry('/dev/test_device', '/media/fstab_test', 'ext4', 'defaults', 0, 0))

device.format.options = "noatime,ro"
_entry = self.fstab.entry_from_device(device)
self.assertEqual(_entry, FSTabEntry('/dev/test_device', '/media/fstab_test', 'ext4', ['noatime', 'ro'], 0, 0))

def test_entry_from_device_stratis(self):
pool = StratisPoolDevice("testpool", parents=[], exists=True)
Expand All @@ -104,7 +108,7 @@ def test_entry_from_device_stratis(self):
device.format.mountpoint = "/media/fstab_test"

_entry = self.fstab.entry_from_device(device)
self.assertEqual(_entry, FSTabEntry('/dev/stratis/testpool/testfs', '/media/fstab_test', 'xfs', None, 0, 0))
self.assertEqual(_entry, FSTabEntry('/dev/stratis/testpool/testfs', '/media/fstab_test', 'xfs', device.format.options, 0, 0))

def test_update(self):

Expand Down

0 comments on commit fe7af80

Please sign in to comment.