[#1496] node/control: Await until SetNetmapStatus() persists
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m25s
DCO action / DCO (pull_request) Successful in 1m51s
Vulncheck / Vulncheck (pull_request) Successful in 2m17s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m31s
Build / Build Components (pull_request) Successful in 2m48s
Tests and linters / gopls check (pull_request) Successful in 3m2s
Tests and linters / Staticcheck (pull_request) Successful in 3m15s
Tests and linters / Lint (pull_request) Successful in 4m9s
Tests and linters / Tests (pull_request) Successful in 4m44s
Tests and linters / Tests with -race (pull_request) Successful in 5m51s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m25s
DCO action / DCO (pull_request) Successful in 1m51s
Vulncheck / Vulncheck (pull_request) Successful in 2m17s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m31s
Build / Build Components (pull_request) Successful in 2m48s
Tests and linters / gopls check (pull_request) Successful in 3m2s
Tests and linters / Staticcheck (pull_request) Successful in 3m15s
Tests and linters / Lint (pull_request) Successful in 4m9s
Tests and linters / Tests (pull_request) Successful in 4m44s
Tests and linters / Tests with -race (pull_request) Successful in 5m51s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
f8b217cdb0
commit
1863647a75
3 changed files with 9 additions and 11 deletions
|
@ -421,8 +421,11 @@ func (c *cfg) updateNetMapState(ctx context.Context, stateSetter func(*nmClient.
|
||||||
prm.SetKey(c.key.PublicKey().Bytes())
|
prm.SetKey(c.key.PublicKey().Bytes())
|
||||||
stateSetter(&prm)
|
stateSetter(&prm)
|
||||||
|
|
||||||
_, err := c.cfgNetmap.wrapper.UpdatePeerState(ctx, prm)
|
res, err := c.cfgNetmap.wrapper.UpdatePeerState(ctx, prm)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return c.cfgNetmap.wrapper.Morph().WaitTxHalt(ctx, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
type netInfo struct {
|
type netInfo struct {
|
||||||
|
|
|
@ -58,9 +58,9 @@ func (c *Client) ForceRemovePeer(ctx context.Context, nodeInfo netmap.NodeInfo,
|
||||||
prm.SetControlTX(true)
|
prm.SetControlTX(true)
|
||||||
prm.SetVUB(vub)
|
prm.SetVUB(vub)
|
||||||
|
|
||||||
vub, err := c.UpdatePeerState(ctx, prm)
|
res, err := c.UpdatePeerState(ctx, prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("updating peer state: %v", err)
|
return 0, fmt.Errorf("updating peer state: %v", err)
|
||||||
}
|
}
|
||||||
return vub, nil
|
return res.VUB, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package netmap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-contract/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-contract/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
|
@ -37,7 +36,7 @@ func (u *UpdatePeerPrm) SetMaintenance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePeerState changes peer status through Netmap contract call.
|
// UpdatePeerState changes peer status through Netmap contract call.
|
||||||
func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (uint32, error) {
|
func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (client.InvokeRes, error) {
|
||||||
method := updateStateMethod
|
method := updateStateMethod
|
||||||
|
|
||||||
if c.client.WithNotary() && c.client.IsAlpha() {
|
if c.client.WithNotary() && c.client.IsAlpha() {
|
||||||
|
@ -56,9 +55,5 @@ func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (uint32,
|
||||||
prm.SetArgs(int64(p.state), p.key)
|
prm.SetArgs(int64(p.state), p.key)
|
||||||
prm.InvokePrmOptional = p.InvokePrmOptional
|
prm.InvokePrmOptional = p.InvokePrmOptional
|
||||||
|
|
||||||
res, err := c.client.Invoke(ctx, prm)
|
return c.client.Invoke(ctx, prm)
|
||||||
if err != nil {
|
|
||||||
return 0, fmt.Errorf("could not invoke smart contract: %w", err)
|
|
||||||
}
|
|
||||||
return res.VUB, nil
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue