|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * virt/virtual_machines/virt-creating-vms-by-cloning-pvcs.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: CONCEPT |
| 6 | +[id="virt-about-cloning_{context}"] |
| 7 | += About cloning |
| 8 | + |
| 9 | +When cloning a data volume, the Containerized Data Importer (CDI) chooses one of the following Container Storage Interface (CSI) clone methods: |
| 10 | + |
| 11 | +* CSI volume cloning |
| 12 | +* Smart cloning |
| 13 | +
|
| 14 | +Both CSI volume cloning and smart cloning methods are efficient, but they have certain requirements for use. If the requirements are not met, the CDI uses host-assisted cloning. Host-assisted cloning is the slowest and least efficient method of cloning, but it has fewer requirements than either of the other two cloning methods. |
| 15 | + |
| 16 | +[id="csi-volume-cloning_{context}"] |
| 17 | +== CSI volume cloning |
| 18 | + |
| 19 | +Container Storage Interface (CSI) cloning uses CSI driver features to more efficiently clone a source data volume. |
| 20 | + |
| 21 | +CSI volume cloning has the following requirements: |
| 22 | + |
| 23 | +* The CSI driver that backs the storage class of the persistent volume claim (PVC) must support volume cloning. |
| 24 | +* For provisioners not recognized by the CDI, the corresponding storage profile must have the `cloneStrategy` set to CSI Volume Cloning. |
| 25 | +* The source and target PVCs must have the same storage class and volume mode. |
| 26 | +* If you create the data volume, you must have permission to create the `datavolumes/source` resource in the source namespace. |
| 27 | +* The source volume must not be in use. |
| 28 | + |
| 29 | + |
| 30 | +[id="smart-cloning_{context}"] |
| 31 | +== Smart cloning |
| 32 | + |
| 33 | +When a Container Storage Interface (CSI) plugin with snapshot capabilities is available, the Containerized Data Importer (CDI) creates a persistent volume claim (PVC) from a snapshot, which then allows efficient cloning of additional PVCs. |
| 34 | + |
| 35 | +Smart cloning has the following requirements: |
| 36 | + |
| 37 | +* A snapshot class associated with the storage class must exist. |
| 38 | +* The source and target PVCs must have the same storage class and volume mode. |
| 39 | +* If you create the data volume, you must have permission to create the `datavolumes/source` resource in the source namespace. |
| 40 | +* The source volume must not be in use. |
| 41 | + |
| 42 | + |
| 43 | +[id="host-assisted-cloning_{context}"] |
| 44 | +== Host-assisted cloning |
| 45 | + |
| 46 | +When the requirements for neither Container Storage Interface (CSI) volume cloning nor smart cloning have been met, host-assisted cloning is used as a fallback method. Host-assisted cloning is less efficient than either of the two other cloning methods. |
| 47 | + |
| 48 | +Host-assisted cloning uses a source pod and a target pod to copy data from the source volume to the target volume. The target persistent volume claim (PVC) is annotated with the fallback reason that explains why host-assisted cloning has been used, and an event is created. |
| 49 | + |
| 50 | +.Example PVC target annotation |
| 51 | + |
| 52 | +[source,yaml] |
| 53 | +---- |
| 54 | +apiVersion: v1 |
| 55 | +kind: PersistentVolumeClaim |
| 56 | +metadata: |
| 57 | + annotations: |
| 58 | + cdi.kubevirt.io/cloneFallbackReason: The volume modes of source and target are incompatible |
| 59 | + cdi.kubevirt.io/clonePhase: Succeeded |
| 60 | + cdi.kubevirt.io/cloneType: copy |
| 61 | +---- |
| 62 | + |
| 63 | +.Example event |
| 64 | + |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE |
| 68 | +test-ns 0s Warning IncompatibleVolumeModes persistentvolumeclaim/test-target The volume modes of source and target are incompatible |
| 69 | +---- |
0 commit comments