forked from filecoin-project/lotus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo_all.go
204 lines (162 loc) · 4.8 KB
/
info_all.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
package miner
import (
"flag"
"fmt"
"sort"
"github.com/urfave/cli/v2"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/cli/spcli"
)
var _test = false
var infoAllCmd = &cli.Command{
Name: "all",
Usage: "dump all related miner info",
Action: func(cctx *cli.Context) error {
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, acloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer acloser()
_ = api
ctx := lcli.ReqContext(cctx)
// Top-level info
fmt.Println("#: Version")
if err := lcli.VersionCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Miner Info")
if err := infoCmdAct(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
// Verbose info
fmt.Println("\n#: Storage List")
if err := storageListCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Sealing Worker List")
if err := workersCmd(true).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Proving Worker List")
if err := workersCmd(false).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: PeerID")
if err := lcli.NetId.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Listen Addresses")
if err := lcli.NetListen.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Reachability")
if err := lcli.NetReachability.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
// Very Verbose info
fmt.Println("\n#: Peers")
if err := lcli.NetPeers.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Proving Info")
if err := spcli.ProvingInfoCmd(LMActorOrEnvGetter).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Proving Deadlines")
if err := spcli.ProvingDeadlinesCmd(LMActorOrEnvGetter).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Proving Faults")
if err := spcli.ProvingFaultsCmd(LMActorOrEnvGetter).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Sealing Jobs")
if err := sealingJobsCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Storage Locks")
if err := storageLocks.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Sched Diag")
if err := sealingSchedDiagCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Pending Batch Terminations")
if err := sectorsTerminatePendingCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Pending Batch PreCommit")
if err := sectorsBatchingPendingPreCommit.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Pending Batch Commit")
if err := sectorsBatchingPendingCommit.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Sector List")
{
fs := &flag.FlagSet{}
for _, f := range sectorsListCmd.Flags {
if err := f.Apply(fs); err != nil {
fmt.Println("ERROR: ", err)
}
}
if err := sectorsListCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
fmt.Println("ERROR: ", err)
}
}
fmt.Println("\n#: Storage Sector List")
if err := storageListSectorsCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Expired Sectors")
if err := sectorsExpiredCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
// Very Very Verbose info
fmt.Println("\n#: Per Sector Info")
list, err := minerApi.SectorsList(ctx)
if err != nil {
fmt.Println("ERROR: ", err)
}
sort.Slice(list, func(i, j int) bool {
return list[i] < list[j]
})
for _, s := range list {
fmt.Printf("\n##: Sector %d Status\n", s)
fs := &flag.FlagSet{}
for _, f := range spcli.SectorsStatusCmd(LMActorOrEnvGetter, getOnDiskInfo).Flags {
if err := f.Apply(fs); err != nil {
fmt.Println("ERROR: ", err)
}
}
if err := fs.Parse([]string{"--log", "--on-chain-info", fmt.Sprint(s)}); err != nil {
fmt.Println("ERROR: ", err)
}
if err := spcli.SectorsStatusCmd(LMActorOrEnvGetter, getOnDiskInfo).Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Printf("\n##: Sector %d Storage Location\n", s)
fs = &flag.FlagSet{}
if err := fs.Parse([]string{fmt.Sprint(s)}); err != nil {
fmt.Println("ERROR: ", err)
}
if err := storageFindCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
fmt.Println("ERROR: ", err)
}
}
if !_test {
fmt.Println("\n#: Goroutines")
if err := lcli.PprofGoroutinesCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
}
return nil
},
}