Bug 2037622 - [4.10-Alibaba CSI driver][Restore size for volumesnapshot/volumesnapshotcontent is showing as 0 in Snapshot feature for Alibaba platform]
Summary: [4.10-Alibaba CSI driver][Restore size for volumesnapshot/volumesnapshotconte...
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Storage
Version: 4.10
Hardware: All
OS: All
Target Milestone: ---
: 4.10.0
Assignee: Jan Safranek
QA Contact: Rohit Patil
Depends On:
TreeView+ depends on / blocked
Reported: 2022-01-06 07:00 UTC by Rohit Patil
Modified: 2022-03-10 16:37 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2022-03-10 16:37:12 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github openshift alibaba-cloud-csi-driver pull 8 0 None open Bug 2037622: UPSTREAM: 590: Add pvc size to snapshot restore size 2022-01-21 08:12:08 UTC
Red Hat Product Errata RHSA-2022:0056 0 None None None 2022-03-10 16:37:22 UTC

Description Rohit Patil 2022-01-06 07:00:40 UTC
Created attachment 1849161 [details]

Restore size for volumesnapshot/volumesnapshotcontent is showing as 0 in Snapshot feature for Alibaba platform

Version-Release number of selected component (if applicable):

How reproducible:

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. 

rohitpatil@ropatil-mac snapshot % oc get sc
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   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
- apiVersion: snapshot.storage.k8s.io/v1
  kind: VolumeSnapshot
    creationTimestamp: "2022-01-06T06:07:57Z"
    - 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
      persistentVolumeClaimName: fs-pvc
    volumeSnapshotClassName: snapclass
    boundVolumeSnapshotContentName: snapcontent-d7476b51-e6e0-4f66-aeb6-a7e00f855286
    creationTime: "2022-01-06T06:07:57Z"
    readyToUse: true
    restoreSize: "0"
kind: List
  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.

Comment 2 Jan Safranek 2022-01-07 10:25:03 UTC
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.

Comment 3 Wei Duan 2022-01-07 10:35:30 UTC
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).

Comment 5 bteng 2022-01-21 07:48:42 UTC
This upstream PR has been merged.

Comment 12 errata-xmlrpc 2022-03-10 16:37:12 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.