-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix mdadm collector for resync=PENDING. #309
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
Conversation
300265c
to
7d515fa
Compare
Add fix for mdadm devices in state `resync=PENDING`. * Update test and fixture.
7d515fa
to
64b8259
Compare
@@ -190,7 +190,7 @@ func parseMdstat(mdStatusFilePath string) ([]mdStatus, error) { | |||
|
|||
// If device is syncing at the moment, get the number of currently synced bytes, | |||
// otherwise that number equals the size of the device. | |||
if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") && !strings.Contains(lines[j], "resync=DELAYED") { | |||
if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") && !strings.Contains(lines[j], "resync=DELAYED") && !strings.Contains(lines[j], "resync=PENDING") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this take more values than DELAYED
or PENDING
? Should we just check if the line starts with resync=
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked over the linux source0 and found that these are the only 2 cases. There is the other style of line that sometimes says resync =
. Maybe we can make the parser smarter based on the source. It also seems like it always uses a \t
in the code to print out that line. I can adjust the Contains
35682c9
to
ec1683e
Compare
if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") && !strings.Contains(lines[j], "resync=DELAYED") { | ||
if strings.Contains(lines[j], "recovery") || | ||
strings.Contains(lines[j], "resync") && | ||
!strings.Contains(lines[j], "\u0009resync=") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\u0009
-> \t
will be more understandable for people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if that was valid syntax, thanks, will fix.
Update `Contains` matching for `resync=`
ec1683e
to
afac1f7
Compare
👍 thanks |
Add more needed variants of cpuinfo for mips64 and mips64le. Signed-off-by: Ben Kochie <[email protected]>
Add fix for mdadm devices in state
resync=PENDING
.