Skip to content

Commit

Permalink
Merge pull request #890 from mowangdk/feature/support_reschedule_pvc_…
Browse files Browse the repository at this point in the history
…prebind

feature: support reschedule disk with resource exhausted error in del…
  • Loading branch information
mowangdk authored Oct 18, 2023
2 parents b588b0a + ee8b39d commit c4d5c16
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 c4d5c16

Please sign in to comment.