2020-08-04 18:57:40 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
|
|
|
|
lcli "github.com/filecoin-project/lotus/cli"
|
|
|
|
)
|
|
|
|
|
2020-10-05 12:14:43 +00:00
|
|
|
var _test = false
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
var infoAllCmd = &cli.Command{
|
|
|
|
Name: "all",
|
|
|
|
Usage: "dump all related miner info",
|
|
|
|
Action: func(cctx *cli.Context) error {
|
2022-09-14 18:51:18 +00:00
|
|
|
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
2020-08-04 18:57:40 +00:00
|
|
|
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 {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Miner Info")
|
|
|
|
if err := infoCmdAct(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Verbose info
|
|
|
|
|
|
|
|
fmt.Println("\n#: Storage List")
|
|
|
|
if err := storageListCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
2022-03-26 20:16:12 +00:00
|
|
|
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 {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: PeerID")
|
|
|
|
if err := lcli.NetId.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Listen Addresses")
|
|
|
|
if err := lcli.NetListen.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
2020-08-13 11:44:03 +00:00
|
|
|
fmt.Println("\n#: Reachability")
|
|
|
|
if err := lcli.NetReachability.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-13 11:44:03 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
// Very Verbose info
|
|
|
|
fmt.Println("\n#: Peers")
|
|
|
|
if err := lcli.NetPeers.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
2021-09-24 09:39:51 +00:00
|
|
|
fmt.Println("\n#: Proving Info")
|
|
|
|
if err := provingInfoCmd.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Proving Deadlines")
|
|
|
|
if err := provingDeadlinesCmd.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Proving Faults")
|
|
|
|
if err := provingFaultsCmd.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
fmt.Println("\n#: Sealing Jobs")
|
|
|
|
if err := sealingJobsCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
2022-02-17 15:35:09 +00:00
|
|
|
fmt.Println("\n#: Storage Locks")
|
|
|
|
if err := storageLocks.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
fmt.Println("\n#: Sched Diag")
|
|
|
|
if err := sealingSchedDiagCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Storage Ask")
|
|
|
|
if err := getAskCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Storage Deals")
|
2021-09-24 09:39:51 +00:00
|
|
|
{
|
|
|
|
fs := &flag.FlagSet{}
|
|
|
|
for _, f := range dealsListCmd.Flags {
|
|
|
|
if err := f.Apply(fs); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := fs.Parse([]string{"--verbose"}); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := dealsListCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Storage Deals JSON")
|
|
|
|
{
|
|
|
|
fs := &flag.FlagSet{}
|
|
|
|
for _, f := range dealsListCmd.Flags {
|
|
|
|
if err := f.Apply(fs); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := fs.Parse([]string{"--verbose", "--format=json"}); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := dealsListCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
2020-08-13 08:51:13 +00:00
|
|
|
fmt.Println("\n#: Retrieval Deals")
|
|
|
|
if err := retrievalDealsListCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-13 08:51:13 +00:00
|
|
|
}
|
|
|
|
|
2021-09-24 09:39:51 +00:00
|
|
|
fmt.Println("\n#: Data Transfers")
|
|
|
|
{
|
|
|
|
fs := &flag.FlagSet{}
|
|
|
|
for _, f := range transfersListCmd.Flags {
|
|
|
|
if err := f.Apply(fs); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := fs.Parse([]string{"--verbose", "--completed", "--show-failed"}); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := transfersListCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: DAGStore shards")
|
|
|
|
if err := dagstoreListShardsCmd.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("\n#: Pending Batch Deals")
|
|
|
|
if err := dealsPendingPublish.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)
|
|
|
|
}
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
fmt.Println("\n#: Sector List")
|
|
|
|
if err := sectorsListCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
2022-02-17 15:35:09 +00:00
|
|
|
fmt.Println("\n#: Storage Sector List")
|
|
|
|
if err := storageListSectorsCmd.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
2021-09-24 09:39:51 +00:00
|
|
|
fmt.Println("\n#: Expired Sectors")
|
|
|
|
if err := sectorsExpiredCmd.Action(cctx); err != nil {
|
|
|
|
fmt.Println("ERROR: ", err)
|
|
|
|
}
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
fmt.Println("\n#: Sector Refs")
|
|
|
|
if err := sectorsRefsCmd.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Very Very Verbose info
|
|
|
|
fmt.Println("\n#: Per Sector Info")
|
|
|
|
|
2022-09-14 18:51:18 +00:00
|
|
|
list, err := minerApi.SectorsList(ctx)
|
2020-08-04 18:57:40 +00:00
|
|
|
if err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 sectorsStatusCmd.Flags {
|
2020-08-20 04:49:10 +00:00
|
|
|
if err := f.Apply(fs); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-20 04:49:10 +00:00
|
|
|
}
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
if err := fs.Parse([]string{"--log", "--on-chain-info", fmt.Sprint(s)}); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if err := sectorsStatusCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
|
2020-09-24 20:17:20 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf("\n##: Sector %d Storage Location\n", s)
|
|
|
|
|
|
|
|
fs = &flag.FlagSet{}
|
|
|
|
if err := fs.Parse([]string{fmt.Sprint(s)}); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if err := storageFindCmd.Action(cli.NewContext(cctx.App, fs, cctx)); err != nil {
|
2020-09-24 20:17:20 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-08-04 18:57:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-05 12:14:43 +00:00
|
|
|
if !_test {
|
|
|
|
fmt.Println("\n#: Goroutines")
|
|
|
|
if err := lcli.PprofGoroutines.Action(cctx); err != nil {
|
2021-03-12 11:23:43 +00:00
|
|
|
fmt.Println("ERROR: ", err)
|
2020-10-05 12:14:43 +00:00
|
|
|
}
|
2020-08-17 09:48:12 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 18:57:40 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|