Skip to content

Commit 374a99f

Browse files
authored
Merge pull request #72553 from aspauldi/CNV-28093
CNV-28093: DOC: Cloning strategies and how to check which one was used
2 parents 037c9a8 + 994c93e commit 374a99f

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed

modules/virt-about-cloning.adoc

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
----

virt/virtual_machines/creating_vms_custom/virt-creating-vms-by-cloning-pvcs.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ toc::[]
88

99
You can create virtual machines (VMs) by cloning existing persistent volume claims (PVCs) with custom images.
1010

11-
You clone a PVC by creating a data volume that references a source PVC.
12-
1311
You must install the xref:../../../virt/virtual_machines/creating_vms_custom/virt-installing-qemu-guest-agent.adoc#virt-installing-qemu-guest-agent[QEMU guest agent] on VMs created from operating system images that are not provided by Red Hat.
1412

13+
You clone a PVC by creating a data volume that references a source PVC.
14+
15+
include::modules/virt-about-cloning.adoc[leveloffset=+1]
1516
include::modules/virt-creating-vm-custom-image-web.adoc[leveloffset=+1]
1617

1718
[id="creating-vm-by-cloning-pvcs-cli"]

0 commit comments

Comments
 (0)