Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/dell/gofsutil v1.20.0
github.com/dell/goiscsi v1.13.0
github.com/dell/gonvme v1.12.0
github.com/dell/gopowerstore v1.20.0
github.com/dell/gopowerstore v1.20.1
github.com/fsnotify/fsnotify v1.9.0
github.com/go-openapi/strfmt v0.23.0
github.com/golang/mock v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ github.com/dell/goiscsi v1.13.0 h1:4+uB+uJQmJ91yN7wy38sLsr5S/lqL3/tVboLOh0sg38=
github.com/dell/goiscsi v1.13.0/go.mod h1:1IPCAavfm6T9BzKS0QYfBlJz7X+AfYPYjH4G84TvJP4=
github.com/dell/gonvme v1.12.0 h1:KLOr+v+1kn/sz26CFTAkFrR1Ti4aZ37i1Mlxp1hBXYs=
github.com/dell/gonvme v1.12.0/go.mod h1:ETLwyr+OG3DYfzdlMKCv5PjeDfj+JIxV2xrbHBTg2lk=
github.com/dell/gopowerstore v1.20.0 h1:hGnSahY4/om48xFpD9dQFvHfDjFN62n+y8UlOEUAii8=
github.com/dell/gopowerstore v1.20.0/go.mod h1:PNkGw7gZUyyjdJdZdKKvGve30DMse/SzOQqUkVN8HCM=
github.com/dell/gopowerstore v1.20.1 h1:Z2N5eWVBG+SrwtPMEXVeGOJ3jquhkrZ6PyCFpwfkDSg=
github.com/dell/gopowerstore v1.20.1/go.mod h1:PNkGw7gZUyyjdJdZdKKvGve30DMse/SzOQqUkVN8HCM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
Expand Down
47 changes: 30 additions & 17 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,26 +440,40 @@ func (s *Service) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest
params[identifiers.KeyVolumeDescription] = getDescription(req.GetParameters())

var volumeResponse *csi.Volume
resp, createError := creator.Create(ctx, req, sizeInBytes, arr.GetClient())
if createError != nil {
log.Warnf("create volume for %s failed: '%s'", req.GetName(), createError.Error())
if apiError, ok := createError.(gopowerstore.APIError); ok && (apiError.VolumeNameIsAlreadyUse() || apiError.FSNameIsAlreadyUse()) {
volumeResponse, err = creator.CheckIfAlreadyExists(ctx, req.GetName(), sizeInBytes, arr.GetClient())
if err != nil {
if useNFS && status.Code(err) != codes.AlreadyExists {
arr.NASCooldownTracker.MarkFailure(selectedNasName)
return nil, status.Error(codes.ResourceExhausted, createError.Error())
}
return nil, err
}
} else {

// check if job is already in progress on array, if so, return error and let CO check again
if useNFS {
jobs, err := arr.Client.GetInProgressJobsByFsName(ctx, req.GetName())
if err != nil {
log.Errorf("Error getting jobs that are in progress for FileSystem: %s error: %s", req.Name, err.Error())
return nil, status.Errorf(codes.Internal, "Error getting jobs that are in progress for FileSystem: %s error: %s", req.Name, err.Error())
}
if len(jobs) > 0 {
log.Infof("Job already in progress to create FileSystem %s", req.GetName())
return nil, status.Errorf(codes.AlreadyExists, "Job already in progress to create FileSystem %s", req.GetName())
}
}

// check if vol exists before creating it in the array
volumeResponse, err = creator.CheckIfAlreadyExists(ctx, req.GetName(), sizeInBytes, arr.GetClient())
if err != nil {
// internal means something went wrong trying to check the volume and request needs to be retried
if status.Code(err) == codes.Internal || status.Code(err) == codes.AlreadyExists {
log.Warnf("CheckIfAlreadyExists returned error: %s for vol: %s", err.Error(), req.GetName())
return nil, err
}
}

if volumeResponse == nil {
resp, createError := creator.Create(ctx, req, sizeInBytes, arr.GetClient())
if createError != nil {
log.Warnf("create volume for %s failed: '%s'", req.GetName(), createError.Error())
if useNFS {
arr.NASCooldownTracker.MarkFailure(selectedNasName)
return nil, status.Error(codes.ResourceExhausted, createError.Error())
}
return nil, status.Error(codes.Internal, createError.Error())
return nil, createError
}
} else {
if useNFS {
arr.NASCooldownTracker.ResetFailure(selectedNasName)
}
Expand Down Expand Up @@ -501,7 +515,6 @@ func (s *Service) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest

// Fetch the service tag
serviceTag := GetServiceTag(ctx, req, arr, volumeResponse.VolumeId, protocol)

volumeResponse.VolumeContext = req.Parameters
volumeResponse.VolumeContext[identifiers.KeyArrayID] = arr.GetGlobalID()
volumeResponse.VolumeContext[identifiers.KeyArrayVolumeName] = req.Name
Expand All @@ -510,7 +523,7 @@ func (s *Service) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest

if useNFS {
volumeResponse.VolumeContext[identifiers.KeyNfsACL] = nfsAcls
volumeResponse.VolumeContext[identifiers.KeyNasName] = selectedNasName
volumeResponse.VolumeContext[identifiers.KeyNasName] = creator.(*NfsCreator).nasName
topology = identifiers.GetNfsTopology(arr.GetIP())
log.Infof("Modified topology to nfs for %s", req.GetName())
}
Expand Down
Loading
Loading