Skip to content

Commit 8324f51

Browse files
committed
Remove PVC API examples
Signed-off-by: Avital Pinnick <[email protected]>
1 parent a7149f0 commit 8324f51

13 files changed

+106
-375
lines changed

_topic_maps/_topic_map.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,8 +3825,6 @@ Topics:
38253825
File: virt-uploading-local-disk-images-block
38263826
- Name: Managing virtual machine snapshots
38273827
File: virt-managing-vm-snapshots
3828-
- Name: Moving a local virtual machine disk to a different node
3829-
File: virt-moving-local-vm-disk-to-different-node
38303828
- Name: Expanding virtual storage by adding blank disk images
38313829
File: virt-expanding-virtual-storage-with-blank-disk-images
38323830
- Name: Cloning a data volume using smart-cloning

modules/virt-cloning-a-datavolume.adoc

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,65 @@
44

55
:_content-type: PROCEDURE
66
[id="virt-cloning-a-datavolume_{context}"]
7-
= Cloning a data volume
7+
= Smart-cloning a PVC by using the command line
88

9-
.Prerequisites
9+
You can smart-clone a persistent volume claim (PVC) by using the command line to create a `DataVolume` object.
1010

11-
For smart-cloning to occur, the following conditions are required:
11+
.Prerequisites
1212

1313
* Your storage provider must support snapshots.
14-
* The source and target PVCs must be defined to the same storage class.
15-
* The source and target PVCs share the same *volumeMode*.
16-
* The `VolumeSnapshotClass` object must reference the storage class defined to both the source and target PVCs.
14+
* The source and target PVCs must have the same storage provider and volume mode.
15+
* The value of the `driver` key of the `VolumeSnapshotClass` object must match the value of the `provisioner` key of the `StorageClass` object as shown in the following example:
16+
+
17+
.Example `VolumeSnapshotClass` object
18+
[source,yaml]
19+
----
20+
kind: VolumeSnapshotClass
21+
apiVersion: snapshot.storage.k8s.io/v1
22+
driver: openshift-storage.rbd.csi.ceph.com
23+
# ...
24+
----
25+
+
26+
.Example `StorageClass` object
27+
[source,yaml]
28+
----
29+
kind: StorageClass
30+
apiVersion: storage.k8s.io/v1
31+
# ...
32+
provisioner: openshift-storage.rbd.csi.ceph.com
33+
----
1734
1835
.Procedure
1936

20-
To initiate cloning of a data volume:
21-
22-
. Create a YAML file for a `DataVolume` object that specifies the name of the
23-
new data volume and the name and namespace of the source PVC. In this example, because you specify the *storage* API, there is no need to specify *accessModes* or *volumeMode*. The optimal values will be calculated for you automatically.
37+
. Create a YAML file for a `DataVolume` object as shown in the following example:
2438
+
2539
[source,yaml]
2640
----
2741
apiVersion: cdi.kubevirt.io/v1beta1
2842
kind: DataVolume
2943
metadata:
30-
name: <cloner-datavolume> <1>
44+
name: <datavolume> <1>
3145
spec:
3246
source:
3347
pvc:
34-
namespace: "<source-namespace>" <2>
35-
name: "<my-favorite-vm-disk>" <3>
36-
storage: <4>
37-
resources:
38-
requests:
39-
storage: <2Gi> <5>
40-
----
41-
<1> The name of the new data volume.
42-
<2> The namespace where the source PVC exists.
43-
<3> The name of the source PVC.
44-
<4> Specifies allocation with the *storage* API
45-
<5> The size of the new data volume.
48+
namespace: "<source_namespace>" <2>
49+
name: "<my_vm_disk>" <3>
50+
storage:
51+
storageClassName: <storage_class> <4>
52+
----
53+
<1> Specify the name of the new data volume.
54+
<2> Specify the namespace of the source PVC.
55+
<3> Specify the name of the source PVC.
56+
<4> Optional: If the storage class is not specified, the default storage class is used.
4657

47-
. Start cloning the PVC by creating the data volume:
58+
. Create the data volume by running the following command:
4859
+
4960
[source,terminal]
5061
----
51-
$ oc create -f <cloner-datavolume>.yaml
62+
$ oc create -f <datavolume>.yaml
5263
----
5364
+
5465
[NOTE]
5566
====
56-
Data volumes prevent a virtual machine from starting before the PVC is prepared,
57-
so you can create a virtual machine that references the new data volume while the
58-
PVC clones.
67+
Data volumes prevent a virtual machine from starting before the PVC is prepared. You can create a virtual machine that references the new data volume while the PVC is being cloned.
5968
====

modules/virt-cloning-local-volume-to-another-node.adoc

Lines changed: 0 additions & 135 deletions
This file was deleted.

modules/virt-cloning-pvc-of-vm-disk-into-new-datavolume.adoc

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,53 @@
33
// * virt/virtual_machines/cloning_vms/virt-cloning-vm-disk-into-new-datavolume.adoc
44
// * virt/virtual_machines/cloning_vms/virt-cloning-vm-disk-to-new-block-storage-pvc.adoc
55

6-
// `blockstorage` conditionals are used (declared in the "*-block" assembly) to separate content
7-
86
:_content-type: PROCEDURE
97
[id="virt-cloning-pvc-of-vm-disk-into-new-datavolume_{context}"]
10-
= Cloning the persistent volume claim of a virtual machine disk into a new data volume
8+
= Cloning the PVC of a VM disk into a new data volume
119

