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)
|
||||
|
||||
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'
|
||||
wants = ''
|
||||
if raid and args.raid_level != '0':
|
||||
@@ -169,7 +180,7 @@ After={after}{wants}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Mount]
|
||||
What=/dev/disk/by-uuid/{uuid}
|
||||
What={uuidpath}
|
||||
Where={mount_at}
|
||||
Type=xfs
|
||||
Options=noatime{opt_discard}
|
||||
|
||||
Reference in New Issue
Block a user