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

Azure File snapshot size is set to 100Gi regardless of storage account type #2039

Closed
RomanBednar opened this issue Aug 5, 2024 · 2 comments · Fixed by #2040
Closed

Azure File snapshot size is set to 100Gi regardless of storage account type #2039

RomanBednar opened this issue Aug 5, 2024 · 2 comments · Fixed by #2040

Comments

@RomanBednar
Copy link
Contributor

For Azure File sets snapshot size to 100Gi in csi.CreateSnapshotResponse without checking account type/tier:
https://github.com/openshift/azure-file-csi-driver/blob/2017ebe042618aab18392692e9a19413f586a19b/pkg/azurefile/controllerserver.go#L921

Azure Disk sets snapshot size correctly in the response based on the actual size:
https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/96bdedac083ca6df9470293d4498119047fe1bb8/pkg/azureutils/azure_snapshot_utils.go#L51

Example in documentation uses 100Gi volumes and premium storage class, in this case everything works fine: https://github.com/kubernetes-sigs/azurefile-csi-driver/tree/master/deploy/example/snapshot#azure-file-snapshot-feature

However this size is not correct when using standard account type and it should be possible to create snapshots of smaller size.

Driver log (snapshot creation):

I0805 13:50:54.050814       1 utils.go:101] GRPC call: /csi.v1.Controller/CreateSnapshot
I0805 13:50:54.050834       1 utils.go:102] GRPC request: {"name":"snapshot-1ebb9e21-d812-4849-9288-c89fd42f0b83","source_volume_id":"rbednar-mycluster-01-2wzgp-rg#f1de35e2654d34a73bbbb1a#pvc-bc5487c9-9f5e-4bb4-9c75-189556b376b3###default"}
I0805 13:50:54.558181       1 controllerserver.go:915] created share snapshot: 2024-08-05T13:50:54.0000000Z, time: 2024-08-05 13:50:54 +0000 UTC, quota: 0GiB
I0805 13:50:54.558239       1 utils.go:108] GRPC response: {"snapshot":{"creation_time":{"seconds":1722865854},"ready_to_use":true,"size_bytes":107374182400,"snapshot_id":"rbednar-mycluster-01-2wzgp-rg#f1de35e2654d34a73bbbb1a#pvc-bc5487c9-9f5e-4bb4-9c75-189556b376b3###default#2024-08-05T13:50:54.0000000Z","source_volume_id":"rbednar-mycluster-01-2wzgp-rg#f1de35e2654d34a73bbbb1a#pvc-bc5487c9-9f5e-4bb4-9c75-189556b376b3###default"}}

Origin PVC is 1Gi but snapshot is 100Gi:

$ oc get pvc
NAME    STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS    VOLUMEATTRIBUTESCLASS   AGE
pvc-1   Bound    pvc-bc5487c9-9f5e-4bb4-9c75-189556b376b3   1Gi        RWO            azurefile-csi   <unset>                 4m31s


$ oc get volumesnapshot
NAME             READYTOUSE   SOURCEPVC   SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS       SNAPSHOTCONTENT                                    CREATIONTIME   AGE
pvc-1-snapshot   true         pvc-1                               100Gi         csi-azurefile-vsc   snapcontent-1ebb9e21-d812-4849-9288-c89fd42f0b83   115s           116s

StorageClass is set to use non-premium storage account:

$ oc get sc/azurefile-csi -o yaml
allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  creationTimestamp: "2024-08-05T09:00:36Z"
  name: azurefile-csi
  resourceVersion: "7107"
  uid: 60bbaf5e-43ac-4b2c-b82a-841c01a3624f
mountOptions:
- mfsymlinks
- cache=strict
- nosharesock
- actimeo=30
parameters:
  skuName: Standard_LRS
provisioner: file.csi.azure.com
reclaimPolicy: Delete
volumeBindingMode: Immediate

NOTE:

Due to this behavior several upstream e2e tests are failing because they use volume sizes < 100Gi and assume snapshot size the be the same as origin PVC size. Then the origin PVC size is requested while restoring a (new) PVC from snapshot and test fails because the restore size is less than 100Gi.

Example test provisioning should provision correct filesystem size when restoring snapshot to larger size pvc:

0802 15:58:12.055378 849 dump.go:53] At 2024-08-02 15:48:10 +0000 UTC - event for pvc-xtrqj: {file.csi.azure.com_azure-file-csi-driver-controller-f4c5f8c6c-qqssg_81fa4cd0-db30-4147-90ec-5a3261ab93dc } ProvisioningFailed: failed to provision volume with StorageClass "e2e-provisioning-7878-e2e-scjjwcl": error getting handle for DataSource Type VolumeSnapshot by Name snapshot-plpg4: requested volume size 6442450944 is less than the size 107374182400 for the source snapshot snapshot-plpg4
@dobsonj
Copy link
Member

dobsonj commented Aug 5, 2024

@RomanBednar apparently the driver hard codes the snapshot size to 100GiB if the share quota is not set.

@RomanBednar
Copy link
Contributor Author

Indeed, but I don't think this can be set by the user. But even if it can and I missed it, I don't understand the relation between quota (=max share size) and a size required to restore a snapshot, which is what the CSI response expects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants