-
Notifications
You must be signed in to change notification settings - Fork 721
Adds logic to get default disk and check disk type #3399
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ba220f0
Added function to check if disk is SATA
04445f0
Fixed eval bug unconvered by UT
1fa0cdd
Changed logger to syslogger; fixed UT failures
7a4bf4d
Added checks for partitions and filtered_disks; fixed static analysis…
584d11e
Fix static analysis errors E303, E711
5ce53b3
Changed information delivery semantics per review comment
53aac46
Reverted syslogger to logger to maintain backward compatibility
a9f2490
Changed Disk 'type' --> 'Type' for uniformity
75ec32c
Made the fields look uniform
e1bf142
Disk Type Support for eMMC devices
cbbd283
Removed old sonic_ssd import
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
mock_json_op = \ | ||
[ | ||
{ | ||
"name": "sdx", | ||
"kname": "sdx", | ||
"fstype": "", | ||
"label": "", | ||
"mountpoint": "", | ||
"size": "3965714432", | ||
"maj:min": "8:0", | ||
"rm": "0", | ||
"model": "SMART EUSB", | ||
"vendor": "SMART EUSB", | ||
"serial": "SPG200807J1", | ||
"hctl": "2:0:0:0", | ||
"tran": "usb", | ||
"rota": "1", | ||
"type": "disk", | ||
"ro": "0", | ||
"owner": "", | ||
"group": "", | ||
"mode": "brw-rw----", | ||
"children": [ | ||
{ | ||
"name": "sdx1", | ||
"kname": "sdx1", | ||
"fstype": "ext4", | ||
"label": "", | ||
"mountpoint": "/host", | ||
"size": "3964665856", | ||
"maj:min": "8:1", | ||
"rm": "0", | ||
"model": " ", | ||
"vendor": " ", | ||
"serial": "", | ||
"hctl": "", | ||
"tran": "", | ||
"rota": "1", | ||
"type": "part", | ||
"ro": "0", | ||
"owner": "", | ||
"group": "", | ||
"mode": "brw-rw----", | ||
"children": [], | ||
"parents": ["sdx"], | ||
"statistics": { | ||
"major": "8", | ||
"minor": "1", | ||
"kname": "sdx1", | ||
"reads_completed": "22104", | ||
"reads_merged": "5299", | ||
"sectors_read": "1091502", | ||
"time_spent_reading_ms": "51711", | ||
"writes_completed": "11283", | ||
"writes_merged": "13401", | ||
"sectors_written": "443784", | ||
"time_spent_ writing": "133398", | ||
"ios_in_progress": "0", | ||
"time_spent_doing_ios_ms": "112040", | ||
"weighted_time_ios_ms": "112040", | ||
}, | ||
} | ||
], | ||
"parents": [], | ||
"statistics": { | ||
"major": "8", | ||
"minor": "0", | ||
"kname": "sdx", | ||
"reads_completed": "22151", | ||
"reads_merged": "5299", | ||
"sectors_read": "1093606", | ||
"time_spent_reading_ms": "52005", | ||
"writes_completed": "11283", | ||
"writes_merged": "13401", | ||
"sectors_written": "443784", | ||
"time_spent_ writing": "133398", | ||
"ios_in_progress": "0", | ||
"time_spent_doing_ios_ms": "112220", | ||
"weighted_time_ios_ms": "112220", | ||
}, | ||
} | ||
] | ||
|
||
|
||
class BlkDiskInfo: | ||
def __init__(self): | ||
return | ||
|
||
def get_disks(self, filters): | ||
return mock_json_op | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from collections import namedtuple | ||
|
||
def disk_partitions(): | ||
sdiskpart = namedtuple('sdiskpart', ['mountpoint', 'device']) | ||
return [sdiskpart(mountpoint="/host", device="/dev/sdx1")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.