Bug 1909023 - volumesnapshotconent RESTORESIZE is not a human readable way
Summary: volumesnapshotconent RESTORESIZE is not a human readable way
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Storage
Version: 4.7
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ---
Assignee: Christian Huffman
QA Contact: Qin Ping
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-18 08:25 UTC by Qin Ping
Modified: 2021-01-05 19:21 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-05 19:21:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


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