kubernetes-sigs / vsphere-csi-driver

vSphere storage Container Storage Interface (CSI) plugin
https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/index.html
Apache License 2.0
293 stars 177 forks source link

Update reserve to 0 in CNSVolumeOperationRequest on create snapshot completion #2965

Closed nikhilbarge closed 1 month ago

nikhilbarge commented 1 month ago

What this PR does / why we need it: Update reserve to 0 in CNSVolumeOperationRequest on create snapshot completion

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Testing done: Manual testing done.

root@420e33d19796412054b9c95a707aef4f [ ~ ]# kubectl get volumesnapshot -A
NAMESPACE             NAME                                       READYTOUSE   SOURCEPVC                 SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS                SNAPSHOTCONTENT                                    CREATIONTIME   AGE
storage-policy-test   example-vanilla-rwo-filesystem-snapshot    true         example-vanilla-rwo-pvc                           1Gi           volumesnapshotclass-delete   snapcontent-b480a4e7-3314-4160-ad3e-5ccec5b37b5a   6d5h           6d5h
storage-policy-test   example-vanilla-rwo-filesystem-snapshot2   true         example-vanilla-rwo-pvc                           1Gi           volumesnapshotclass-delete   snapcontent-3df78dae-10e6-49cb-ae73-d3f0e06da628   6d             6d
root@420e33d19796412054b9c95a707aef4f [ ~ ]# kubectl apply -f volsnap4.yaml -n storage-policy-test
volumesnapshot.snapshot.storage.k8s.io/example-vanilla-rwo-filesystem-snapshot4 created
root@420e33d19796412054b9c95a707aef4f [ ~ ]# kubectl get volumesnapshot -A
NAMESPACE             NAME                                       READYTOUSE   SOURCEPVC                 SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS                SNAPSHOTCONTENT                                    CREATIONTIME   AGE
storage-policy-test   example-vanilla-rwo-filesystem-snapshot    true         example-vanilla-rwo-pvc                           1Gi           volumesnapshotclass-delete   snapcontent-b480a4e7-3314-4160-ad3e-5ccec5b37b5a   6d5h           6d5h
storage-policy-test   example-vanilla-rwo-filesystem-snapshot2   true         example-vanilla-rwo-pvc                           1Gi           volumesnapshotclass-delete   snapcontent-3df78dae-10e6-49cb-ae73-d3f0e06da628   6d             6d
storage-policy-test   example-vanilla-rwo-filesystem-snapshot4   true         example-vanilla-rwo-pvc                           1Gi           volumesnapshotclass-delete   snapcontent-c14d8f9f-c370-4e3e-ad84-b56f7824298e   2m25s          56s
root@420e33d19796412054b9c95a707aef4f [ ~ ]# kubectl get cnsvolumeoperationrequests.cns.vmware.com -n  vmware-system-csi 
NAME                                                                                 AGE
pvc-1c5a9e51-731c-4151-9e18-442b41209a2d                                             12d
pvc-6596fdf9-5d5f-4631-a93b-b8610d831726                                             11d
pvc-97dee485-3176-41a7-b692-d9c81af776ad                                             13d
pvc-e52e70c8-7b65-4eb6-ac72-a9bfb684f132                                             13d
pvc-e848fed4-7809-4623-a354-3bdbda9c2040                                             13d
snapshot-3df78dae-10e6-49cb-ae73-d3f0e06da628-626443ec-791f-4c9e-a8fd-d0539539dcf9   6d
snapshot-b480a4e7-3314-4160-ad3e-5ccec5b37b5a-626443ec-791f-4c9e-a8fd-d0539539dcf9   6d5h
snapshot-c14d8f9f-c370-4e3e-ad84-b56f7824298e-626443ec-791f-4c9e-a8fd-d0539539dcf9   70s
root@420e33d19796412054b9c95a707aef4f [ ~ ]#  kubectl get cnsvolumeoperationrequests.cns.vmware.com -n  vmware-system-csi  snapshot-c14d8f9f-c370-4e3e-ad84-b56f7824298e-626443ec-791f-4c9e-a8fd-d0539539dcf9 -o yaml
apiVersion: cns.vmware.com/v1alpha1
kind: CnsVolumeOperationRequest
metadata:
  creationTimestamp: "2024-07-23T19:26:51Z"
  generation: 2
  name: snapshot-c14d8f9f-c370-4e3e-ad84-b56f7824298e-626443ec-791f-4c9e-a8fd-d0539539dcf9
  namespace: vmware-system-csi
  resourceVersion: "13091113"
  uid: 5f460277-831a-4236-96da-68f748c73fcf
spec:
  name: snapshot-c14d8f9f-c370-4e3e-ad84-b56f7824298e-626443ec-791f-4c9e-a8fd-d0539539dcf9
status:
  firstOperationDetails:
    opId: c3f473ce
    taskId: task-7979
    taskInvocationTimestamp: "2024-07-23T19:26:51Z"
    taskStatus: Success
  latestOperationDetails:
  - opId: c3f473ce
    taskId: task-7979
    taskInvocationTimestamp: "2024-07-23T19:26:51Z"
    taskStatus: Success
  quotaDetails:
    aggregatedsnapshotsize: "103"
    namespace: storage-policy-test
    reserved: "0"
    snapshotlatestoperationcompletetime: "2024-07-23T19:25:21Z"
    storageClassName: wcp-profile-c6rt9t0cli
    storagePolicyId: 43333687-ec93-4e67-a5bc-5fa84c4f3f9b
  snapshotID: df3eb5f4-fd22-49bd-8780-86913656c985
  volumeID: 626443ec-791f-4c9e-a8fd-d0539539dcf9

controller logs for create snapshot: create_snap_update_reserved_cnsvoloprationreq.log

Special notes for your reviewer:

Release note:

Update reserve to 0 in CNSVolumeOperationRequest on create snapshot completion
k8s-ci-robot commented 1 month ago

Hi @nikhilbarge. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
deepakkinni commented 1 month ago

/ok-to-test

deepakkinni commented 1 month ago

/approve

xing-yang commented 1 month ago

Can you provide testing results?

nikhilbarge commented 1 month ago

Can you provide testing results?

updated logs and details of testing performed

xing-yang commented 1 month ago

/lgtm /approve

k8s-ci-robot commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepakkinni, nikhilbarge, xing-yang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/vsphere-csi-driver/blob/master/OWNERS)~~ [deepakkinni,xing-yang] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment