kubernetes-csi / external-snapshotter

Sidecar container that watches Kubernetes Snapshot CRD objects and triggers CreateSnapshot/DeleteSnapshot against a CSI endpoint.
Apache License 2.0
471 stars 363 forks source link

Questions About the restoreSize field of VolumeSnapshot status #1032

Closed Encounter77 closed 5 months ago

Encounter77 commented 5 months ago

What happened:

I want to ask, how should the restoreSize under status in VolumeSnapshot be understood, and how should the capacity of new PVC be set when doing snapshot recovery? Is there any relevant specification definition or constraint?

A review of the documentation did not find any set requirements or constraints on the capacity, except that it should not be less than the restoreSize value. https://kubernetes-csi.github.io/docs/api/volume-snapshot.html?highlight=restoreSize#snapshot.storage.k8s.io/v1.VolumeSnapshotSpec

What you expected to happen:

The status of snapshot recovery volume PVC should not be Pending.

How to reproduce it:

  1. First, I created a PVC-A with a capacity of 1Gi
  2. Based on this PVC-A, I make snapshot A, and snapshot readyToUse is true
  3. Next, I expanded the PVC-A, increasing the capacity from 1Gi to 2Gi
  4. restore the SNAPSHOT A, configuration, in the new PVC (PVC - A - the SNAPSHOT), its spec. Resources. Requests. Storage should be how to set up, I met the following A few questions

Question 1 If I set it to 500Mi, when I create this new PVC (PVC-a-snapshot), its status is Pending and its event is:

failed to provision volume with StorageClass "sc-cephfs-p ublic": error getting handle for DataSource Type VolumeSnapshot by Name volume-snapshot-a : requested volume size 524288000 is less than the size 1073741824 for the source snapshot volume-sn apshot-34

Question 2 If I set it to 1Gi, when I create this new PVC (PVC-a-snapshot), its status is Pending and its event is:

failed to provision volume with StorageClass "sc-cephfs-p ublic": rpc error: code = InvalidArgument desc = cannot restore from snapshot 0001-0024-f5ce1382-89b3-11ee-b4e7-09835dada8ce-0000000000000001-2a44e850-e01a-11ee-973c-fa163e14a5b9: volume size 2147483648 is smaller than source volume size 1073741824

Question 3 If I set it to greater than 1Gi (e.g. 1560Mi), A new PVC (PVC-a-snapshot) can be created successfully and bound to PV, with status to see that its capacity is 2Gi.

Question 4 If I set it equal to 2Gi (the size of the source PVC after expansion), A new PVC (PVC-a-snapshot) can be created successfully and bound to PV, checking status to see that its capacity is 2Gi. In this context, I can also set a value of 3Gi or greater, and the phenomenon is also described above.

Anything else we need to know?:

How should I set the capacity size of the snapshot recovery volume PVC to meet the usage requirements, is it recommended that it should be larger than the PVC capacity of the source volume?

Environment:

Madhu-1 commented 5 months ago

I want to ask, how should the restoreSize under status in VolumeSnapshot be understood, and how should the capacity of new PVC be set when doing snapshot recovery? Is there any relevant specification definition or constraint?

This will be the minimal size from which you can create a PVC, you can also create PVC with higher size where csi driver can handle the resize internal or fail

If I set it to 1Gi, when I create this new PVC (PVC-a-snapshot), its status is Pending and its event is: failed to provision volume with StorageClass "sc-cephfs-p ublic": rpc error: code = InvalidArgument desc = cannot restore from snapshot 0001-0024-f5ce1382-89b3-11ee-b4e7-09835dada8ce-0000000000000001-2a44e850-e01a-11ee-973c-fa163e14a5b9: volume size 2147483648 is smaller than source volume size 1073741824

This could be a problem with csi driver, as this is cephcsi, this is fixed few releases back, please feel to test latest build and file with ceph-csi

Encounter77 commented 5 months ago

I want to ask, how should the restoreSize under status in VolumeSnapshot be understood, and how should the capacity of new PVC be set when doing snapshot recovery? Is there any relevant specification definition or constraint?

This will be the minimal size from which you can create a PVC, you can also create PVC with higher size where csi driver can handle the resize internal or fail

If I set it to 1Gi, when I create this new PVC (PVC-a-snapshot), its status is Pending and its event is: failed to provision volume with StorageClass "sc-cephfs-p ublic": rpc error: code = InvalidArgument desc = cannot restore from snapshot 0001-0024-f5ce1382-89b3-11ee-b4e7-09835dada8ce-0000000000000001-2a44e850-e01a-11ee-973c-fa163e14a5b9: volume size 2147483648 is smaller than source volume size 1073741824

This could be a problem with csi driver, as this is cephcsi, this is fixed few releases back, please feel to test latest build and file with ceph-csi

thanks bro, I find this issue: https://github.com/ceph/ceph-csi/issues/3147. I will upgrade csi-driver version and try again!