Skip to content

Commit

Permalink
Merge pull request #2827 from lowang-bh/fixNodeClone
Browse files Browse the repository at this point in the history
fix: nodeinfo clone
  • Loading branch information
volcano-sh-bot committed May 24, 2023
2 parents fc419ef + 05cd599 commit 53f93c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 12 additions & 1 deletion pkg/scheduler/api/node_info.go
Expand Up @@ -212,7 +212,8 @@ func (ni *NodeInfo) Clone() *NodeInfo {

klog.V(5).Infof("imageStates is %v", res.ImageStates)

res.Others = ni.Others
res.Others = ni.CloneOthers()
res.ImageStates = ni.CloneImageSumary()
return res
}

Expand Down Expand Up @@ -551,6 +552,16 @@ func (ni *NodeInfo) CloneImageSumary() map[string]*k8sframework.ImageStateSummar
return nodeImageStates
}

// CloneOthers clone other map resources
func (ni *NodeInfo) CloneOthers() map[string]interface{} {
others := make(map[string]interface{})
for k, v := range ni.Others {
others[k] = v
}
return others
}

// Clone clone csi node status info
func (cs *CSINodeStatusInfo) Clone() *CSINodeStatusInfo {
newcs := &CSINodeStatusInfo{
CSINodeName: cs.CSINodeName,
Expand Down
1 change: 0 additions & 1 deletion pkg/scheduler/cache/cache.go
Expand Up @@ -1072,7 +1072,6 @@ func (sc *SchedulerCache) Snapshot() *schedulingapi.ClusterInfo {
}

snapshot.Nodes[value.Name] = value.Clone()
snapshot.Nodes[value.Name].ImageStates = value.CloneImageSumary()

if value.RevocableZone != "" {
snapshot.RevocableNodes[value.Name] = snapshot.Nodes[value.Name]
Expand Down

0 comments on commit 53f93c8

Please sign in to comment.