#219 - add fixes for @samzhang111 super token

This commit is contained in:
dan mcweeney 2016-11-15 11:36:56 -05:00
commit 1f6b5aee39
4 changed files with 15 additions and 4 deletions

View file

@ -28,9 +28,9 @@ import (
)
var (
statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`)
raid0lineRE = regexp.MustCompile(`(\d+) blocks .*\d+k chunks`)
buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`)
statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`)
raid0lineRE = regexp.MustCompile(`(\d+) blocks( super ([0-9\.])*)? \d+k chunks`)
buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`)
unknownPersonalityLine = regexp.MustCompile(`(\d+) blocks (.*)`)
raidPersonalityRE = regexp.MustCompile(`raid[0-9]+`)
)
@ -82,7 +82,7 @@ func evalStatusline(statusline string) (active, total, size int64, err error) {
func evalRaid0line(statusline string) (size int64, err error) {
matches := raid0lineRE.FindStringSubmatch(statusline)
if len(matches) != 2 {
if len(matches) < 2 {
return 0, fmt.Errorf("invalid raid0 status line: %s", statusline)
}
@ -179,6 +179,7 @@ func parseMdstat(mdStatusFilePath string) ([]mdStatus, error) {
for _, possiblePersonality := range mainLine {
if raidPersonalityRE.MatchString(possiblePersonality) {
personality = possiblePersonality
// break
}
}