Skip to content

Commit f2519ac

Browse files
authored
Merge pull request #1510 from umagnus/fix_snapshot_restoresize
fix: incorrect volumesnapshot size
2 parents e94b307 + 4737944 commit f2519ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/azurefile/controllerserver.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,11 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ
995995
itemSnapshotTime = properties.LastModified()
996996
itemSnapshotQuota = properties.Quota()
997997
} else {
998-
snapshotShare, err := d.cloud.FileClient.WithSubscriptionID(subsID).CreateFileShare(ctx, rgName, accountName, &fileclient.ShareOptions{Name: fileShareName, RequestGiB: defaultAzureFileQuota, Metadata: map[string]*string{snapshotNameKey: &snapshotName}}, snapshotsExpand)
998+
fileshare, err := d.cloud.FileClient.WithSubscriptionID(subsID).GetFileShare(ctx, rgName, accountName, fileShareName, "")
999+
if err != nil {
1000+
return nil, status.Errorf(codes.Internal, "get fileshare from(%s) failed with %v, accountName: %q", sourceVolumeID, err, accountName)
1001+
}
1002+
snapshotShare, err := d.cloud.FileClient.WithSubscriptionID(subsID).CreateFileShare(ctx, rgName, accountName, &fileclient.ShareOptions{Name: fileShareName, RequestGiB: int(pointer.Int32Deref(fileshare.ShareQuota, defaultAzureFileQuota)), Metadata: map[string]*string{snapshotNameKey: &snapshotName}}, snapshotsExpand)
9991003
if err != nil {
10001004
return nil, status.Errorf(codes.Internal, "create snapshot from(%s) failed with %v, accountName: %q", sourceVolumeID, err, accountName)
10011005
}

0 commit comments

Comments
 (0)