Skip to content

Commit

Permalink
use node parameter to handle the sanity test failure
Browse files Browse the repository at this point in the history
Signed-off-by: prateekpandey14 <prateek.pandey@mayadata.io>
  • Loading branch information
prateekpandey14 committed Mar 31, 2021
1 parent a519c9a commit 851d930
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,20 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
return "", status.Errorf(codes.Internal, "get node map failed : %s", err.Error())
}

// run the scheduler
selected := schd.Scheduler(req, nmap)
// run the scheduler get the preferred nodelist
nodelist := schd.Scheduler(req, nmap)

selected := nodelist[0]

if len(selected) == 0 {
return "", status.Error(codes.Internal, "scheduler failed, not able to select a node to create the PV")
// (hack): CSI Sanity test does not pass topology information
selected = parameters["node"]
if len(selected) == 0 {
return "", status.Error(codes.Internal, "scheduler failed, not able to select a node to create the PV")
}
}

owner := selected[0]
klog.Infof("scheduling the volume %s/%s on node %s", pool, volName, owner)
klog.Infof("scheduling the volume %s/%s on node %s", pool, volName, selected)

volObj, err := volbuilder.NewBuilder().
WithName(volName).
Expand All @@ -221,7 +226,7 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
WithKeyFormat(kf).
WithKeyLocation(kl).
WithThinProv(tp).
WithOwnerNode(owner).
WithOwnerNode(selected).
WithVolumeType(vtype).
WithVolumeStatus(zfs.ZFSStatusPending).
WithFsType(fstype).
Expand Down

0 comments on commit 851d930

Please sign in to comment.