Skip to content
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

feature: add Device.test_polling_time #78

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pySMART/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,19 @@ def __init__(self, name: str, interface: Optional[str] = None, abridged: bool =
# Note: The above are just default values and can/will be changed
# upon update() when the attributes and type of the disk is actually
# determined.
self.test_polling_time = {
'short': 10,
'long': 1000,
'conveyance': 20,
}
"""
**(dict): ** This dictionary contains key == 'Test Name' and
value == int of approximate times to run each test type that this
device is capable of.
"""
# Note: The above are just default values and can/will be changed
# upon update() when the attributes and type of the disk is actually
# determined.
self.tests: List[TestEntry] = []
"""
**(list of `TestEntry`):** Contains the complete SMART self-test log
Expand Down Expand Up @@ -962,6 +975,7 @@ class members, including the SMART attribute table and self-test log.
parse_self_tests = False
parse_running_test = False
parse_ascq = False
polling_minute_type = None
message = ''
self.tests = []
self._test_running = False
Expand Down Expand Up @@ -1206,6 +1220,21 @@ class members, including the SMART attribute table and self-test log.
self.test_capabilities['short'] = True
self.test_capabilities['long'] = True

if 'Short self-test routine' in line:
polling_minute_type = 'short'
continue
if 'Extended self-test routine' in line:
polling_minute_type = 'long'
continue
if 'Conveyance self-test routine' in line:
polling_minute_type = 'conveyance'
continue
if 'recommended polling time:' in line:
self.test_polling_time[polling_minute_type] = float(
re.sub("[^0-9]", "", line)
)
continue

# For some reason smartctl does not show a currently running test
# for 'ATA' in the Test log so I just have to catch it this way i guess!
# For 'scsi' I still do it since it is the only place I get % remaining in scsi
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/megaraid_ph_sas_hdd_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [
{
"asc": "-",
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/megaraid_ph_sata_hdd_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 574.0,
"short": 1.0
},
"tests": [
{
"asc": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 2.0,
"long": 2.0,
"short": 1.0
},
"tests": [],
"vendor": "Intel"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/megaraid_ph_sata_ssd_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 2.0,
"long": 2.0,
"short": 1.0
},
"tests": [
{
"asc": null,
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/megaraid_vd_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "Intel"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "KBG"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_10_issue_73/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "Netac"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_11_issue_75/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [
{
"asc": null,
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_1_issue_37/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "Samsung"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_2_issue_46/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "WDC"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_3_issue_52/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "WDC"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_4_issue_53/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "KCM"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_5_issue_46/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "WD"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_6/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [
{
"asc": null,
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_7_issue_63/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "WDS"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_8/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "WDS"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_9_issue_72/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "KINGSTON"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/nvme_win10_0_issue_64/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [
{
"asc": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "WDS"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sas_hdd_0_issue_51/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "HGST"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sas_ssd_0_issue_57/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [
{
"asc": "-",
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sat_hdd_0_issue70/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 2.0,
"long": 196.0,
"short": 1.0
},
"tests": [
{
"asc": null,
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sat_ssd_0_issue_65/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 2.0,
"long": 85.0,
"short": 2.0
},
"tests": [],
"vendor": "HS"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sata_hdd_0_issue42/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 2.0,
"long": 1082.0,
"short": 1.0
},
"tests": [
{
"asc": null,
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sata_hdd_1_issue46/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1822.0,
"short": 2.0
},
"tests": [],
"vendor": "Western"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sata_ssd_0_issue_49/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 10.0,
"short": 1.0
},
"tests": [
{
"asc": null,
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sata_ssd_1_issue_72/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 2.0,
"long": 90.0,
"short": 2.0
},
"tests": [],
"vendor": "Apacer"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/sata_ssd_macos_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,11 @@
"selective": true,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 10.0,
"short": 2.0
},
"tests": [],
"vendor": "Apple"
}
Expand Down
5 changes: 5 additions & 0 deletions tests/dataset/singletests/unsupported_0/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@
"selective": false,
"short": true
},
"test_polling_time": {
"conveyance": 20,
"long": 1000,
"short": 10
},
"tests": [],
"vendor": "AVAGO"
}
Expand Down
Loading