Update mdstat fixture based on linux source.

Update `Contains` matching for `resync=`
This commit is contained in:
Ben Kochie 2016-09-19 10:28:06 +02:00
parent 64b82596ef
commit afac1f7433
2 changed files with 5 additions and 3 deletions

View file

@ -25,13 +25,13 @@ md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1]
md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0]
523968 blocks super 1.2 [4/4] [UUUU]
resync=DELAYED
resync=DELAYED
md10 : active raid0 sda1[0] sdb1[1]
314159265 blocks 64k chunks
md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1]
4190208 blocks super 1.2 [2/2] [UU]
resync=PENDING
resync=PENDING
unused devices: <none>

View file

@ -190,7 +190,9 @@ 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") && !strings.Contains(lines[j], "resync=PENDING") {
if strings.Contains(lines[j], "recovery") ||
strings.Contains(lines[j], "resync") &&
!strings.Contains(lines[j], "\tresync=") {
syncedBlocks, err = evalBuildline(lines[j])
if err != nil {
return mdStates, fmt.Errorf("error parsing mdstat: %s", err)