Skip to content

Commit

Permalink
Merge pull request #2263 from andyzhangx/stop-attch-get-disk-lun-fail…
Browse files Browse the repository at this point in the history
…ed-1.29

[release-1.29] fix: stop attaching disk when get disk lun failed
  • Loading branch information
andyzhangx committed Apr 8, 2024
2 parents 78a58bd + 576e128 commit d420eba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/azuredisk/controllerserver.go
Expand Up @@ -42,6 +42,7 @@ import (
"sigs.k8s.io/azuredisk-csi-driver/pkg/azureutils"
"sigs.k8s.io/azuredisk-csi-driver/pkg/optimization"
volumehelper "sigs.k8s.io/azuredisk-csi-driver/pkg/util"
azureconsts "sigs.k8s.io/cloud-provider-azure/pkg/consts"
"sigs.k8s.io/cloud-provider-azure/pkg/metrics"
azure "sigs.k8s.io/cloud-provider-azure/pkg/provider"
)
Expand Down Expand Up @@ -425,9 +426,8 @@ func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.Controlle
// Volume is already attached to node.
klog.V(2).Infof("Attach operation is successful. volume %s is already attached to node %s at lun %d.", diskURI, nodeName, lun)
} else {
if strings.Contains(strings.ToLower(err.Error()), strings.ToLower(consts.TooManyRequests)) ||
strings.Contains(strings.ToLower(err.Error()), consts.ClientThrottled) {
return nil, status.Errorf(codes.Internal, err.Error())
if !strings.Contains(err.Error(), azureconsts.CannotFindDiskLUN) {
return nil, status.Errorf(codes.Internal, "could not get disk lun for volume %s: %v", diskURI, err)
}
var cachingMode compute.CachingTypes
if cachingMode, err = azureutils.GetCachingMode(volumeContext); err != nil {
Expand Down

0 comments on commit d420eba

Please sign in to comment.