1
2
3
4
5
6
7
8
9
10
11
12
13
14 package procfs
15
16 import (
17 "fmt"
18 "reflect"
19 "strings"
20 "testing"
21 "time"
22 )
23
24 func TestMountStats(t *testing.T) {
25 tests := []struct {
26 name string
27 s string
28 mounts []*Mount
29 invalid bool
30 }{
31 {
32 name: "no devices",
33 s: `hello`,
34 },
35 {
36 name: "device has too few fields",
37 s: `device foo`,
38 invalid: true,
39 },
40 {
41 name: "device incorrect format",
42 s: `device rootfs BAD on / with fstype rootfs`,
43 invalid: true,
44 },
45 {
46 name: "device incorrect format",
47 s: `device rootfs mounted BAD / with fstype rootfs`,
48 invalid: true,
49 },
50 {
51 name: "device incorrect format",
52 s: `device rootfs mounted on / BAD fstype rootfs`,
53 invalid: true,
54 },
55 {
56 name: "device incorrect format",
57 s: `device rootfs mounted on / with BAD rootfs`,
58 invalid: true,
59 },
60 {
61 name: "device rootfs cannot have stats",
62 s: `device rootfs mounted on / with fstype rootfs stats`,
63 invalid: true,
64 },
65 {
66 name: "NFSv4 device with too little info",
67 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nopts:",
68 invalid: true,
69 },
70 {
71 name: "NFSv4 device with bad bytes",
72 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nbytes: 0",
73 invalid: true,
74 },
75 {
76 name: "NFSv4 device with bad events",
77 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nevents: 0",
78 invalid: true,
79 },
80 {
81 name: "NFSv4 device with bad per-op stats",
82 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nper-op statistics\nFOO 0",
83 invalid: true,
84 },
85 {
86 name: "NFSv4 device with bad transport stats",
87 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcp",
88 invalid: true,
89 },
90 {
91 name: "NFSv4 device with bad transport version",
92 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=foo\nxprt: tcp 0",
93 invalid: true,
94 },
95 {
96 name: "NFSv4 device with bad transport stats version 1.0",
97 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.0\nxprt: tcp 0 0 0 0 0 0 0 0 0 0 0 0 0",
98 invalid: true,
99 },
100 {
101 name: "NFSv4 device with bad transport stats version 1.1",
102 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcp 0 0 0 0 0 0 0 0 0 0",
103 invalid: true,
104 },
105 {
106 name: "NFSv3 device with bad transport protocol",
107 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcpx 0 0 0 0 0 0 0 0 0 0",
108 invalid: true,
109 },
110 {
111 name: "NFSv3 device using TCP with transport stats version 1.0 OK",
112 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.0\nxprt: tcp 1 2 3 4 5 6 7 8 9 10",
113 mounts: []*Mount{{
114 Device: "192.168.1.1:/srv",
115 Mount: "/mnt/nfs",
116 Type: "nfs",
117 Stats: &MountStatsNFS{
118 StatVersion: "1.0",
119 Transport: NFSTransportStats{
120 Protocol: "tcp",
121 Port: 1,
122 Bind: 2,
123 Connect: 3,
124 ConnectIdleTime: 4,
125 IdleTimeSeconds: 5,
126 Sends: 6,
127 Receives: 7,
128 BadTransactionIDs: 8,
129 CumulativeActiveRequests: 9,
130 CumulativeBacklog: 10,
131 MaximumRPCSlotsUsed: 0,
132 CumulativeSendingQueue: 0,
133 CumulativePendingQueue: 0,
134 },
135 },
136 }},
137 },
138 {
139 name: "NFSv3 device using UDP with transport stats version 1.0 OK",
140 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.0\nxprt: udp 1 2 3 4 5 6 7",
141 mounts: []*Mount{{
142 Device: "192.168.1.1:/srv",
143 Mount: "/mnt/nfs",
144 Type: "nfs",
145 Stats: &MountStatsNFS{
146 StatVersion: "1.0",
147 Transport: NFSTransportStats{
148 Protocol: "udp",
149 Port: 1,
150 Bind: 2,
151 Connect: 0,
152 ConnectIdleTime: 0,
153 IdleTimeSeconds: 0,
154 Sends: 3,
155 Receives: 4,
156 BadTransactionIDs: 5,
157 CumulativeActiveRequests: 6,
158 CumulativeBacklog: 7,
159 MaximumRPCSlotsUsed: 0,
160 CumulativeSendingQueue: 0,
161 CumulativePendingQueue: 0,
162 },
163 },
164 }},
165 },
166 {
167 name: "NFSv3 device using TCP with transport stats version 1.1 OK",
168 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nxprt: tcp 1 2 3 4 5 6 7 8 9 10 11 12 13",
169 mounts: []*Mount{{
170 Device: "192.168.1.1:/srv",
171 Mount: "/mnt/nfs",
172 Type: "nfs",
173 Stats: &MountStatsNFS{
174 StatVersion: "1.1",
175 Transport: NFSTransportStats{
176 Protocol: "tcp",
177 Port: 1,
178 Bind: 2,
179 Connect: 3,
180 ConnectIdleTime: 4,
181 IdleTimeSeconds: 5,
182 Sends: 6,
183 Receives: 7,
184 BadTransactionIDs: 8,
185 CumulativeActiveRequests: 9,
186 CumulativeBacklog: 10,
187 MaximumRPCSlotsUsed: 11,
188 CumulativeSendingQueue: 12,
189 CumulativePendingQueue: 13,
190 },
191 },
192 }},
193 },
194 {
195 name: "NFSv3 device using UDP with transport stats version 1.1 OK",
196 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nxprt: udp 1 2 3 4 5 6 7 8 9 10",
197 mounts: []*Mount{{
198 Device: "192.168.1.1:/srv",
199 Mount: "/mnt/nfs",
200 Type: "nfs",
201 Stats: &MountStatsNFS{
202 StatVersion: "1.1",
203 Transport: NFSTransportStats{
204 Protocol: "udp",
205 Port: 1,
206 Bind: 2,
207 Connect: 0,
208 ConnectIdleTime: 0,
209 IdleTimeSeconds: 0,
210 Sends: 3,
211 Receives: 4,
212 BadTransactionIDs: 5,
213 CumulativeActiveRequests: 6,
214 CumulativeBacklog: 7,
215 MaximumRPCSlotsUsed: 8,
216 CumulativeSendingQueue: 9,
217 CumulativePendingQueue: 10,
218 },
219 },
220 }},
221 },
222 {
223 name: "NFSv3 device with mountaddr OK",
224 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nopts: rw,vers=3,mountaddr=192.168.1.1,proto=udp\n",
225 mounts: []*Mount{{
226 Device: "192.168.1.1:/srv",
227 Mount: "/mnt/nfs",
228 Type: "nfs",
229 Stats: &MountStatsNFS{
230 StatVersion: "1.1",
231 Opts: map[string]string{"rw": "", "vers": "3", "mountaddr": "192.168.1.1", "proto": "udp"},
232 },
233 }},
234 },
235 {
236 name: "device rootfs OK",
237 s: `device rootfs mounted on / with fstype rootfs`,
238 mounts: []*Mount{{
239 Device: "rootfs",
240 Mount: "/",
241 Type: "rootfs",
242 }},
243 },
244 {
245 name: "NFSv3 device with minimal stats OK",
246 s: `device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1`,
247 mounts: []*Mount{{
248 Device: "192.168.1.1:/srv",
249 Mount: "/mnt/nfs",
250 Type: "nfs",
251 Stats: &MountStatsNFS{
252 StatVersion: "1.1",
253 },
254 }},
255 },
256 {
257 name: "NFS4.1 device with multiline impl_id OK",
258 s: "device 192.168.0.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nopts: rw,vers=4.1,rsize=131072,wsize=131072,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.2,fsc,local_lock=none\nage: 1234567\nimpl_id: name='FreeBSD 11.2-STABLE #0 r325575+c9231c7d6bd(HEAD): Mon Nov 18 22:46:47 UTC 2019\nuser@host:/path/to/something'\n,domain='something.org',date='1293840000,0'",
259 mounts: []*Mount{{
260 Device: "192.168.0.1:/srv",
261 Mount: "/mnt/nfs",
262 Type: "nfs4",
263 Stats: &MountStatsNFS{
264 StatVersion: "1.1",
265 Opts: map[string]string{"rw": "", "vers": "4.1",
266 "rsize": "131072", "wsize": "131072", "namlen": "255", "acregmin": "3",
267 "acregmax": "60", "acdirmin": "30", "acdirmax": "60", "fsc": "", "hard": "",
268 "proto": "tcp", "timeo": "600", "retrans": "2",
269 "sec": "sys", "clientaddr": "192.168.0.2",
270 "local_lock": "none",
271 },
272 Age: 1234567 * time.Second,
273 },
274 }},
275 },
276 {
277 name: "fixtures/proc OK",
278 mounts: []*Mount{
279 {
280 Device: "rootfs",
281 Mount: "/",
282 Type: "rootfs",
283 },
284 {
285 Device: "sysfs",
286 Mount: "/sys",
287 Type: "sysfs",
288 },
289 {
290 Device: "proc",
291 Mount: "/proc",
292 Type: "proc",
293 },
294 {
295 Device: "/dev/sda1",
296 Mount: "/",
297 Type: "ext4",
298 },
299 {
300 Device: "192.168.1.1:/srv/test",
301 Mount: "/mnt/nfs/test",
302 Type: "nfs4",
303 Stats: &MountStatsNFS{
304 StatVersion: "1.1",
305 Opts: map[string]string{"rw": "", "vers": "4.0",
306 "rsize": "1048576", "wsize": "1048576", "namlen": "255", "acregmin": "3",
307 "acregmax": "60", "acdirmin": "30", "acdirmax": "60", "hard": "",
308 "proto": "tcp", "port": "0", "timeo": "600", "retrans": "2",
309 "sec": "sys", "mountaddr": "192.168.1.1", "clientaddr": "192.168.1.5",
310 "local_lock": "none",
311 },
312 Age: 13968 * time.Second,
313 Bytes: NFSBytesStats{
314 Read: 1207640230,
315 ReadTotal: 1210214218,
316 ReadPages: 295483,
317 },
318 Events: NFSEventsStats{
319 InodeRevalidate: 52,
320 DnodeRevalidate: 226,
321 VFSOpen: 1,
322 VFSLookup: 13,
323 VFSAccess: 398,
324 VFSReadPages: 331,
325 VFSWritePages: 47,
326 VFSFlush: 77,
327 VFSFileRelease: 77,
328 },
329 Operations: []NFSOperationStats{
330 {
331 Operation: "NULL",
332 },
333 {
334 Operation: "READ",
335 Requests: 1298,
336 Transmissions: 1298,
337 BytesSent: 207680,
338 BytesReceived: 1210292152,
339 CumulativeQueueMilliseconds: 6,
340 CumulativeTotalResponseMilliseconds: 79386,
341 CumulativeTotalRequestMilliseconds: 79407,
342 AverageRTTMilliseconds: 61.16024653312789,
343 },
344 {
345 Operation: "WRITE",
346 },
347 {
348 Operation: "ACCESS",
349 Requests: 2927395007,
350 Transmissions: 2927394995,
351 BytesSent: 526931094212,
352 BytesReceived: 362996810236,
353 CumulativeQueueMilliseconds: 18446743919241604546,
354 CumulativeTotalResponseMilliseconds: 1667369447,
355 CumulativeTotalRequestMilliseconds: 1953587717,
356 AverageRTTMilliseconds: 0.5695744656983355,
357 },
358 },
359 Transport: NFSTransportStats{
360 Protocol: "tcp",
361 Port: 832,
362 Connect: 1,
363 IdleTimeSeconds: 11,
364 Sends: 6428,
365 Receives: 6428,
366 CumulativeActiveRequests: 12154,
367 MaximumRPCSlotsUsed: 24,
368 CumulativeSendingQueue: 26,
369 CumulativePendingQueue: 5726,
370 },
371 },
372 },
373 },
374 },
375 {
376 name: "NFS xprt over rdma proto",
377 s: `device <nfsserver>:<nfsmount> mounted on <mountpoint> with fstype nfs statvers=1.1
378 opts: ro,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmin=120,acregmax=120,acdirmin=120,acdirmax=120,hard,nocto,forcerdirplus,proto=rdma,nconnect=16,port=20049,timeo=600,retrans=2,sec=sys,mountaddr=172.16.40.20,mountvers=3,mountport=0,mountproto=tcp,local_lock=none
379 age: 1270876
380 caps: caps=0xf,wtmult=4096,dtsize=131072,bsize=0,namlen=255
381 sec: flavor=1,pseudoflavor=1
382 events: 512052 36601115 0 68 1498583 16514 38815015 0 41584 2654459933 0 0 0 0 1527715 0 0 1498575 0 0 0 0 0 0 0 0 0
383 bytes: 3104202770327296 0 0 0 2013200952170479 0 491504202537 0
384 RPC iostats version: 1.1 p/v: 100003/3 (nfs)
385 xprt: rdma 0 0 5808 62 0 494490723 494490687 36 10032963746 1282789 107150285 1226637531 2673889 135120843409861 135119397156505 266368832 75716996 0 7853 0 0 0 0 119328 1336431717 0 96
386 per-op statistics
387 NULL: 16 16 0 640 384 320 11 331 0
388 `,
389 mounts: []*Mount{{
390 Device: "<nfsserver>:<nfsmount>",
391 Mount: "<mountpoint>",
392 Type: "nfs",
393 Stats: &MountStatsNFS{
394 StatVersion: "1.1",
395 Opts: map[string]string{"acdirmax": "120", "acdirmin": "120", "acregmax": "120",
396 "acregmin": "120", "forcerdirplus": "", "hard": "", "local_lock": "none",
397 "mountaddr": "172.16.40.20", "mountport": "0", "mountproto": "tcp", "mountvers": "3",
398 "namlen": "255", "nconnect": "16", "nocto": "", "port": "20049", "proto": "rdma",
399 "retrans": "2", "ro": "", "rsize": "1048576", "sec": "sys", "timeo": "600",
400 "vers": "3", "wsize": "1048576"},
401 Age: 1270876 * time.Second,
402 Bytes: NFSBytesStats{
403 Read: 3104202770327296,
404 ReadTotal: 2013200952170479,
405 ReadPages: 491504202537,
406 },
407 Events: NFSEventsStats{
408 InodeRevalidate: 512052,
409 DnodeRevalidate: 36601115,
410 AttributeInvalidate: 68,
411 VFSOpen: 1498583,
412 VFSLookup: 16514,
413 VFSAccess: 38815015,
414 VFSReadPage: 41584,
415 VFSReadPages: 2654459933,
416 VFSFlush: 1527715,
417 VFSFileRelease: 1498575,
418 },
419 Operations: []NFSOperationStats{
420 {
421 Operation: "NULL",
422 Requests: 16,
423 Transmissions: 16,
424 MajorTimeouts: 0,
425 BytesSent: 640,
426 BytesReceived: 384,
427 CumulativeQueueMilliseconds: 320,
428 CumulativeTotalResponseMilliseconds: 11,
429 CumulativeTotalRequestMilliseconds: 331,
430 AverageRTTMilliseconds: 0.6875,
431 Errors: 0,
432 },
433 },
434 Transport: NFSTransportStats{
435 Protocol: "rdma",
436 Port: 0,
437 Bind: 0,
438 Connect: 5808,
439 ConnectIdleTime: 62,
440 IdleTimeSeconds: 0,
441 Sends: 494490723,
442 Receives: 494490687,
443 BadTransactionIDs: 36,
444 CumulativeActiveRequests: 10032963746,
445 CumulativeBacklog: 1282789,
446 MaximumRPCSlotsUsed: 0,
447 CumulativeSendingQueue: 0,
448 CumulativePendingQueue: 0,
449 ReadChunkCount: 107150285,
450 WriteChunkCount: 1226637531,
451 ReplyChunkCount: 2673889,
452 TotalRdmaRequest: 135120843409861,
453 PullupCopyCount: 135119397156505,
454 HardwayRegisterCount: 266368832,
455 FailedMarshalCount: 75716996,
456 BadReplyCount: 0,
457 MrsRecovered: 7853,
458 MrsOrphaned: 0,
459 MrsAllocated: 0,
460 EmptySendctxQ: 0,
461 TotalRdmaReply: 0,
462 FixupCopyCount: 119328,
463 ReplyWaitsForSend: 1336431717,
464 LocalInvNeeded: 0,
465 NomsgCallCount: 96,
466 BcallCount: 0,
467 },
468 },
469 }},
470 },
471 }
472
473 for i, tt := range tests {
474 t.Logf("[%02d] test %q", i, tt.name)
475
476 var mounts []*Mount
477 var err error
478
479 if tt.s != "" {
480 mounts, err = parseMountStats(strings.NewReader(tt.s))
481 } else {
482 proc, e := getProcFixtures(t).Proc(26231)
483 if e != nil {
484 t.Fatalf("failed to create proc: %v", err)
485 }
486
487 mounts, err = proc.MountStats()
488 }
489
490 if tt.invalid && err == nil {
491 t.Error("expected an error, but none occurred")
492 }
493 if !tt.invalid && err != nil {
494 t.Errorf("unexpected error: %v", err)
495 }
496
497 if want, have := tt.mounts, mounts; !reflect.DeepEqual(want, have) {
498 t.Errorf("mounts:\nwant:\n%v\nhave:\n%v", mountsStr(want), mountsStr(have))
499 }
500 }
501 }
502
503 func mountsStr(mounts []*Mount) string {
504 var out string
505 for i, m := range mounts {
506 out += fmt.Sprintf("[%d] %q on %q (%q)", i, m.Device, m.Mount, m.Type)
507
508 stats, ok := m.Stats.(*MountStatsNFS)
509 if !ok {
510 out += "\n"
511 continue
512 }
513
514 out += fmt.Sprintf("\n\t- opts: %s", stats.Opts)
515 out += fmt.Sprintf("\n\t- v%s, age: %s", stats.StatVersion, stats.Age)
516 out += fmt.Sprintf("\n\t- bytes: %v", stats.Bytes)
517 out += fmt.Sprintf("\n\t- events: %v", stats.Events)
518 out += fmt.Sprintf("\n\t- transport: %v", stats.Transport)
519 out += "\n\t- per-operation stats:"
520
521 for _, o := range stats.Operations {
522 out += fmt.Sprintf("\n\t\t- %v", o)
523 }
524
525 out += "\n"
526 }
527
528 return out
529 }
530
531 func TestMountStatsExtendedOperationStats(t *testing.T) {
532 r := strings.NewReader(extendedOpsExampleMountstats)
533 _, err := parseMountStats(r)
534 if err != nil {
535 t.Errorf("failed to parse mount stats with extended per-op statistics: %v", err)
536 }
537 }
538
539 const (
540 extendedOpsExampleMountstats = `
541 device fs.example.com:/volume4/apps/home-automation/node-red-data mounted on /var/lib/kubelet/pods/1c2215a7-0d92-4df5-83ce-a807bcc2f8c8/volumes/kubernetes.io~nfs/home-automation--node-red-data--pv0001 with fstype nfs4 statvers=1.1
542 opts: rw,vers=4.1,rsize=131072,wsize=131072,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.191,local_lock=none
543 age: 83520
544 impl_id: name='',domain='',date='0,0'
545 caps: caps=0x3fff7,wtmult=512,dtsize=32768,bsize=0,namlen=255
546 nfsv4: bm0=0xfdffafff,bm1=0xf9be3e,bm2=0x800,acl=0x0,sessions,pnfs=not configured,lease_time=90,lease_expired=0
547 sec: flavor=1,pseudoflavor=1
548 events: 52472 472680 16671 57552 2104 9565 749555 9568641 168 24103 1 267134 3350 20097 116581 18214 43757 111141 0 28 9563845 34 0 0 0 0 0
549 bytes: 2021340783 39056395530 0 0 1788561151 39087991255 442605 9557343
550 RPC iostats version: 1.1 p/v: 100003/4 (nfs)
551 xprt: tcp 940 0 2 0 1 938505 938504 0 12756069 0 32 254729 10823602
552 per-op statistics
553 NULL: 1 1 0 44 24 0 0 0 0
554 READ: 34096 34096 0 7103096 1792122744 2272 464840 467945 0
555 WRITE: 322308 322308 0 39161277084 56725504 401718334 10139998 411864389 0
556 COMMIT: 12541 12541 0 2709896 1304264 342 7179 7819 0
557 OPEN: 12637 12637 0 3923256 4659940 871 57185 58251 394
558 OPEN_CONFIRM: 0 0 0 0 0 0 0 0 0
559 OPEN_NOATTR: 98741 98741 0 25656212 31630800 3366 77710 82693 0
560 OPEN_DOWNGRADE: 0 0 0 0 0 0 0 0 0
561 CLOSE: 87075 87075 0 18778608 15308496 2026 49131 52399 116
562 SETATTR: 24576 24576 0 5825876 6522260 643 34384 35650 0
563 FSINFO: 1 1 0 168 152 0 0 0 0
564 RENEW: 0 0 0 0 0 0 0 0 0
565 SETCLIENTID: 0 0 0 0 0 0 0 0 0
566 SETCLIENTID_CONFIRM: 0 0 0 0 0 0 0 0 0
567 LOCK: 22512 22512 0 5417628 2521312 1088 17407 18794 2
568 LOCKT: 0 0 0 0 0 0 0 0 0
569 LOCKU: 21247 21247 0 4589352 2379664 315 8409 9003 0
570 ACCESS: 1466 1466 0 298160 246288 22 1394 1492 0
571 GETATTR: 52480 52480 0 10015464 12694076 2930 30069 34502 0
572 LOOKUP: 11727 11727 0 2518200 2886376 272 16935 17662 3546
573 LOOKUP_ROOT: 0 0 0 0 0 0 0 0 0
574 REMOVE: 833 833 0 172236 95268 15 4566 4617 68
575 RENAME: 11431 11431 0 3150708 1737512 211 52649 53091 0
576 LINK: 1 1 0 288 292 0 0 0 0
577 SYMLINK: 0 0 0 0 0 0 0 0 0
578 CREATE: 77 77 0 18292 23496 0 363 371 11
579 PATHCONF: 1 1 0 164 116 0 0 0 0
580 STATFS: 7420 7420 0 1394960 1187200 144 4672 4975 0
581 READLINK: 4 4 0 704 488 0 1 1 0
582 READDIR: 1353 1353 0 304024 2902928 11 4326 4411 0
583 SERVER_CAPS: 9 9 0 1548 1476 0 3 3 0
584 DELEGRETURN: 232 232 0 48896 37120 811 300 1115 0
585 GETACL: 0 0 0 0 0 0 0 0 0
586 SETACL: 0 0 0 0 0 0 0 0 0
587 FS_LOCATIONS: 0 0 0 0 0 0 0 0 0
588 RELEASE_LOCKOWNER: 0 0 0 0 0 0 0 0 0
589 SECINFO: 0 0 0 0 0 0 0 0 0
590 FSID_PRESENT: 0 0 0 0 0 0 0 0 0
591 EXCHANGE_ID: 2 2 0 464 200 0 0 0 0
592 CREATE_SESSION: 1 1 0 192 124 0 0 0 0
593 DESTROY_SESSION: 0 0 0 0 0 0 0 0 0
594 SEQUENCE: 0 0 0 0 0 0 0 0 0
595 GET_LEASE_TIME: 0 0 0 0 0 0 0 0 0
596 RECLAIM_COMPLETE: 1 1 0 124 88 0 81 81 0
597 LAYOUTGET: 0 0 0 0 0 0 0 0 0
598 GETDEVICEINFO: 0 0 0 0 0 0 0 0 0
599 LAYOUTCOMMIT: 0 0 0 0 0 0 0 0 0
600 LAYOUTRETURN: 0 0 0 0 0 0 0 0 0
601 SECINFO_NO_NAME: 0 0 0 0 0 0 0 0 0
602 TEST_STATEID: 0 0 0 0 0 0 0 0 0
603 FREE_STATEID: 10413 10413 0 1416168 916344 147 3518 3871 10413
604 GETDEVICELIST: 0 0 0 0 0 0 0 0 0
605 BIND_CONN_TO_SESSION: 0 0 0 0 0 0 0 0 0
606 DESTROY_CLIENTID: 0 0 0 0 0 0 0 0 0
607 SEEK: 0 0 0 0 0 0 0 0 0
608 ALLOCATE: 0 0 0 0 0 0 0 0 0
609 DEALLOCATE: 0 0 0 0 0 0 0 0 0
610 LAYOUTSTATS: 0 0 0 0 0 0 0 0 0
611 CLONE: 0 0 0 0 0 0 0 0 0
612 COPY: 0 0 0 0 0 0 0 0 0
613 OFFLOAD_CANCEL: 0 0 0 0 0 0 0 0 0
614 LOOKUPP: 0 0 0 0 0 0 0 0 0
615 LAYOUTERROR: 0 0 0 0 0 0 0 0 0
616 `
617
618 extendedRDMAExampleALLMountstats = `device <nfsserver>:<nfsmount> mounted on <mountpoint> with fstype nfs statvers=1.1
619 opts: ro,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmin=120,acregmax=120,acdirmin=120,acdirmax=120,hard,nocto,forcerdirplus,proto=rdma,nconnect=16,port=20049,timeo=600,retrans=2,sec=sys,mountaddr=172.16.40.20,mountvers=3,mountport=0,mountproto=tcp,local_lock=none
620 age: 1270876
621 caps: caps=0xf,wtmult=4096,dtsize=131072,bsize=0,namlen=255
622 sec: flavor=1,pseudoflavor=1
623 events: 512052 36601115 0 68 1498583 16514 38815015 0 41584 2654459933 0 0 0 0 1527715 0 0 1498575 0 0 0 0 0 0 0 0 0
624 bytes: 3104202770327296 0 0 0 2013200952170479 0 491504202537 0
625 RPC iostats version: 1.1 p/v: 100003/3 (nfs)
626 xprt: rdma 0 0 5808 62 0 494490723 494490687 36 10032963746 1282789 107150285 1226637531 2673889 135120843409861 135119397156505 266368832 75716996 0 7853 0 0 0 0 119328 1336431717 0 96
627 xprt: rdma 0 0 14094 145 0 492392334 492392307 27 7078693624 2509627 105561370 1280878332 2659446 142218924010291 142217463504063 276368040 94761838 0 7610 0 0 0 0 207977 1389069860 0 103
628 xprt: rdma 0 0 16107 156 0 522755125 522755092 33 9119562599 1147699 109077860 1491898147 2566003 167152062826463 167149287506014 284931680 83011025 0 6229 0 0 0 0 221408 1603518232 0 82
629 xprt: rdma 0 0 7808 82 0 441542046 441542010 36 7226132207 2519174 111096004 955223347 2676765 105741904708009 105740125663595 275613584 80373159 0 8893 0 0 0 0 149479 1068962768 0 76
630 xprt: rdma 0 0 15018 167 0 508091827 508091764 63 19817677255 36702583 108265928 1258185459 2438516 138247436686102 138246196289594 270162080 74962306 0 13328 0 0 0 0 268433 1368837472 0 66
631 xprt: rdma 0 0 14321 149 0 530246310 530246275 35 9723190432 2392024 111099700 1494204555 2589805 166691166581904 166689567426908 289995492 85067377 0 8010 0 0 0 0 214511 1607864447 0 100
632 xprt: rdma 0 0 7863 84 0 459019689 459019642 47 11809253102 1716688 111825219 1032758664 2564226 114416685286438 114414936423706 290494252 73702102 0 6927 0 0 0 0 134453 1147121864 0 79
633 xprt: rdma 0 0 7702 84 3 497598986 497598931 55 11816221496 3924722 106922130 1382063307 2506108 153967067193941 153965665472218 286222584 84094006 0 5875 0 0 0 0 127347 1491469045 0 66
634 xprt: rdma 0 0 18341 202 0 477721151 477721073 78 15204400959 40562626 106645745 1291616653 3091375 144533696686651 144529688231163 278135800 73821525 0 6795 0 0 0 0 251097 1401327563 0 64
635 xprt: rdma 0 0 8228 90 4 453155092 453155063 29 7884786894 1591225 112197590 1026006338 2742688 114591819605673 114590175821191 275541944 85857259 0 7487 0 0 0 0 143044 1140917892 0 76
636 xprt: rdma 0 0 7843 83 0 446480377 446480324 53 12267986428 2958997 111971246 963162784 2693433 107176282309753 107174637802555 290269096 101100410 0 7825 0 0 0 0 141735 1077797328 0 83
637 xprt: rdma 0 0 7582 86 0 423315608 423315567 41 10197484604 2076993 109207538 785978455 2650354 86090211449474 86088475571312 279912524 87676008 0 7491 0 0 0 0 137533 897807641 0 101
638 xprt: rdma 0 0 7767 84 0 482538465 482538424 41 8935200479 1344778 112200583 1192341640 2644896 132860698423762 132858881459050 273354060 75337030 0 5941 0 0 0 0 127842 1307164736 0 97
639 xprt: rdma 0 0 14526 148 2 537745063 537745007 56 20756072620 3970332320 109539564 1363647371 2503250 148793734936250 148791264145401 291888720 90344151 0 7471 0 0 0 0 211057 1475661285 0 82
640 xprt: rdma 0 0 14300 151 0 495357347 495357316 31 8703101643 1451809 112315311 1303804607 2620502 145680743007170 145678880292235 288046696 98018259 0 7241 0 0 0 0 209396 1418712657 0 139
641 xprt: rdma 0 0 7700 82 0 466611083 466611050 33 8540498291 4082864 114740300 1059770596 2523155 117376668239921 117375375683167 260927576 78437075 0 6691 0 0 0 0 130878 1177008175 1 76
642 per-op statistics
643 NULL: 16 16 0 640 384 320 11 331 0
644 GETATTR: 512052 512052 0 79823516 57349824 107131 612667 751847 0
645 SETATTR: 0 0 0 0 0 0 0 0 0
646 LOOKUP: 16713 16713 0 3040536 3706344 560 17488 20232 346
647 ACCESS: 211705 211705 0 33860920 25404600 37059 229754 283822 0
648 READLINK: 0 0 0 0 0 0 0 0 0
649 READ: 2654501510 2654501510 0 445911966900 2013540728551504 6347457114 31407021389 37927280438 0
650 WRITE: 0 0 0 0 0 0 0 0 0
651 CREATE: 0 0 0 0 0 0 0 0 0
652 MKDIR: 0 0 0 0 0 0 0 0 0
653 SYMLINK: 0 0 0 0 0 0 0 0 0
654 MKNOD: 0 0 0 0 0 0 0 0 0
655 REMOVE: 0 0 0 0 0 0 0 0 0
656 RMDIR: 0 0 0 0 0 0 0 0 0
657 RENAME: 0 0 0 0 0 0 0 0 0
658 LINK: 0 0 0 0 0 0 0 0 0
659 READDIR: 0 0 0 0 0 0 0 0 0
660 READDIRPLUS: 0 0 0 0 0 0 0 0 0
661 FSSTAT: 56356 56356 0 6243572 9467808 82068 74356 159001 0
662 FSINFO: 2 2 0 184 328 0 0 0 0
663 PATHCONF: 1 1 0 92 140 0 0 0 0
664 COMMIT: 0 0 0 0 0 0 0 0 0
665 `
666 )
667
668 func TestMountStatsExtendedRDMAStats(t *testing.T) {
669 r := strings.NewReader(extendedRDMAExampleALLMountstats)
670 _, err := parseMountStats(r)
671 if err != nil {
672 t.Errorf("failed to parse mount stats with extended RDMA statistics: %v", err)
673 }
674 }
675
View as plain text