Bug 2037622

Summary: [4.10-Alibaba CSI driver][Restore size for volumesnapshot/volumesnapshotcontent is showing as 0 in Snapshot feature for Alibaba platform]
Product: OpenShift Container Platform Reporter: Rohit Patil <ropatil>
Component: StorageAssignee: Jan Safranek <jsafrane>
Storage sub component: Kubernetes External Components QA Contact: Rohit Patil <ropatil>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: aos-bugs, geyingqi0701, jsafrane, ropatil, wduan
Version: 4.10   
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-10 16:37:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rohit Patil 2022-01-06 07:00:40 UTC
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.

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.

https://access.redhat.com/errata/RHSA-2022:0056