Make LVM snapshots read-only.
All checks were successful
build / test (push) Successful in 4m33s
build / docs (push) Successful in 55s

This commit is contained in:
Dan Helfman 2024-12-07 09:41:50 -08:00
parent 2ce09dbf82
commit 4b18c0bc81
3 changed files with 7 additions and 0 deletions

View File

@ -89,6 +89,8 @@ def snapshot_logical_volume(
'--snapshot',
('--extents' if '%' in snapshot_size else '--size'),
snapshot_size,
'--permission',
'r', # Read-only.
'--name',
snapshot_name,
logical_volume_device,

View File

@ -9,6 +9,7 @@ def parse_arguments(*unparsed_arguments):
parser.add_argument('--snapshot', action='store_true', required=True)
parser.add_argument('--extents')
parser.add_argument('--size')
parser.add_argument('--permission', required=True)
parser.add_argument('--name', dest='snapshot_name', required=True)
parser.add_argument('logical_volume_device')

View File

@ -99,6 +99,8 @@ def test_snapshot_logical_volume_with_percentage_snapshot_name_uses_lvcreate_ext
'--snapshot',
'--extents',
'10%ORIGIN',
'--permission',
'r',
'--name',
'snap',
'/dev/snap',
@ -116,6 +118,8 @@ def test_snapshot_logical_volume_with_non_percentage_snapshot_name_uses_lvcreate
'--snapshot',
'--size',
'10TB',
'--permission',
'r',
'--name',
'snap',
'/dev/snap',