1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-about-cloning.adoc
2025-11-18 16:29:25 +01:00

68 lines
3.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/virtual_machines/virt-creating-vms-by-cloning-pvcs.adoc
:_mod-docs-content-type: CONCEPT
[id="virt-about-cloning_{context}"]
= About cloning
[role="_abstract"]
When cloning a data volume, the Containerized Data Importer (CDI) chooses one of the Container Storage Interface (CSI) clone methods: CSI volume cloning or smart cloning. Both methods are efficient but have certain requirements. 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.
[id="csi-volume-cloning_{context}"]
== CSI volume cloning
Container Storage Interface (CSI) cloning uses CSI driver features to more efficiently clone a source data volume.
CSI volume cloning has the following requirements:
* The CSI driver that backs the storage class of the persistent volume claim (PVC) must support volume cloning.
* For provisioners not recognized by the CDI, the corresponding storage profile must have the `cloneStrategy` set to CSI Volume Cloning.
* The source and target PVCs must have the same storage class and volume mode.
* If you create the data volume, you must have permission to create the `datavolumes/source` resource in the source namespace.
* The source volume must not be in use.
[id="smart-cloning_{context}"]
== Smart cloning
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.
Smart cloning has the following requirements:
* A snapshot class associated with the storage class must exist.
* The source and target PVCs must have the same storage class and volume mode.
* If you create the data volume, you must have permission to create the `datavolumes/source` resource in the source namespace.
* The source volume must not be in use.
[id="host-assisted-cloning_{context}"]
== Host-assisted cloning
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.
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.
Example PVC target annotation:
[source,yaml]
----
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
cdi.kubevirt.io/cloneFallbackReason: The volume modes of source and target are incompatible
cdi.kubevirt.io/clonePhase: Succeeded
cdi.kubevirt.io/cloneType: copy
----
Example event:
[source,terminal]
----
NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE
test-ns 0s Warning IncompatibleVolumeModes persistentvolumeclaim/test-target The volume modes of source and target are incompatible
----