Skip to content

Commit 5a801c6

Browse files
authored
Parse recovery line to be synced blocks (prometheus#637)
Capture the blocks to be synced from the recvery line as it can differ from the total blocks. * Reformat test struct to make it easier to read. Fixes: prometheus#636 Signed-off-by: SuperQ <superq@gmail.com>
1 parent 1adce6b commit 5a801c6

2 files changed

Lines changed: 281 additions & 33 deletions

File tree

mdstat.go

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
var (
2525
statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[([U_]+)\]`)
26-
recoveryLineBlocksRE = regexp.MustCompile(`\((\d+)/\d+\)`)
26+
recoveryLineBlocksRE = regexp.MustCompile(`\((\d+/\d+)\)`)
2727
recoveryLinePctRE = regexp.MustCompile(`= (.+)%`)
2828
recoveryLineFinishRE = regexp.MustCompile(`finish=(.+)min`)
2929
recoveryLineSpeedRE = regexp.MustCompile(`speed=(.+)[A-Z]`)
@@ -50,6 +50,8 @@ type MDStat struct {
5050
BlocksTotal int64
5151
// Number of blocks on the device that are in sync.
5252
BlocksSynced int64
53+
// Number of blocks on the device that need to be synced.
54+
BlocksToBeSynced int64
5355
// progress percentage of current sync
5456
BlocksSyncedPct float64
5557
// estimated finishing time for current sync (in minutes)
@@ -115,7 +117,8 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) {
115117

116118
// If device is syncing at the moment, get the number of currently
117119
// synced bytes, otherwise that number equals the size of the device.
118-
syncedBlocks := size
120+
blocksSynced := size
121+
blocksToBeSynced := size
119122
speed := float64(0)
120123
finish := float64(0)
121124
pct := float64(0)
@@ -136,9 +139,9 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) {
136139
// Handle case when resync=PENDING or resync=DELAYED.
137140
if strings.Contains(lines[syncLineIdx], "PENDING") ||
138141
strings.Contains(lines[syncLineIdx], "DELAYED") {
139-
syncedBlocks = 0
142+
blocksSynced = 0
140143
} else {
141-
syncedBlocks, pct, finish, speed, err = evalRecoveryLine(lines[syncLineIdx])
144+
blocksSynced, blocksToBeSynced, pct, finish, speed, err = evalRecoveryLine(lines[syncLineIdx])
142145
if err != nil {
143146
return nil, fmt.Errorf("%w: Cannot parse sync line in md device: %q: %w", ErrFileParse, mdName, err)
144147
}
@@ -154,7 +157,8 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) {
154157
DisksSpare: spare,
155158
DisksTotal: total,
156159
BlocksTotal: size,
157-
BlocksSynced: syncedBlocks,
160+
BlocksSynced: blocksSynced,
161+
BlocksToBeSynced: blocksToBeSynced,
158162
BlocksSyncedPct: pct,
159163
BlocksSyncedFinishTime: finish,
160164
BlocksSyncedSpeed: speed,
@@ -206,48 +210,54 @@ func evalStatusLine(deviceLine, statusLine string) (active, total, down, size in
206210
return active, total, down, size, nil
207211
}
208212

209-
func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, pct float64, finish float64, speed float64, err error) {
213+
func evalRecoveryLine(recoveryLine string) (blocksSynced int64, blocksToBeSynced int64, pct float64, finish float64, speed float64, err error) {
210214
matches := recoveryLineBlocksRE.FindStringSubmatch(recoveryLine)
211215
if len(matches) != 2 {
212-
return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine %s: %w", ErrFileParse, recoveryLine, err)
216+
return 0, 0, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine blocks %s: %w", ErrFileParse, recoveryLine, err)
213217
}
214218

215-
syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64)
219+
blocks := strings.Split(matches[1], "/")
220+
blocksSynced, err = strconv.ParseInt(blocks[0], 10, 64)
216221
if err != nil {
217-
return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected parsing of recoveryLine %q: %w", ErrFileParse, recoveryLine, err)
222+
return 0, 0, 0, 0, 0, fmt.Errorf("%w: Unable to parse recovery blocks synced %q: %w", ErrFileParse, matches[1], err)
223+
}
224+
225+
blocksToBeSynced, err = strconv.ParseInt(blocks[1], 10, 64)
226+
if err != nil {
227+
return blocksSynced, 0, 0, 0, 0, fmt.Errorf("%w: Unable to parse recovery to be synced blocks %q: %w", ErrFileParse, matches[2], err)
218228
}
219229

220230
// Get percentage complete
221231
matches = recoveryLinePctRE.FindStringSubmatch(recoveryLine)
222232
if len(matches) != 2 {
223-
return syncedBlocks, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching percentage %s", ErrFileParse, recoveryLine)
233+
return blocksSynced, blocksToBeSynced, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching percentage %s", ErrFileParse, recoveryLine)
224234
}
225235
pct, err = strconv.ParseFloat(strings.TrimSpace(matches[1]), 64)
226236
if err != nil {
227-
return syncedBlocks, 0, 0, 0, fmt.Errorf("%w: Error parsing float from recoveryLine %q", ErrFileParse, recoveryLine)
237+
return blocksSynced, blocksToBeSynced, 0, 0, 0, fmt.Errorf("%w: Error parsing float from recoveryLine %q", ErrFileParse, recoveryLine)
228238
}
229239

230240
// Get time expected left to complete
231241
matches = recoveryLineFinishRE.FindStringSubmatch(recoveryLine)
232242
if len(matches) != 2 {
233-
return syncedBlocks, pct, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching est. finish time: %s", ErrFileParse, recoveryLine)
243+
return blocksSynced, blocksToBeSynced, pct, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching est. finish time: %s", ErrFileParse, recoveryLine)
234244
}
235245
finish, err = strconv.ParseFloat(matches[1], 64)
236246
if err != nil {
237-
return syncedBlocks, pct, 0, 0, fmt.Errorf("%w: Unable to parse float from recoveryLine: %q", ErrFileParse, recoveryLine)
247+
return blocksSynced, blocksToBeSynced, pct, 0, 0, fmt.Errorf("%w: Unable to parse float from recoveryLine: %q", ErrFileParse, recoveryLine)
238248
}
239249

240250
// Get recovery speed
241251
matches = recoveryLineSpeedRE.FindStringSubmatch(recoveryLine)
242252
if len(matches) != 2 {
243-
return syncedBlocks, pct, finish, 0, fmt.Errorf("%w: Unexpected recoveryLine value: %s", ErrFileParse, recoveryLine)
253+
return blocksSynced, blocksToBeSynced, pct, finish, 0, fmt.Errorf("%w: Unexpected recoveryLine value: %s", ErrFileParse, recoveryLine)
244254
}
245255
speed, err = strconv.ParseFloat(matches[1], 64)
246256
if err != nil {
247-
return syncedBlocks, pct, finish, 0, fmt.Errorf("%w: Error parsing float from recoveryLine: %q: %w", ErrFileParse, recoveryLine, err)
257+
return blocksSynced, blocksToBeSynced, pct, finish, 0, fmt.Errorf("%w: Error parsing float from recoveryLine: %q: %w", ErrFileParse, recoveryLine, err)
248258
}
249259

250-
return syncedBlocks, pct, finish, speed, nil
260+
return blocksSynced, blocksToBeSynced, pct, finish, speed, nil
251261
}
252262

253263
func evalComponentDevices(deviceFields []string) []string {

mdstat_test.go

Lines changed: 255 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,261 @@ func TestFS_MDStat(t *testing.T) {
2525
}
2626

2727
refs := map[string]MDStat{
28-
"md127": {Name: "md127", ActivityState: "active", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 312319552, BlocksSynced: 312319552, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdi2", "sdj2"}},
29-
"md0": {Name: "md0", ActivityState: "active", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 248896, BlocksSynced: 248896, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdi1", "sdj1"}},
30-
"md4": {Name: "md4", ActivityState: "inactive", DisksActive: 0, DisksTotal: 0, DisksFailed: 1, DisksDown: 0, DisksSpare: 1, BlocksTotal: 4883648, BlocksSynced: 4883648, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sda3", "sdb3"}},
31-
"md6": {Name: "md6", ActivityState: "recovering", DisksActive: 1, DisksTotal: 2, DisksFailed: 1, DisksDown: 1, DisksSpare: 1, BlocksTotal: 195310144, BlocksSynced: 16775552, BlocksSyncedPct: 8.5, BlocksSyncedFinishTime: 17, BlocksSyncedSpeed: 259783, Devices: []string{"sdb2", "sdc", "sda2"}},
32-
"md3": {Name: "md3", ActivityState: "active", DisksActive: 8, DisksTotal: 8, DisksFailed: 0, DisksDown: 0, DisksSpare: 2, BlocksTotal: 5853468288, BlocksSynced: 5853468288, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sda1", "sdh1", "sdg1", "sdf1", "sde1", "sdd1", "sdc1", "sdb1", "sdd1", "sdd2"}},
33-
"md8": {Name: "md8", ActivityState: "resyncing", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 2, BlocksTotal: 195310144, BlocksSynced: 16775552, BlocksSyncedPct: 8.5, BlocksSyncedFinishTime: 17, BlocksSyncedSpeed: 259783, Devices: []string{"sdb1", "sda1", "sdc", "sde"}},
34-
"md7": {Name: "md7", ActivityState: "active", DisksActive: 3, DisksTotal: 4, DisksFailed: 1, DisksDown: 1, DisksSpare: 0, BlocksTotal: 7813735424, BlocksSynced: 7813735424, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdb1", "sde1", "sdd1", "sdc1"}},
35-
"md9": {Name: "md9", ActivityState: "resyncing", DisksActive: 4, DisksTotal: 4, DisksSpare: 1, DisksDown: 0, DisksFailed: 2, BlocksTotal: 523968, BlocksSynced: 0, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdc2", "sdd2", "sdb2", "sda2", "sde", "sdf", "sdg"}},
36-
"md10": {Name: "md10", ActivityState: "active", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 314159265, BlocksSynced: 314159265, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sda1", "sdb1"}},
37-
"md11": {Name: "md11", ActivityState: "resyncing", DisksActive: 2, DisksTotal: 2, DisksFailed: 1, DisksDown: 0, DisksSpare: 2, BlocksTotal: 4190208, BlocksSynced: 0, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdb2", "sdc2", "sdc3", "hda", "ssdc2"}},
38-
"md12": {Name: "md12", ActivityState: "active", DisksActive: 2, DisksTotal: 2, DisksSpare: 0, DisksDown: 0, DisksFailed: 0, BlocksTotal: 3886394368, BlocksSynced: 3886394368, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdc2", "sdd2"}},
39-
"md120": {Name: "md120", ActivityState: "active", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 2095104, BlocksSynced: 2095104, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sda1", "sdb1"}},
40-
"md126": {Name: "md126", ActivityState: "active", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 1855870976, BlocksSynced: 1855870976, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdb", "sdc"}},
41-
"md219": {Name: "md219", ActivityState: "inactive", DisksTotal: 0, DisksFailed: 0, DisksActive: 0, DisksDown: 0, DisksSpare: 3, BlocksTotal: 7932, BlocksSynced: 7932, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdc", "sda"}},
42-
"md00": {Name: "md00", ActivityState: "active", DisksActive: 1, DisksTotal: 1, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 4186624, BlocksSynced: 4186624, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"xvdb"}},
43-
"md101": {Name: "md101", ActivityState: "active", DisksActive: 3, DisksTotal: 3, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 322560, BlocksSynced: 322560, BlocksSyncedPct: 0, BlocksSyncedFinishTime: 0, BlocksSyncedSpeed: 0, Devices: []string{"sdb", "sdd", "sdc"}},
44-
"md201": {Name: "md201", ActivityState: "checking", DisksActive: 2, DisksTotal: 2, DisksFailed: 0, DisksDown: 0, DisksSpare: 0, BlocksTotal: 1993728, BlocksSynced: 114176, BlocksSyncedPct: 5.7, BlocksSyncedFinishTime: 0.2, BlocksSyncedSpeed: 114176, Devices: []string{"sda3", "sdb3"}},
28+
"md127": {
29+
Name: "md127",
30+
ActivityState: "active",
31+
DisksActive: 2,
32+
DisksTotal: 2,
33+
DisksFailed: 0,
34+
DisksDown: 0,
35+
DisksSpare: 0,
36+
BlocksTotal: 312319552,
37+
BlocksSynced: 312319552,
38+
BlocksToBeSynced: 312319552,
39+
BlocksSyncedPct: 0,
40+
BlocksSyncedFinishTime: 0,
41+
BlocksSyncedSpeed: 0,
42+
Devices: []string{"sdi2", "sdj2"}},
43+
"md0": {
44+
Name: "md0",
45+
ActivityState: "active",
46+
DisksActive: 2,
47+
DisksTotal: 2,
48+
DisksFailed: 0,
49+
DisksDown: 0,
50+
DisksSpare: 0,
51+
BlocksTotal: 248896,
52+
BlocksSynced: 248896,
53+
BlocksToBeSynced: 248896,
54+
BlocksSyncedPct: 0,
55+
BlocksSyncedFinishTime: 0,
56+
BlocksSyncedSpeed: 0,
57+
Devices: []string{"sdi1", "sdj1"}},
58+
"md4": {
59+
Name: "md4",
60+
ActivityState: "inactive",
61+
DisksActive: 0,
62+
DisksTotal: 0,
63+
DisksFailed: 1,
64+
DisksDown: 0,
65+
DisksSpare: 1,
66+
BlocksTotal: 4883648,
67+
BlocksSynced: 4883648,
68+
BlocksToBeSynced: 4883648,
69+
BlocksSyncedPct: 0,
70+
BlocksSyncedFinishTime: 0,
71+
BlocksSyncedSpeed: 0,
72+
Devices: []string{"sda3", "sdb3"}},
73+
"md6": {
74+
Name: "md6",
75+
ActivityState: "recovering",
76+
DisksActive: 1,
77+
DisksTotal: 2,
78+
DisksFailed: 1,
79+
DisksDown: 1,
80+
DisksSpare: 1,
81+
BlocksTotal: 195310144,
82+
BlocksSynced: 16775552,
83+
BlocksToBeSynced: 195310144,
84+
BlocksSyncedPct: 8.5,
85+
BlocksSyncedFinishTime: 17,
86+
BlocksSyncedSpeed: 259783,
87+
Devices: []string{"sdb2", "sdc", "sda2"}},
88+
"md3": {
89+
Name: "md3",
90+
ActivityState: "active",
91+
DisksActive: 8,
92+
DisksTotal: 8,
93+
DisksFailed: 0,
94+
DisksDown: 0,
95+
DisksSpare: 2,
96+
BlocksTotal: 5853468288,
97+
BlocksSynced: 5853468288,
98+
BlocksToBeSynced: 5853468288,
99+
BlocksSyncedPct: 0,
100+
BlocksSyncedFinishTime: 0,
101+
BlocksSyncedSpeed: 0,
102+
Devices: []string{"sda1", "sdh1", "sdg1", "sdf1", "sde1", "sdd1", "sdc1", "sdb1", "sdd1", "sdd2"}},
103+
"md8": {
104+
Name: "md8",
105+
ActivityState: "resyncing",
106+
DisksActive: 2,
107+
DisksTotal: 2,
108+
DisksFailed: 0,
109+
DisksDown: 0,
110+
DisksSpare: 2,
111+
BlocksTotal: 195310144,
112+
BlocksSynced: 16775552,
113+
BlocksToBeSynced: 195310144,
114+
BlocksSyncedPct: 8.5,
115+
BlocksSyncedFinishTime: 17,
116+
BlocksSyncedSpeed: 259783,
117+
Devices: []string{"sdb1", "sda1", "sdc", "sde"}},
118+
"md7": {
119+
Name: "md7",
120+
ActivityState: "active",
121+
DisksActive: 3,
122+
DisksTotal: 4,
123+
DisksFailed: 1,
124+
DisksDown: 1,
125+
DisksSpare: 0,
126+
BlocksTotal: 7813735424,
127+
BlocksSynced: 7813735424,
128+
BlocksToBeSynced: 7813735424,
129+
BlocksSyncedPct: 0,
130+
BlocksSyncedFinishTime: 0,
131+
BlocksSyncedSpeed: 0,
132+
Devices: []string{"sdb1", "sde1", "sdd1", "sdc1"}},
133+
"md9": {
134+
Name: "md9",
135+
ActivityState: "resyncing",
136+
DisksActive: 4,
137+
DisksTotal: 4,
138+
DisksSpare: 1,
139+
DisksDown: 0,
140+
DisksFailed: 2,
141+
BlocksTotal: 523968,
142+
BlocksSynced: 0,
143+
BlocksToBeSynced: 523968,
144+
BlocksSyncedPct: 0,
145+
BlocksSyncedFinishTime: 0,
146+
BlocksSyncedSpeed: 0,
147+
Devices: []string{"sdc2", "sdd2", "sdb2", "sda2", "sde", "sdf", "sdg"}},
148+
"md10": {
149+
Name: "md10",
150+
ActivityState: "active",
151+
DisksActive: 2,
152+
DisksTotal: 2,
153+
DisksFailed: 0,
154+
DisksDown: 0,
155+
DisksSpare: 0,
156+
BlocksTotal: 314159265,
157+
BlocksSynced: 314159265,
158+
BlocksToBeSynced: 314159265,
159+
BlocksSyncedPct: 0,
160+
BlocksSyncedFinishTime: 0,
161+
BlocksSyncedSpeed: 0,
162+
Devices: []string{"sda1", "sdb1"}},
163+
"md11": {
164+
Name: "md11",
165+
ActivityState: "resyncing",
166+
DisksActive: 2,
167+
DisksTotal: 2,
168+
DisksFailed: 1,
169+
DisksDown: 0,
170+
DisksSpare: 2,
171+
BlocksTotal: 4190208,
172+
BlocksSynced: 0,
173+
BlocksToBeSynced: 4190208,
174+
BlocksSyncedPct: 0,
175+
BlocksSyncedFinishTime: 0,
176+
BlocksSyncedSpeed: 0,
177+
Devices: []string{"sdb2", "sdc2", "sdc3", "hda", "ssdc2"}},
178+
"md12": {
179+
Name: "md12",
180+
ActivityState: "active",
181+
DisksActive: 2,
182+
DisksTotal: 2,
183+
DisksSpare: 0,
184+
DisksDown: 0,
185+
DisksFailed: 0,
186+
BlocksTotal: 3886394368,
187+
BlocksSynced: 3886394368,
188+
BlocksToBeSynced: 3886394368,
189+
BlocksSyncedPct: 0,
190+
BlocksSyncedFinishTime: 0,
191+
BlocksSyncedSpeed: 0,
192+
Devices: []string{"sdc2", "sdd2"}},
193+
"md120": {
194+
Name: "md120",
195+
ActivityState: "active",
196+
DisksActive: 2,
197+
DisksTotal: 2,
198+
DisksFailed: 0,
199+
DisksDown: 0,
200+
DisksSpare: 0,
201+
BlocksTotal: 2095104,
202+
BlocksSynced: 2095104,
203+
BlocksToBeSynced: 2095104,
204+
BlocksSyncedPct: 0,
205+
BlocksSyncedFinishTime: 0,
206+
BlocksSyncedSpeed: 0,
207+
Devices: []string{"sda1", "sdb1"}},
208+
"md126": {
209+
Name: "md126",
210+
ActivityState: "active",
211+
DisksActive: 2,
212+
DisksTotal: 2,
213+
DisksFailed: 0,
214+
DisksDown: 0,
215+
DisksSpare: 0,
216+
BlocksTotal: 1855870976,
217+
BlocksSynced: 1855870976,
218+
BlocksToBeSynced: 1855870976,
219+
BlocksSyncedPct: 0,
220+
BlocksSyncedFinishTime: 0,
221+
BlocksSyncedSpeed: 0,
222+
Devices: []string{"sdb", "sdc"}},
223+
"md219": {
224+
Name: "md219",
225+
ActivityState: "inactive",
226+
DisksTotal: 0,
227+
DisksFailed: 0,
228+
DisksActive: 0,
229+
DisksDown: 0,
230+
DisksSpare: 3,
231+
BlocksTotal: 7932,
232+
BlocksSynced: 7932,
233+
BlocksToBeSynced: 7932,
234+
BlocksSyncedPct: 0,
235+
BlocksSyncedFinishTime: 0,
236+
BlocksSyncedSpeed: 0,
237+
Devices: []string{"sdc", "sda"}},
238+
"md00": {
239+
Name: "md00",
240+
ActivityState: "active",
241+
DisksActive: 1,
242+
DisksTotal: 1,
243+
DisksFailed: 0,
244+
DisksDown: 0,
245+
DisksSpare: 0,
246+
BlocksTotal: 4186624,
247+
BlocksSynced: 4186624,
248+
BlocksToBeSynced: 4186624,
249+
BlocksSyncedPct: 0,
250+
BlocksSyncedFinishTime: 0,
251+
BlocksSyncedSpeed: 0,
252+
Devices: []string{"xvdb"}},
253+
"md101": {
254+
Name: "md101",
255+
ActivityState: "active",
256+
DisksActive: 3,
257+
DisksTotal: 3,
258+
DisksFailed: 0,
259+
DisksDown: 0,
260+
DisksSpare: 0,
261+
BlocksTotal: 322560,
262+
BlocksSynced: 322560,
263+
BlocksToBeSynced: 322560,
264+
BlocksSyncedPct: 0,
265+
BlocksSyncedFinishTime: 0,
266+
BlocksSyncedSpeed: 0,
267+
Devices: []string{"sdb", "sdd", "sdc"}},
268+
"md201": {
269+
Name: "md201",
270+
ActivityState: "checking",
271+
DisksActive: 2,
272+
DisksTotal: 2,
273+
DisksFailed: 0,
274+
DisksDown: 0,
275+
DisksSpare: 0,
276+
BlocksTotal: 1993728,
277+
BlocksSynced: 114176,
278+
BlocksToBeSynced: 1993728,
279+
BlocksSyncedPct: 5.7,
280+
BlocksSyncedFinishTime: 0.2,
281+
BlocksSyncedSpeed: 114176,
282+
Devices: []string{"sda3", "sdb3"}},
45283
}
46284

47285
if want, have := len(refs), len(mdStats); want != have {

0 commit comments

Comments
 (0)