Skip to content

Commit a77dab0

Browse files
authored
Merge pull request #2042 from k8s-infra-cherrypick-robot/cherry-pick-2040-to-release-1.29
[release-1.29] fix: incorrect snapshot size with default 100Gi
2 parents 32a094b + 3b3ecae commit a77dab0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/azurefile/controllerserver.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,11 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ
920920

921921
klog.V(2).Infof("created share snapshot: %s, time: %v, quota: %dGiB", itemSnapshot, itemSnapshotTime, itemSnapshotQuota)
922922
if itemSnapshotQuota == 0 {
923-
itemSnapshotQuota = defaultAzureFileQuota
923+
fileshare, err := d.cloud.FileClient.WithSubscriptionID(subsID).GetFileShare(ctx, rgName, accountName, fileShareName, "")
924+
if err != nil {
925+
return nil, status.Errorf(codes.Internal, "failed to get file share(%s) quota: %v", fileShareName, err)
926+
}
927+
itemSnapshotQuota = pointer.Int32Deref(fileshare.ShareQuota, defaultAzureFileQuota)
924928
}
925929
createResp := &csi.CreateSnapshotResponse{
926930
Snapshot: &csi.Snapshot{

0 commit comments

Comments
 (0)