12-
You can clone a persistent volume claim (PVC) of an existing virtual machine disk
10+
You can clone the persistent volume claim (PVC) of an existing (virtual machine) VM disk
1311
into a new data volume. The new data volume can then be used for a new virtual
1412
machine.
1513

1614
[NOTE]
1715
====
18-
When a data volume is created independently of a virtual machine, the lifecycle
19-
of the data volume is independent of the virtual machine. If the virtual machine
20-
is deleted, neither the data volume nor its associated PVC is deleted.
16+
When a data volume is created independently of a VM, the lifecycle of the data volume is independent of the VM. If the VM is deleted, neither the data volume nor its associated PVC is deleted.
2117
====
2218

2319
.Prerequisites
2420

25-
* Determine the PVC of an existing virtual machine disk to use. You must power
26-
down the virtual machine that is associated with the PVC before you can clone it.
27-
* Install the OpenShift CLI (`oc`).
28-
ifdef::blockstorage[]
29-
* At least one available block persistent volume (PV) that is the same size as or larger than the source PVC.
30-
endif::[]
21+
* The VM must be stopped.
3122
3223
.Procedure
3324

34-
. Examine the virtual machine disk you want to clone to identify the name and
35-
namespace of the associated PVC.
36-
37-
. Create a YAML file for a data volume that specifies the name of the
38-
new data volume, the name and namespace of the source PVC,
39-
ifdef::blockstorage[]
40-
`volumeMode: Block` so that an available block PV is used,
41-
endif::[]
42-
and the size of the new data volume.
43-
+
44-
For example:
25+
. Create a YAML file for a data volume as shown in the following example:
4526
+
4627
[source,yaml]
4728
----
4829
apiVersion: cdi.kubevirt.io/v1beta1
4930
kind: DataVolume
5031
metadata:
51-
name: <cloner-datavolume> <1>
32+
name: <datavolume> <1>
5233
spec:
5334
source:
5435
pvc:
55-
namespace: "<source-namespace>" <2>
56-
name: "<my-favorite-vm-disk>" <3>
57-
pvc:
58-
accessModes:
59-
- ReadWriteOnce
60-
resources:
61-
requests:
62-
storage: <2Gi> <4>
63-
ifdef::blockstorage[]
64-
volumeMode: Block <5>
65-
endif::[]
36+
namespace: "<source_namespace>" <2>
37+
name: "<my_vm_disk>" <3>
38+
storage: {}
6639
----
67-
<1> The name of the new data volume.
68-
<2> The namespace where the source PVC exists.
69-
<3> The name of the source PVC.
70-
<4> The size of the new data volume. You must allocate enough space, or the
71-
cloning operation fails. The size must be the same as or larger than the source PVC.
72-
ifdef::blockstorage[]
73-
<5> Specifies that the destination is a block PV
74-
endif::[]
40+
<1> Specify the name of the new data volume.
41+
<2> Specify the namespace of the source PVC.
42+
<3> Specify the name of the source PVC.
7543

76-
. Start cloning the PVC by creating the data volume:
44+
. Create the data volume by running the following command:
7745
+
7846
[source,terminal]
7947
----
80-
$ oc create -f <cloner-datavolume>.yaml
48+
$ oc create -f <datavolume>.yaml
8149
----
8250
+
8351
[NOTE]
8452
====
85-
Data volumes prevent a virtual machine from starting before the PVC is prepared,
86-
so you can create a virtual machine that references the new data volume while the
87-
PVC clones.
53+
Data volumes prevent a VM from starting before the PVC is prepared. You can create a VM that references the new data volume while the
54+
PVC is being cloned.
8855
====

modules/virt-creating-an-upload-dv.adoc

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,32 @@
66
[id="virt-creating-an-upload-dv_{context}"]
77
= Creating an upload data volume
88

9-
You can manually create a data volume with an `upload` data source to use for uploading
10-
local disk images.
9+
You can manually create a data volume with an `upload` data source to upload local disk images.
1110

1211
.Procedure
1312

14-
. Create a data volume configuration that specifies `spec: source: upload{}`:
13+
. Create a data volume configuration that specifies `upload` in the `spec.source` stanza:
1514
+
16-
1715
[source,yaml]
1816
----
1917
apiVersion: cdi.kubevirt.io/v1beta1
2018
kind: DataVolume
2119
metadata:
22-
name: <upload-datavolume> <1>
20+
name: <datavolume> <1>
2321
spec:
2422
source:
25-
upload: {}
26-
pvc:
27-
accessModes:
28-
- ReadWriteOnce
23+
upload: {}
24+
storage:
2925
resources:
3026
requests:
3127
storage: <2Gi> <2>
3228
----
33-
<1> The name of the data volume.
34-
<2> The size of the data volume. Ensure that this value is greater than or equal
35-
to the size of the disk that you upload.
29+
<1> Specify the name of the new data volume.
30+
<2> Specify the amount of available space requested for the data volume. This value must be greater than or equal to the _virtual_ size of the disk that you upload.
3631

3732
. Create the data volume by running the following command:
3833
+
39-
4034
[source,terminal]
4135
----
42-
$ oc create -f <upload-datavolume>.yaml
36+
$ oc create -f <datavolume>.yaml
4337
----

0 commit comments

Comments
 (0)