Codebase list golang-procfs / 50370d1
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
3 changed file(s) with 10 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
19651965 Mode: 444
19661966 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19671967 Path: fixtures/proc/mdstat
1968 Lines: 56
1968 Lines: 60
19691969 Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
19701970
19711971 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)
19871987 md8 : active raid1 sdb1[1] sda1[0] sdc[2](S) sde[3](S)
19881988 195310144 blocks [2/2] [UU]
19891989 [=>...................] 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
19901994
19911995 md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1](F)
19921996 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU]
106106 syncedBlocks := size
107107 recovering := strings.Contains(lines[syncLineIdx], "recovery")
108108 resyncing := strings.Contains(lines[syncLineIdx], "resync")
109 checking := strings.Contains(lines[syncLineIdx], "check")
109110
110111 // Append recovery and resyncing state info.
111 if recovering || resyncing {
112 if recovering || resyncing || checking {
112113 if recovering {
113114 state = "recovering"
115 } else if checking {
116 state = "checking"
114117 } else {
115118 state = "resyncing"
116119 }
3939 "md219": {Name: "md219", ActivityState: "inactive", DisksTotal: 0, DisksFailed: 0, DisksActive: 0, DisksSpare: 3, BlocksTotal: 7932, BlocksSynced: 7932},
4040 "md00": {Name: "md00", ActivityState: "active", DisksActive: 1, DisksTotal: 1, DisksFailed: 0, DisksSpare: 0, BlocksTotal: 4186624, BlocksSynced: 4186624},
4141 "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},
4243 }
4344
4445 if want, have := len(refs), len(mdStats); want != have {