Ignore spurious error when setting APM#3076
Open
tjkirch wants to merge 1 commit intorockstor:testingfrom
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3075
See friendly forum thread: https://forum.rockstor.com/t/apm-not-persisted-due-to-spurious-drive-error/10857
In short, when running hdparm commands on certain drives (at least a couple of Seagate and Western Digital USB drives) it will return 0 but give a spurious error when setting some options, including the APM setting
-Bneeded for spindown to work. The operation does work regardless of the message in stderr.Before this change, I had to use a systemd service override to force in the
-B 127setting. Trying to set it in Rockstor's spindown interface did nothing because of the conditional being modified in this PR, and the error would show up in Rockstor logs.This change checks for the specific spurious error message and continues if that's all it sees and the command returned 0. (The new function could be used in other places if the same spurious error is preventing other actions, but I haven't run into any others.)
Testing:
I tested the new function on its own against a bunch of good and bad arguments to be sure it only excused the specific error under discussion. Then I tested on my Rockstor server and confirmed that the systemd service has the requested
-Boption without an override.