MCPcopy
hub / github.com/NVIDIA/aistore / _removeNodeFromSmap

Function _removeNodeFromSmap

devtools/tutils/node.go:792–817  ·  view source on GitHub ↗

Quick remove node from SMap

(ctx *Ctx, proxyURL, sid string, timeout time.Duration)

Source from the content-addressed store, hash-verified

790
791// Quick remove node from SMap
792func _removeNodeFromSmap(ctx *Ctx, proxyURL, sid string, timeout time.Duration) error {
793 var (
794 baseParams = api.BaseParams{Client: ctx.Client, URL: proxyURL, Token: LoggedUserToken}
795 smap, err = api.GetClusterMap(baseParams)
796 node = smap.GetNode(sid)
797 )
798 if err != nil {
799 return fmt.Errorf("api.GetClusterMap failed, err: %v", err)
800 }
801 if node != nil && smap.IsPrimary(node) {
802 return fmt.Errorf("unregistering primary proxy is not allowed")
803 }
804 tlog.Logf("Remove %s from %s\n", node.StringEx(), smap)
805
806 err = api.RemoveNodeFromSmap(baseParams, sid)
807 if err != nil {
808 return err
809 }
810
811 // If node does not exist in cluster we should not wait for map version
812 // sync because update will not be scheduled.
813 if node != nil {
814 return _waitMapVersionSync(baseParams, ctx, time.Now().Add(timeout), smap, smap.Version, cos.NewStringSet(node.ID()))
815 }
816 return nil
817}

Callers 1

RemoveNodeFromSmapFunction · 0.85

Calls 10

GetClusterMapFunction · 0.92
LogfFunction · 0.92
RemoveNodeFromSmapFunction · 0.92
NewStringSetFunction · 0.92
_waitMapVersionSyncFunction · 0.85
GetNodeMethod · 0.80
IsPrimaryMethod · 0.80
AddMethod · 0.65
IDMethod · 0.65
StringExMethod · 0.45

Tested by

no test coverage detected