Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix capacity value after resize to lower capacity #185

Merged
merged 2 commits into from
Feb 19, 2024
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
8 changes: 1 addition & 7 deletions service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@
return resp, status.Error(codes.Unknown, utils.GetMessageWithRunID(rid, "Unsupported capability"))
}

func (s *service) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {

Check warning on line 498 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)

Check warning on line 498 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'req' seems to be unused, consider removing or renaming it as _ (revive)
return nil, status.Error(codes.Unimplemented, "Not implemented")
}

Expand Down Expand Up @@ -833,10 +833,7 @@

// Idempotency check
if filesystem.FileContent.SizeTotal >= uint64(capacity) {
log.Infof("New Filesystem size (%d) is same as existing Filesystem size. Ignoring expand volume operation.", filesystem.FileContent.SizeTotal)
expandVolumeResp := &csi.ControllerExpandVolumeResponse{
CapacityBytes: 0,
}
log.Infof("New Filesystem size (%d) is lower or same as existing Filesystem size. Ignoring expand volume operation.", filesystem.FileContent.SizeTotal)
expandVolumeResp.NodeExpansionRequired = false
return expandVolumeResp, nil
}
Expand Down Expand Up @@ -869,9 +866,6 @@

if volume.VolumeContent.SizeTotal >= uint64(capacity) {
log.Infof("New Volume size (%d) is same as existing Volume size. Ignoring expand volume operation.", volume.VolumeContent.SizeTotal)
/* expandVolumeResp := &csi.ControllerExpandVolumeResponse{
CapacityBytes: 0,
} */
expandVolumeResp.NodeExpansionRequired = nodeExpansionRequired
return expandVolumeResp, nil
}
Expand Down Expand Up @@ -1602,7 +1596,7 @@
}

// exportVolume - Method to export volume with idempotency
func (s *service) exportVolume(ctx context.Context, protocol, volID, hostID, nodeID, arrayID string, unity *gounity.Client, pinfo map[string]string, host *types.Host, vc *csi.VolumeCapability) (*csi.ControllerPublishVolumeResponse, error) {

Check warning on line 1599 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'nodeID' seems to be unused, consider removing or renaming it as _ (revive)

Check warning on line 1599 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'arrayID' seems to be unused, consider removing or renaming it as _ (revive)
ctx, log, rid := GetRunidLog(ctx)
pinfo["lun"] = volID
am := vc.GetAccessMode()
Expand Down
3 changes: 2 additions & 1 deletion test/unit-test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# This will run coverage analysis using the integration testing.
# The env.sh must point to a valid Unity XT Array# on this system.

rm -f /root/go/bin/csi.sock

source ../../env.sh
mkdir $(dirname "${CSI_ENDPOINT}") || rm -f ${CSI_ENDPOINT}
echo $SDC_GUID
go test -v -coverprofile=c.out -timeout 60m -coverpkg=github.com/dell/csi-unity/service *test.go &
wait
Expand Down
Loading