-
Notifications
You must be signed in to change notification settings - Fork 35
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
Do not fail if 'total data bytes written' is zero #71
Conversation
It appears that complete unused NVME drives (at least SAMSUNG MZQL27T6HBLA-00A07) report just '0' if there is nothing ever written to the drive. With several hotspares this breaks. I have no idea what if ever anything else than '0' is returned, but this catches that too. ``` # for I in {0..6}; do smartctl -x /dev/nvme$I -d nvme| grep -F 'Data Units Written'; done Data Units Written: 10,478,811 [5.36 TB] Data Units Written: 2,938,151 [1.50 TB] Data Units Written: 2,943,329 [1.50 TB] Data Units Written: 0 Data Units Written: 0 Data Units Written: 0 Data Units Written: 0 ``` I'f like a little guidance on writing a unittest for this (and the PR69). Should I give the smartctl -x output?
I am an idiot, sorry.
For the tests, you can add a folder like In that folder, you have to add a The device.json:This file must have the following data: {
"name": "/dev/nvme0"
} This will indicate tests that your device is called {
"name": "/dev/nvme0",
"interface": "nvme"
} Nonetheless, this won't be enough to pass any test, just to interpret the folder data. Tests checks that pysmart reads correctly the data and for that there is another dictionary-field in device.json called Once you have filled the required fields adobe ( Output filesOn each test, there should be a file for each virtually smartctl call. The format is simple:
If you don't know which files do you require, you can try to run your test. If you need anything else, the test will raise an exception indicating that a file is required. This will generate a message with the expected |
I've added the previous comment to a readme under tests folder: https://github.com/truenas/py-SMART/tree/develop/tests so it may help for future developers. Please, ask me any question (and feel free to fix that readme if there is something unclear/wrong). Glad to help |
I am terribly sorry... I have no idea how to get Just close this utter failure pull request of me. I'll patch and package it locally. |
So sorry to waste your time. |
Come on boy, helping devs it's not a waste of time ;-) On the root path of py-SMART, you should be able to run of course, a previous |
If after a couple of tries you still couldn't add the tests, just put here your whole outputs and I'll include them. Your PR seems justified. |
Hi @Heidistein I just added some artificial tests. Thanks for your contrib and don't be sad! Is everybody work to make opensource projects better ;-) See you soon with more ideas, issues & PRs! |
Sorry, should have responded. I have had no time yet again. I will look intonit, with real data.
On 26 May 2023 12:06:43 CEST, Rafael Leira ***@***.***> wrote:
Hi @Heidistein
I just added some artificial tests.
Thanks for your contrib and don't be sad! Is everybody work to make opensource projects better ;-)
See you soon with more ideas, issues & PRs!
--
Reply to this email directly or view it on GitHub:
#71 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
--
Verstuurd vanaf mijn Android apparaat met K-9 Mail. Excuseer mijn beknoptheid.
|
It appears that complete unused NVME drives (at least SAMSUNG MZQL27T6HBLA-00A07) report just '0' if there is nothing ever written to the drive. With several hotspares this breaks. I have no idea what if ever anything else than '0' is returned, but this catches that too.
I'f like a little guidance on writing a unittest for this (and the PR69). Should I give the smartctl -x output?