Add API and CLI to unseal sector (#10626)
This commit is contained in:
parent
3f74840b67
commit
0befed7200
@ -129,6 +129,8 @@ type StorageMiner interface {
|
|||||||
SectorMatchPendingPiecesToOpenSectors(ctx context.Context) error //perm:admin
|
SectorMatchPendingPiecesToOpenSectors(ctx context.Context) error //perm:admin
|
||||||
// SectorAbortUpgrade can be called on sectors that are in the process of being upgraded to abort it
|
// SectorAbortUpgrade can be called on sectors that are in the process of being upgraded to abort it
|
||||||
SectorAbortUpgrade(context.Context, abi.SectorNumber) error //perm:admin
|
SectorAbortUpgrade(context.Context, abi.SectorNumber) error //perm:admin
|
||||||
|
// SectorUnseal unseals the provided sector
|
||||||
|
SectorUnseal(ctx context.Context, number abi.SectorNumber) error //perm:admin
|
||||||
|
|
||||||
// SectorNumAssignerMeta returns sector number assigner metadata - reserved/allocated
|
// SectorNumAssignerMeta returns sector number assigner metadata - reserved/allocated
|
||||||
SectorNumAssignerMeta(ctx context.Context) (NumAssignerMeta, error) //perm:read
|
SectorNumAssignerMeta(ctx context.Context) (NumAssignerMeta, error) //perm:read
|
||||||
|
@ -1085,6 +1085,8 @@ type StorageMinerMethods struct {
|
|||||||
|
|
||||||
SectorTerminatePending func(p0 context.Context) ([]abi.SectorID, error) `perm:"admin"`
|
SectorTerminatePending func(p0 context.Context) ([]abi.SectorID, error) `perm:"admin"`
|
||||||
|
|
||||||
|
SectorUnseal func(p0 context.Context, p1 abi.SectorNumber) error `perm:"admin"`
|
||||||
|
|
||||||
SectorsList func(p0 context.Context) ([]abi.SectorNumber, error) `perm:"read"`
|
SectorsList func(p0 context.Context) ([]abi.SectorNumber, error) `perm:"read"`
|
||||||
|
|
||||||
SectorsListInStates func(p0 context.Context, p1 []SectorState) ([]abi.SectorNumber, error) `perm:"read"`
|
SectorsListInStates func(p0 context.Context, p1 []SectorState) ([]abi.SectorNumber, error) `perm:"read"`
|
||||||
@ -6424,6 +6426,17 @@ func (s *StorageMinerStub) SectorTerminatePending(p0 context.Context) ([]abi.Sec
|
|||||||
return *new([]abi.SectorID), ErrNotSupported
|
return *new([]abi.SectorID), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StorageMinerStruct) SectorUnseal(p0 context.Context, p1 abi.SectorNumber) error {
|
||||||
|
if s.Internal.SectorUnseal == nil {
|
||||||
|
return ErrNotSupported
|
||||||
|
}
|
||||||
|
return s.Internal.SectorUnseal(p0, p1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *StorageMinerStub) SectorUnseal(p0 context.Context, p1 abi.SectorNumber) error {
|
||||||
|
return ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStruct) SectorsList(p0 context.Context) ([]abi.SectorNumber, error) {
|
func (s *StorageMinerStruct) SectorsList(p0 context.Context) ([]abi.SectorNumber, error) {
|
||||||
if s.Internal.SectorsList == nil {
|
if s.Internal.SectorsList == nil {
|
||||||
return *new([]abi.SectorNumber), ErrNotSupported
|
return *new([]abi.SectorNumber), ErrNotSupported
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -67,6 +67,7 @@ var sectorsCmd = &cli.Command{
|
|||||||
sectorsBatching,
|
sectorsBatching,
|
||||||
sectorsRefreshPieceMatchingCmd,
|
sectorsRefreshPieceMatchingCmd,
|
||||||
sectorsCompactPartitionsCmd,
|
sectorsCompactPartitionsCmd,
|
||||||
|
sectorsUnsealCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2254,3 +2255,27 @@ var sectorsNumbersFreeCmd = &cli.Command{
|
|||||||
return minerAPI.SectorNumFree(ctx, cctx.Args().First())
|
return minerAPI.SectorNumFree(ctx, cctx.Args().First())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sectorsUnsealCmd = &cli.Command{
|
||||||
|
Name: "unseal",
|
||||||
|
Usage: "unseal a sector",
|
||||||
|
ArgsUsage: "[sector number]",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
minerAPI, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
ctx := lcli.ReqContext(cctx)
|
||||||
|
if cctx.NArg() != 1 {
|
||||||
|
return lcli.IncorrectNumArgs(cctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
sectorNum, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("could not parse sector number: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return minerAPI.SectorUnseal(ctx, abi.SectorNumber(sectorNum))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
@ -159,6 +159,7 @@
|
|||||||
* [SectorTerminate](#SectorTerminate)
|
* [SectorTerminate](#SectorTerminate)
|
||||||
* [SectorTerminateFlush](#SectorTerminateFlush)
|
* [SectorTerminateFlush](#SectorTerminateFlush)
|
||||||
* [SectorTerminatePending](#SectorTerminatePending)
|
* [SectorTerminatePending](#SectorTerminatePending)
|
||||||
|
* [SectorUnseal](#SectorUnseal)
|
||||||
* [Sectors](#Sectors)
|
* [Sectors](#Sectors)
|
||||||
* [SectorsList](#SectorsList)
|
* [SectorsList](#SectorsList)
|
||||||
* [SectorsListInStates](#SectorsListInStates)
|
* [SectorsListInStates](#SectorsListInStates)
|
||||||
@ -3415,6 +3416,21 @@ Response:
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### SectorUnseal
|
||||||
|
SectorUnseal unseals the provided sector
|
||||||
|
|
||||||
|
|
||||||
|
Perms: admin
|
||||||
|
|
||||||
|
Inputs:
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
9
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Response: `{}`
|
||||||
|
|
||||||
## Sectors
|
## Sectors
|
||||||
|
|
||||||
|
|
||||||
|
@ -1671,6 +1671,7 @@ COMMANDS:
|
|||||||
batching manage batch sector operations
|
batching manage batch sector operations
|
||||||
match-pending-pieces force a refreshed match of pending pieces to open sectors without manually waiting for more deals
|
match-pending-pieces force a refreshed match of pending pieces to open sectors without manually waiting for more deals
|
||||||
compact-partitions removes dead sectors from partitions and reduces the number of partitions used if possible
|
compact-partitions removes dead sectors from partitions and reduces the number of partitions used if possible
|
||||||
|
unseal unseal a sector
|
||||||
help, h Shows a list of commands or help for one command
|
help, h Shows a list of commands or help for one command
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
@ -2086,6 +2087,19 @@ OPTIONS:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### lotus-miner sectors unseal
|
||||||
|
```
|
||||||
|
NAME:
|
||||||
|
lotus-miner sectors unseal - unseal a sector
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
lotus-miner sectors unseal [command options] [sector number]
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
--help, -h show help (default: false)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## lotus-miner proving
|
## lotus-miner proving
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
|
@ -254,6 +254,33 @@ func (sm *StorageMinerAPI) SectorsUnsealPiece(ctx context.Context, sector storif
|
|||||||
return sm.StorageMgr.SectorsUnsealPiece(ctx, sector, offset, size, randomness, commd)
|
return sm.StorageMgr.SectorsUnsealPiece(ctx, sector, offset, size, randomness, commd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sm *StorageMinerAPI) SectorUnseal(ctx context.Context, sectorNum abi.SectorNumber) error {
|
||||||
|
|
||||||
|
status, err := sm.Miner.SectorsStatus(ctx, sectorNum, false)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
minerAddr, err := sm.ActorAddress(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
minerID, err := address.IDFromAddress(minerAddr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sector := storiface.SectorRef{
|
||||||
|
ID: abi.SectorID{
|
||||||
|
Miner: abi.ActorID(minerID),
|
||||||
|
Number: sectorNum,
|
||||||
|
},
|
||||||
|
ProofType: status.SealProof,
|
||||||
|
}
|
||||||
|
|
||||||
|
return sm.StorageMgr.SectorsUnsealPiece(ctx, sector, storiface.UnpaddedByteIndex(0), abi.UnpaddedPieceSize(0), status.Ticket.Value, status.CommD)
|
||||||
|
}
|
||||||
|
|
||||||
// List all staged sectors
|
// List all staged sectors
|
||||||
func (sm *StorageMinerAPI) SectorsList(context.Context) ([]abi.SectorNumber, error) {
|
func (sm *StorageMinerAPI) SectorsList(context.Context) ([]abi.SectorNumber, error) {
|
||||||
sectors, err := sm.Miner.ListSectors()
|
sectors, err := sm.Miner.ListSectors()
|
||||||
|
Loading…
Reference in New Issue
Block a user