-
Notifications
You must be signed in to change notification settings - Fork 24
Add support for UUID disk and serial number #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
6087728 to
6c0dc7b
Compare
|
I have just rebased my branch to |
| disk_device = find_disk( argv[1] ) # by /dev/disk/ | ||
|
|
||
| if disk_device: # a hard disk device has been found | ||
| argv[1] = disk_device # overwrite argv[1] with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing argv value is not a good practice. Can we just switch the code below (where argv[1]) is used to use of disk_device?
Basically:
disk_device = find_serial( argv[1] ) # by serial number
if not disk_device:
disk_device = find_disk( argv[1] ) # by /dev/disk/
else:
disk_device = argv[1]
(and replace all uses of argv[1] with disk device).
| for subdir_path in disk_directories: | ||
| files = os.listdir( subdir_path ) | ||
| for f in files: | ||
| if re.search(a_disk_name, f, re.IGNORECASE): # the file match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to support regexps? How do you plan to use it? sdled s.+z?
May be we can just check for case-insensitive match?
wallentx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error when executing without this
| # print( "Found %s" % absolute_path ) | ||
|
|
||
| # remove trailing digits to get disk device instead of partition device | ||
| absolute_device_path = re.sub("\d+", "", absolute_device_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| absolute_device_path = re.sub("\d+", "", absolute_device_path) | |
| absolute_device_path = re.sub(r"\d+", "", absolute_device_path) |
Add support for TrueNAS Scale
It means that we can also specify the enclosure slot with
Implementation details:
lsblk --nodeps -o name,serial/dev/disk/by-partuuidto get the partition device/dev/sde2->/dev/sde)