-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clone): add support for creating the Clone from volume as datasource #234
Conversation
86058ec
to
0b0ae0e
Compare
Codecov Report
@@ Coverage Diff @@
## master #234 +/- ##
=========================================
- Coverage 8.50% 8.27% -0.24%
=========================================
Files 20 20
Lines 1046 1076 +30
=========================================
Hits 89 89
- Misses 956 986 +30
Partials 1 1
Continue to review full report at Codecov.
|
10565f5
to
e78de3f
Compare
…urce We can now create the Clone from pvc directly ``` kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc-clone spec: storageClassName: openebs-snap dataSource: name: pvc-snap kind: PersistentVolumeClaim accessModes: - ReadWriteOnce resources: requests: storage: 4Gi ``` The ZFS_LocalPV driver will create one internal snapshot of the name same as the new volume name and will create a clone out of it. Also, while destroying the volume the driver will take care of deleting the created snapshot for the clone. Signed-off-by: Pawan <[email protected]>
@pawanpraka1 - what happens in the following case:
Will pvc2 (and its PV) still exist? |
Yes @kmova, pvc2 and it's pv will be there. Also zfs volume created for pvc1 will also be there and it will be cleaned up automatically when we delete pvc2. |
pkg/driver/controller.go
Outdated
|
||
selected := vol.Spec.OwnerNodeID | ||
|
||
labels := map[string]string{zfs.ZFSVolKey: vol.Name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a more explicit key - like "source-zfs-volume"?
|
||
klog.Infof("destroying snapshot %s@%s for the clone %s", srcVol, snap.Name, volume) | ||
|
||
err := DestroySnapshot(snap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is where the source volume needs to be cleaned up, in case this was the last clone/snapshot being deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, not for the last clone/snapshot being deleted, every clone will have a corresponsing snapshot. So when we are deleting the clone volume, we should delete the corresponding snapshot here.
Signed-off-by: Pawan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR will be followed up documentation updates and better log management in case of error cases.
Why is this PR required? What issue does it fix?:
add support for creating the Clone from volume as datasource
What this PR does?:
We can now create the Clone from pvc directly
The ZFS_LocalPV driver will create one internal snapshot of the name
same as the new volume name and will create a clone out of it. Also,
while destroying the volume the driver will take care of deleting
the created snapshot for the clone.
Checklist:
<type>(<scope>): <subject>