Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1909023

Summary: volumesnapshotconent RESTORESIZE is not a human readable way
Product: OpenShift Container Platform Reporter: Qin Ping <piqin>
Component: StorageAssignee: Christian Huffman <chuffman>
Storage sub component: Kubernetes External Components QA Contact: Qin Ping <piqin>
Status: CLOSED WONTFIX Docs Contact:
Severity: low    
Priority: unspecified CC: aos-bugs, chuffman
Version: 4.7   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-05 19:21:08 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 Qin Ping 2020-12-18 08:25:50 UTC
Description of problem:
volumesnapshotconent RESTORESIZE is not a human readable way


Version-Release number of selected component (if applicable):
4.7.0-0.nightly-2020-12-17-201522

How reproducible:
Always

Steps to Reproduce:
1. Create a volumesnapshot object with:
$ cat snapshot.yaml 
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
  name: mysnapshot
spec:
  volumeSnapshotClassName: csi-snapshotclass
  source:
    persistentVolumeClaimName: test-pvc-6
$ oc get volumesnapshotsnapshot
$ oc get volumesnapshotcontent
NAME                                               READYTOUSE   RESTORESIZE   DELETIONPOLICY   DRIVER            VOLUMESNAPSHOTCLASS   VOLUMESNAPSHOT   AGE
snapcontent-986f25b5-e282-44be-8961-3a1389783c82   true         3221225472    Delete           ebs.csi.aws.com   csi-snapshotclass     mysnapshot       12s



Actual results:
RESTORESIZE is 3221225472


Expected results:
RESTORESIZE is the same with pvc capacity: 3Gi
$ oc get pvc
NAME         STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS        AGE
test-pvc-6   Bound    pvc-a40d2f9a-e986-42ad-93e3-0bfbfbb67ac9   3Gi        RWO            gp2-csi-immediate   5m25s

Additional info:

Comment 2 Christian Huffman 2021-01-05 19:21:08 UTC
I've looked into this a bit further. The underlying reason for the discrepancy is the API type:

VolumeSnapshotStatus definition:
	RestoreSize *resource.Quantity `json:"restoreSize,omitempty" protobuf:"bytes,4,opt,name=restoreSize"`

VolumeSnapshotContentStatus definition
	RestoreSize *int64 `json:"restoreSize,omitempty" protobuf:"bytes,3,opt,name=restoreSize"`

When we use `oc get` we're simply displaying the value stored in the object. In addition, we can't perform any calculations through the `kubebuilder:printcolumn` that is used to display these values with `oc get`. The value in the content is directly from the CSI driver, and we're simply reporting it here.

I'm going to close this as WONTFIX for the time being. The VolumeSnapshot is designed for the user (and is reporting in a human-readable format), whereas the VolumeSnapshotContent should only be used by admins, and we don't have a way to cleanly present the value at this time.