-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from xcp-ng/gtn-pr-46
Update smartctl.py
- Loading branch information
Showing
9 changed files
with
1,838 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 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,30 @@ | ||
import json | ||
from smartctl_outputs.smartctl_sda import INFO_SDA | ||
from smartctl_outputs.smartctl_nvme1 import INFO_NVME1 | ||
from smartctl_outputs.smartctl_megaraid0 import INFO_MEGARAID0 | ||
from smartctl_outputs.smartctl_megaraid1 import INFO_MEGARAID1 | ||
|
||
# Parse the INFO JSON string for each devices | ||
info_sda_dict = json.loads(INFO_SDA) | ||
info_nvme1_dict = json.loads(INFO_NVME1) | ||
info_megaraid0_dict = json.loads(INFO_MEGARAID0) | ||
info_megaraid1_dict = json.loads(INFO_MEGARAID1) | ||
|
||
expected_info_dict = { | ||
"/dev/sda:sat": info_sda_dict, | ||
"/dev/nvme1:nvme": info_nvme1_dict, | ||
"/dev/bus/0:megaraid,0": info_megaraid0_dict, | ||
"/dev/bus/0:megaraid,1": info_megaraid1_dict, | ||
} | ||
|
||
# Convert the result back to a JSON string | ||
EXPECTED_INFO = json.dumps(expected_info_dict, indent=2) | ||
|
||
expected_health_dict = { | ||
"/dev/sda:sat": "PASSED", | ||
"/dev/nvme1:nvme": "PASSED", | ||
"/dev/bus/0:megaraid,0": "PASSED", | ||
"/dev/bus/0:megaraid,1": "PASSED", | ||
} | ||
|
||
EXPECTED_HEALTH = json.dumps(expected_health_dict, indent=2) |
Oops, something went wrong.