Created attachment 1849161 [details] size Restore size for volumesnapshot/volumesnapshotcontent is showing as 0 in Snapshot feature for Alibaba platform Version-Release number of selected component (if applicable): 4.10.0-0.nightly-2021-12-23-153012 How reproducible: Always Steps to Reproduce: 1. Install Alibaba cluster 2. Create sc, pvc, dep of volumeMode: Filesystem/Block, write some data(hello world) inside volume. 3. Create volumesnapshot class, volumesnapshot. 4. Check for Restoresize in volumesnapshot and volumesnapshotcontent. OP: rohitpatil@ropatil-mac snapshot % oc get sc NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE alicloud-disk (default) diskplugin.csi.alibabacloud.com Delete WaitForFirstConsumer true 25h csi-disk diskplugin.csi.alibabacloud.com Delete WaitForFirstConsumer true 10m rohitpatil@ropatil-mac snapshot % oc get pvc,pod -n testdisk -o wide NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE VOLUMEMODE persistentvolumeclaim/fs-pvc Bound pvc-41e366e9-256e-43b2-a222-70cb7f29d6c4 20Gi RWO csi-disk 11m Filesystem NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES pod/mydep-csi-d774fb65f-75bg4 1/1 Running 0 11m 10.128.2.207 ropatil51-5knh9-worker-a-g9cxx <none> <none> rohitpatil@ropatil-mac snapshot % oc get volumesnapshotclass -n testdisk NAME DRIVER DELETIONPOLICY AGE snapclass diskplugin.csi.alibabacloud.com Delete 10m rohitpatil@ropatil-mac snapshot % oc get volumesnapshot,volumesnapshotcontent -n testdisk NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE volumesnapshot.snapshot.storage.k8s.io/new-snapshot-demo true fs-pvc 0 snapclass snapcontent-d7476b51-e6e0-4f66-aeb6-a7e00f855286 10m 10m NAME READYTOUSE RESTORESIZE DELETIONPOLICY DRIVER VOLUMESNAPSHOTCLASS VOLUMESNAPSHOT VOLUMESNAPSHOTNAMESPACE AGE volumesnapshotcontent.snapshot.storage.k8s.io/snapcontent-d7476b51-e6e0-4f66-aeb6-a7e00f855286 true 0 Delete diskplugin.csi.alibabacloud.com snapclass new-snapshot-demo testdisk 10m rohitpatil@ropatil-mac snapshot % oc get volumesnapshot -n testdisk -o yaml apiVersion: v1 items: - apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: creationTimestamp: "2022-01-06T06:07:57Z" finalizers: - snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection - snapshot.storage.kubernetes.io/volumesnapshot-bound-protection generation: 1 name: new-snapshot-demo namespace: testdisk resourceVersion: "477216" uid: d7476b51-e6e0-4f66-aeb6-a7e00f855286 spec: source: persistentVolumeClaimName: fs-pvc volumeSnapshotClassName: snapclass status: boundVolumeSnapshotContentName: snapcontent-d7476b51-e6e0-4f66-aeb6-a7e00f855286 creationTime: "2022-01-06T06:07:57Z" readyToUse: true restoreSize: "0" kind: List metadata: resourceVersion: "" selfLink: "" Actual results: Restore size is showing as 0 for volumesnapshot/volumesnapshot content. Expected results: Restore size to be shown as per the requested size in pvc. Attached backend size of snapshot content which shows 20Gi.
This is complicated :-). The CSI driver has liberty to return 0, which says that the minimum PVC size to restore this snapshot is unknown. The external-snapshotter should translate it to nil instead of "0" in VolumeSnapshot.Status.RestoreSize to show that the size is unknown. I filed https://github.com/kubernetes-csi/external-snapshotter/issues/639 to fix it. On the other hand, the CSI driver *knows* the minimum size - it's the original volume size. And it should return that instead of "unknown". I am assigning this to Alibaba to fix the CSI driver. Using bteng, since Jiao Wang still does not have BZ account yet.
Thanks for the update, yes, we see other CSI Driver uses the the minimum size (original volume size) and we prefer to have this value than nil, as when we try to restore from the snapshot, we should consider the size as minimum value (in case we don't have the pvc).
issue fix by https://github.com/kubernetes-sigs/alibaba-cloud-csi-driver/pull/590/files
This upstream PR has been merged.
https://github.com/kubernetes-sigs/alibaba-cloud-csi-driver/pull/590/files
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:0056