Added parsing of "checking" state to mdstat
Signed-off-by: Christian Rohmann <github@frittentheke.de>
Christian Rohmann authored 3 years ago
Johannes 'fish' Ziemke committed 3 years ago
1965 | 1965 |
Mode: 444
|
1966 | 1966 |
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
1967 | 1967 |
Path: fixtures/proc/mdstat
|
1968 | |
Lines: 56
|
|
1968 |
Lines: 60
|
1969 | 1969 |
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
|
1970 | 1970 |
|
1971 | 1971 |
md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] sdd1[10](S) sdd2[11](S)
|
|
1987 | 1987 |
md8 : active raid1 sdb1[1] sda1[0] sdc[2](S) sde[3](S)
|
1988 | 1988 |
195310144 blocks [2/2] [UU]
|
1989 | 1989 |
[=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
|
|
1990 |
|
|
1991 |
md201 : active raid1 sda3[0] sdb3[1]
|
|
1992 |
1993728 blocks super 1.2 [2/2] [UU]
|
|
1993 |
[=>...................] check = 5.7% (114176/1993728) finish=0.2min speed=114176K/sec
|
1990 | 1994 |
|
1991 | 1995 |
md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1](F)
|
1992 | 1996 |
7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU]
|
106 | 106 |
syncedBlocks := size
|
107 | 107 |
recovering := strings.Contains(lines[syncLineIdx], "recovery")
|
108 | 108 |
resyncing := strings.Contains(lines[syncLineIdx], "resync")
|
|
109 |
checking := strings.Contains(lines[syncLineIdx], "check")
|
109 | 110 |
|
110 | 111 |
// Append recovery and resyncing state info.
|
111 | |
if recovering || resyncing {
|
|
112 |
if recovering || resyncing || checking {
|
112 | 113 |
if recovering {
|
113 | 114 |
state = "recovering"
|
|
115 |
} else if checking {
|
|
116 |
state = "checking"
|
114 | 117 |
} else {
|
115 | 118 |
state = "resyncing"
|
116 | 119 |
}
|
39 | 39 |
"md219": {Name: "md219", ActivityState: "inactive", DisksTotal: 0, DisksFailed: 0, DisksActive: 0, DisksSpare: 3, BlocksTotal: 7932, BlocksSynced: 7932},
|
40 | 40 |
"md00": {Name: "md00", ActivityState: "active", DisksActive: 1, DisksTotal: 1, DisksFailed: 0, DisksSpare: 0, BlocksTotal: 4186624, BlocksSynced: 4186624},
|
41 | 41 |
"md101": {Name: "md101", ActivityState: "active", DisksActive: 3, DisksTotal: 3, DisksFailed: 0, DisksSpare: 0, BlocksTotal: 322560, BlocksSynced: 322560},
|
|
42 |
"md201": {Name: "md201", ActivityState: "checking", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksSpare: 0, BlocksTotal: 1993728, BlocksSynced: 114176},
|
42 | 43 |
}
|
43 | 44 |
|
44 | 45 |
if want, have := len(refs), len(mdStats); want != have {
|