Skip to content

Commit

Permalink
feature: support reschedule disk with resource exhausted error in del…
Browse files Browse the repository at this point in the history
…ay provisioning
  • Loading branch information
mowangdk committed Oct 17, 2023
1 parent 79369da commit ee8b39d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/disk/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ func getDiskType(diskVol *diskVolumeArgs) ([]string, []string, error) {
nodeInfo, err := client.CoreV1().Nodes().Get(context.Background(), diskVol.NodeSelected, metav1.GetOptions{})
if err != nil {
log.Log.Infof("getDiskType: failed to get node labels: %v", err)
goto cusDiskType
return nil, nil, status.Errorf(codes.ResourceExhausted, "CreateVolume:: get node info by name: %s failed with err: %v, start to reschedule", diskVol.NodeSelected, err)
}
re := regexp.MustCompile(`node.csi.alibabacloud.com/disktype.(.*)`)
for key := range nodeInfo.Labels {
Expand All @@ -980,14 +980,13 @@ func getDiskType(diskVol *diskVolumeArgs) ([]string, []string, error) {
log.Log.Infof("CreateVolume:: node support disk types: %v, nodeSelected: %v", nodeSupportDiskType, diskVol.NodeSelected)
}

cusDiskType:
provisionDiskTypes := []string{}
allTypes := deleteEmpty(strings.Split(diskVol.Type, ","))
if len(nodeSupportDiskType) != 0 {
provisionDiskTypes = intersect(nodeSupportDiskType, allTypes)
if len(provisionDiskTypes) == 0 {
log.Log.Errorf("CreateVolume:: node(%s) support type: [%v] is incompatible with provision disk type: [%s]", diskVol.NodeSelected, nodeSupportDiskType, allTypes)
return nil, nil, status.Errorf(codes.InvalidArgument, "CreateVolume:: node support type: [%v] is incompatible with provision disk type: [%s]", nodeSupportDiskType, allTypes)
return nil, nil, status.Errorf(codes.ResourceExhausted, "CreateVolume:: node support type: [%v] is incompatible with provision disk type: [%s]", nodeSupportDiskType, allTypes)
}
} else {
provisionDiskTypes = allTypes
Expand Down

0 comments on commit ee8b39d

Please sign in to comment.