Skip to content

Commit 66cb3d7

Browse files
fix(scheduling): remove node from selected which are not in nmap
Signed-off-by: Abhilash Shetty <[email protected]>
1 parent 34db348 commit 66cb3d7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/driver/controller.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package driver
22

33
import (
44
"fmt"
5+
"slices"
56
"strconv"
67
"strings"
78
"time"
@@ -350,13 +351,21 @@ func CreateLVMVolume(ctx context.Context, req *csi.CreateVolumeRequest,
350351
// run the scheduler
351352
selected := schd.Scheduler(req, nmap)
352353

354+
// removes the node from the selected if not present in nmap
355+
selected = slices.DeleteFunc(selected, func(s string) bool {
356+
_, ok := nmap[s]
357+
return !ok
358+
})
359+
353360
if len(selected) == 0 {
354361
return nil, status.Error(codes.ResourceExhausted, "scheduler failed, not able to select a node to create the PV")
355362
}
356363

357364
owner = selected[0]
358365
}
359-
366+
klog.Infof("scheduling the volume %s/%s on node %s",
367+
params.VgPattern.String(), volName, owner)
368+
360369
volObj, err := volbuilder.NewBuilder().
361370
WithName(volName).
362371
WithCapacity(capacity).

0 commit comments

Comments
 (0)