nvmeof: add volume cloning capability - #6277
Conversation
There was a problem hiding this comment.
Pull request overview
This PR starts enabling NVMe-oF volume cloning by advertising the CSI CLONE_VOLUME controller capability and passing clone-related CreateVolume requests through to the RBD backend, while adding debug logging for clone sources.
Changes:
- Adds
RPC_CLONE_VOLUMEto the NVMe-oF controller capabilities. - Logs whether
CreateVolumeis using a snapshot or volume content source. - Documents that clone handling is delegated to the RBD backend.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/nvmeof/driver/driver.go |
Advertises NVMe-oF support for CSI volume cloning. |
internal/nvmeof/controller/controllerserver.go |
Adds clone-source debug logging before delegating CreateVolume to the RBD backend. |
| csi.ControllerServiceCapability_RPC_MODIFY_VOLUME, | ||
| csi.ControllerServiceCapability_RPC_EXPAND_VOLUME, | ||
| csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT, | ||
| csi.ControllerServiceCapability_RPC_CLONE_VOLUME, |
There was a problem hiding this comment.
Please include an e2e test for cloning with this PR, thanks!
There was a problem hiding this comment.
I missed that. I am on it!
7fa3701 to
b17c26b
Compare
30739de to
446ca9a
Compare
| err = createPVCAndvalidatePV(f.ClientSet, sourcePVC, deployTimeout) | ||
| Expect(err).ShouldNot(HaveOccurred()) | ||
|
|
||
| ginkgo.By("Binding source PVC to an application") |
There was a problem hiding this comment.
you don't need to bind the source volume to an app, that is validated in other tests already too.
There was a problem hiding this comment.
ohh ok I can remove it. I thought you want both to be bind to app .
I will remove it after the test will be finish
There was a problem hiding this comment.
Having both is ok, but not required. The cloned volume needs complete testing.
The current PR is fine by me, no need to update it unless there is something else you want to improve too.
There was a problem hiding this comment.
ok, I will keep it as is.
looks like the cloning test passed!
�[1mSTEP:�[0m Creating a clone of the source PVC �[38;5;243m@ 06/08/26 13:16:31.494�[0m
I0608 13:16:31.498376 79259 pvc.go:61] Waiting up to &PersistentVolumeClaim{ObjectMeta:{nvmeof-pvc-clone nvmeof-3536 0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] [] []},Spec:PersistentVolumeClaimSpec{AccessModes:[ReadWriteOnce],Resources:VolumeResourceRequirements{Limits:ResourceList{},Requests:ResourceList{storage: {{67108864 0} {<nil>} BinarySI},},},VolumeName:,Selector:nil,StorageClassName:*e2e-nvmeof-7592-sc,VolumeMode:nil,DataSource:&TypedLocalObjectReference{APIGroup:nil,Kind:PersistentVolumeClaim,Name:nvmeof-pvc,},DataSourceRef:nil,VolumeAttributesClassName:nil,},Status:PersistentVolumeClaimStatus{Phase:,AccessModes:[],Capacity:ResourceList{},Conditions:[]PersistentVolumeClaimCondition{},AllocatedResources:ResourceList{},AllocatedResourceStatuses:map[ResourceName]ClaimResourceStatus{},CurrentVolumeAttributesClassName:nil,ModifyVolumeStatus:nil,},} to be in Bound state
I0608 13:16:31.498423 79259 pvc.go:64] waiting for PVC nvmeof-pvc-clone (0 seconds elapsed)
I0608 13:16:33.499329 79259 pvc.go:64] waiting for PVC nvmeof-pvc-clone (2 seconds elapsed)
I0608 13:16:33.503706 79259 pvc.go:86] PVC nvmeof-pvc-clone Event: Provisioning - External provisioner is provisioning volume for claim "nvmeof-3536/nvmeof-pvc-clone"
I0608 13:16:33.503736 79259 pvc.go:86] PVC nvmeof-pvc-clone Event: ExternalProvisioning - Waiting for a volume to be created either by the external provisioner 'nvmeof.csi.ceph.com' or manually by the system administrator. If volume creation is delayed, please verify that the provisioner is running and correctly registered.
I0608 13:16:35.499332 79259 pvc.go:64] waiting for PVC nvmeof-pvc-clone (4 seconds elapsed)
I0608 13:16:35.503453 79259 pv.go:468] Waiting for PV pvc-ff99cd28-102e-47fc-8d14-8aaec7c9a280 to bind to PVC nvmeof-pvc-clone
I0608 13:16:35.503551 79259 pv.go:790] Waiting up to timeout=10m0s for PersistentVolumeClaims [nvmeof-pvc-clone] to have phase Bound
I0608 13:16:35.505343 79259 pv.go:801] PersistentVolumeClaim nvmeof-pvc-clone found and phase=Bound (1.770669ms)
I0608 13:16:35.505377 79259 pv.go:763] Waiting up to 10m0s for PersistentVolume pvc-ff99cd28-102e-47fc-8d14-8aaec7c9a280 to have phase Bound
I0608 13:16:35.507083 79259 pv.go:771] PersistentVolume pvc-ff99cd28-102e-47fc-8d14-8aaec7c9a280 found and phase=Bound (1.688721ms)
�[1mSTEP:�[0m Binding clone PVC to an application �[38;5;243m@ 06/08/26 13:16:35.51�[0m
I0608 13:16:35.514333 79259 warnings.go:107] "Warning: would violate PodSecurity \"restricted:latest\": allowPrivilegeEscalation != false (container \"web-server\" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container \"web-server\" must set securityContext.capabilities.drop=[\"ALL\"]), runAsNonRoot != true (pod or container \"web-server\" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container \"web-server\" must set securityContext.seccompProfile.type to \"RuntimeDefault\" or \"Localhost\")"
I0608 13:16:35.514428 79259 pod.go:377] Waiting up to 10m0s for csi-nvmeof-demo-pod-clone to be in Running state
�[1mSTEP:�[0m Deleting the clone application and PVC �[38;5;243m@ 06/08/26 13:16:41.518�[0m
|
/test ci/centos/mini-e2e/k8s-1.35/nvmeof |
|
| } | ||
|
|
||
| // Lock source volume to prevent concurrent deletion | ||
| if sourceVolumeID != "" { |
There was a problem hiding this comment.
lock on snapshot is not required?
There was a problem hiding this comment.
Hi @Madhu-1 , I missed your comment here.
There is no need lock at nvmeof level for snapshot because the nvmeof snapshot call directly to rbd snapshot function..(and the rbd call has lock for that here- #6322). there are no more ops.
However, the cloning (which is running in CreateVolume()) call has nvmeof ops , so here need to use lock, prevent cloning + delete race
|
This pull request now has conflicts with the target branch. Could you please resolve conflicts and force push the corrected changes? 🙏 |
446ca9a to
9ea69b7
Compare
|
/queue |
|
@Mergifyio rebase |
🛑 The pull request rule doesn't match anymoreDetailsThis action has been cancelled. |
enable volume cloning support for nvmeof CSI driver by declaring CLONE_VOLUME capability. The RBD backend automatically handles all clone operations (snapshot-to-volume restore and volume-to-volume cloning) when VolumeContentSource is present in CreateVolume request. The NVMeoF driver adds debug logging to track clone operations and creates namespaces pointing to the cloned RBD images. No changes to the NVMeoF gateway are required since clones are transparent at the block device level. Signed-off-by: gadi-didi <gadi.didi@ibm.com>
Add basic e2e test to validate PVC cloning functionality for nvmeof. Test creates a source PVC, clones it using DataSource, and verifies both can be deleted successfully. Signed-off-by: gadi-didi <gadi.didi@ibm.com>
007bda5 to
75e043f
Compare
|
/test ci/centos/k8s-e2e-external-storage/1.35 |
|
/test ci/centos/mini-e2e-helm/k8s-1.35 |
|
/test ci/centos/k8s-e2e-external-storage/1.34 |
|
/test ci/centos/mini-e2e/k8s-1.35 |
|
/test ci/centos/mini-e2e-helm/k8s-1.34 |
|
/test ci/centos/mini-e2e/k8s-1.34 |
|
/test ci/centos/k8s-e2e-external-storage/1.36 |
|
/test ci/centos/mini-e2e-helm/k8s-1.36 |
|
/test ci/centos/mini-e2e/k8s-1.36 |
|
/test ci/centos/upgrade-tests-cephfs |
|
/test ci/centos/upgrade-tests-rbd |
|
/test ci/centos/mini-e2e/k8s-1.35 |
|
Deprecation notice: This pull request comes from a fork and was queued with |
Merge Queue Status
This pull request spent 26 seconds in the queue, including 5 seconds running CI. Required conditions to merge
|
enable volume cloning support for nvmeof CSI driver by declaring CLONE_VOLUME capability. The RBD backend automatically handles all clone operations (snapshot-to-volume restore and volume-to-volume cloning) when VolumeContentSource is present in CreateVolume request.
The NVMeoF driver adds debug logging to track clone operations and creates namespaces pointing to the cloned RBD images. No changes to the NVMeoF gateway are required since clones are transparent at the block device level.
Need to test it!
Checklist:
guidelines in the developer
guide.
Request
notes
updated with breaking and/or notable changes for the next major release.
Show available bot commands
These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:
/retest ci/centos/<job-name>: retest the<job-name>after unrelatedfailure (please report the failure too!)