mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-13 03:12:13 +00:00
scylla_raid_setup: check uuid and device path are valid
Added code to check make sure uuid and uuid based device path are valid.
This commit is contained in:
15
dist/common/scripts/scylla_raid_setup
vendored
15
dist/common/scripts/scylla_raid_setup
vendored
@@ -152,7 +152,18 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
os.makedirs(mount_at, exist_ok=True)
|
os.makedirs(mount_at, exist_ok=True)
|
||||||
|
|
||||||
uuid = out(f'blkid -s UUID -o value {fsdev}')
|
uuid = get_partition_uuid(fsdev)
|
||||||
|
uuidpath = f'/dev/disk/by-uuid/{uuid}'
|
||||||
|
|
||||||
|
if not uuid:
|
||||||
|
raise Exception(f'Failed to get UUID of {fsdev}')
|
||||||
|
if not os.path.exists(uuidpath):
|
||||||
|
raise Exception(f'{uuidpath} is not found')
|
||||||
|
if not stat.S_ISBLK(os.stat(uuidpath).st_mode):
|
||||||
|
raise Exception(f'{uuidpath} is not block device')
|
||||||
|
if not is_unused_disk(uuidpath):
|
||||||
|
raise Exception(f'{uuidpath} is busy')
|
||||||
|
|
||||||
after = 'local-fs.target'
|
after = 'local-fs.target'
|
||||||
wants = ''
|
wants = ''
|
||||||
if raid and args.raid_level != '0':
|
if raid and args.raid_level != '0':
|
||||||
@@ -169,7 +180,7 @@ After={after}{wants}
|
|||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
|
|
||||||
[Mount]
|
[Mount]
|
||||||
What=/dev/disk/by-uuid/{uuid}
|
What={uuidpath}
|
||||||
Where={mount_at}
|
Where={mount_at}
|
||||||
Type=xfs
|
Type=xfs
|
||||||
Options=noatime{opt_discard}
|
Options=noatime{opt_discard}
|
||||||
|
|||||||
Reference in New Issue
Block a user