Skip to content

Commit

Permalink
bugfix: the csinode driver status failed deleted
Browse files Browse the repository at this point in the history
fix #2508 the current implementation still keeps the deleted driver
status as true

Signed-off-by: xilinxing <[email protected]>
  • Loading branch information
xilinxing committed Sep 27, 2022
1 parent 3943282 commit 4b6e200
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions pkg/scheduler/cache/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,24 +411,18 @@ func (sc *SchedulerCache) AddOrUpdateCSINode(obj interface{}) {
return
}

var csiNodeStatus *schedulingapi.CSINodeStatusInfo
var found bool
csiNodeStatus := &schedulingapi.CSINodeStatusInfo{
CSINodeName: csiNode.Name,
DriverStatus: make(map[string]bool),
}
sc.Mutex.Lock()
defer sc.Mutex.Unlock()
// update nodeVolumeCount

if csiNodeStatus, found = sc.CSINodesStatus[csiNode.Name]; !found {
csiNodeStatus = &schedulingapi.CSINodeStatusInfo{
CSINodeName: csiNode.Name,
DriverStatus: make(map[string]bool),
}
sc.CSINodesStatus[csiNode.Name] = csiNodeStatus
}

for i := range csiNode.Spec.Drivers {
d := csiNode.Spec.Drivers[i]
csiNodeStatus.DriverStatus[d.Name] = d.Allocatable != nil && d.Allocatable.Count != nil
}
sc.CSINodesStatus[csiNode.Name] = csiNodeStatus
}

func (sc *SchedulerCache) UpdateCSINode(oldObj, newObj interface{}) {
Expand Down

0 comments on commit 4b6e200

Please sign in to comment.