Skip to content

Commit d127419

Browse files
Adding a new assembly and modules to cover preallocation mode for CDI operations.
1 parent 3c76fe3 commit d127419

14 files changed

+141
-1
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,6 +2623,8 @@ Topics:
26232623
File: virt-reserving-pvc-space-fs-overhead
26242624
- Name: Configuring CDI to work with namespaces that have a compute resource quota
26252625
File: virt-configuring-cdi-for-namespace-resourcequota
2626+
- Name: Using preallocation for data volumes
2627+
File: virt-using-preallocation-for-datavolumes
26262628
- Name: Uploading local disk images by using the web console
26272629
File: virt-uploading-local-disk-images-web
26282630
- Name: Uploading local disk images by using the virtctl tool
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc
4+
5+
[id="virt-about-preallocation_{context}"]
6+
= About preallocation
7+
8+
The Containerized Data Importer (CDI) can use the QEMU preallocate mode for data volumes to improve write performance. You can use preallocation mode for importing and uploading operations and when creating blank data volumes.
9+
10+
If preallocation is enabled, the CDI uses the better preallocation method depending on the underlying file system and device type:
11+
12+
`fallocate`::
13+
If the file system supports it, CDI uses the operating system's `fallocate` call to preallocate space by using the `posix_fallocate` function, which allocates blocks and marks them as uninitialized.
14+
15+
`full`::
16+
If `fallocate` mode cannot be used, `full` mode allocates space for the image by writing data to the underlying storage. Depending on the storage location, all the empty allocated space might be zeroed.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc
4+
5+
[id="virt-enabling-preallocation-for-dv_{context}"]
6+
= Enabling preallocation for a data volume
7+
8+
If preallocation is not globally enabled for the cluster, you can enable it for specific data volumes by including the `spec.preallocation` field in the data volume manifest. You can enable preallocation mode in either the web console or by using the OpenShift client (`oc`).
9+
10+
Preallocation mode is supported for all CDI source types.
11+
12+
.Procedure
13+
14+
* Specify the `spec.preallocation` field in the data volume manifest:
15+
+
16+
[source,yaml]
17+
----
18+
apiVersion: cdi.kubevirt.io/v1beta1
19+
kind: DataVolume
20+
metadata:
21+
name: preallocated-datavolume
22+
spec:
23+
source: <1>
24+
...
25+
pvc:
26+
...
27+
preallocation: true <2>
28+
----
29+
<1> All CDI source types support preallocation, however preallocation is ignored for cloning operations.
30+
<2> The `preallocation` field is a boolean that defaults to false.
31+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc
4+
5+
[id="virt-enabling-preallocation-globally_{context}"]
6+
= Enabling preallocation globally
7+
8+
You can enable cluster-wide preallocation mode for the Containerized Data Importer (CDI) by adding the `prellocation` field to the `CDI` object.
9+
10+
.Prerequisites
11+
12+
* Install the OpenShift client (`oc`).
13+
14+
.Procedure
15+
16+
. Use the `oc` client to edit the `CDI` object:
17+
+
18+
[source,terminal]
19+
----
20+
$ oc edit cdi
21+
----
22+
23+
. Set the `spec.config.preallocation` field with a value of `true`:
24+
+
25+
[source,yaml]
26+
----
27+
apiVersion: cdi.kubevirt.io/v1beta1
28+
kind: CDI
29+
metadata:
30+
...
31+
spec:
32+
config:
33+
preallocation: true <1>
34+
----
35+
<1> The `preallocation` field is a boolean that defaults to false.
36+
37+
. Save and exit your editor to update the `CDI` object and enable prellocation mode.
38+
39+

virt/virtual_machines/cloning_vms/virt-cloning-vm-disk-into-new-datavolume-block.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ include::modules/virt-cloning-pvc-of-vm-disk-into-new-datavolume.adoc[leveloffse
3131
include::modules/virt-cdi-supported-operations-matrix.adoc[leveloffset=+1]
3232

3333
:blockstorage!:
34+

virt/virtual_machines/cloning_vms/virt-cloning-vm-disk-into-new-datavolume.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ include::modules/virt-cloning-pvc-of-vm-disk-into-new-datavolume.adoc[leveloffse
2626
include::modules/virt-template-datavolume-clone.adoc[leveloffset=+1]
2727

2828
include::modules/virt-cdi-supported-operations-matrix.adoc[leveloffset=+1]
29+

virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes-block.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ include::modules/virt-creating-local-block-pv.adoc[leveloffset=+1]
3535
include::modules/virt-importing-vm-to-block-pv.adoc[leveloffset=+1]
3636

3737
include::modules/virt-cdi-supported-operations-matrix.adoc[leveloffset=+1]
38+
39+
[id="{context}_additional-resources"]
40+
== Additional resources
41+
42+
* xref:../../../virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc#virt-using-preallocation-for-datavolumes[Configure preallocation mode] to improve write performance for data volume operations.
43+

virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ include::modules/virt-importing-vm-datavolume.adoc[leveloffset=+1]
3838
// include::modules/virt-template-datavolume-vm.adoc[leveloffset=+1]
3939

4040
// include::modules/virt-template-datavolume-import.adoc[leveloffset=+1]
41+
42+
[id="{context}_additional-resources"]
43+
== Additional resources
44+
45+
* xref:../../../virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc#virt-using-preallocation-for-datavolumes[Configure preallocation mode] to improve write performance for data volume operations.

virt/virtual_machines/virtual_disks/virt-cloning-a-datavolume-using-smart-cloning.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ include::modules/virt-understanding-smart-cloning.adoc[leveloffset=+1]
1515

1616
include::modules/virt-cloning-a-datavolume.adoc[leveloffset=+1]
1717

18+
[id="{context}_additional-resources"]
1819
== Additional resources
1920

2021
* xref:../../../virt/virtual_machines/cloning_vms/virt-cloning-vm-disk-into-new-datavolume.adoc#virt-cloning-pvc-of-vm-disk-into-new-datavolume_virt-cloning-vm-disk-into-new-datavolume[Cloning the persistent volume claim of a virtual machine disk into a new data volume]
22+
23+
* xref:../../../virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc#virt-using-preallocation-for-datavolumes[Configure preallocation mode] to improve write performance for data volume operations.

virt/virtual_machines/virtual_disks/virt-expanding-virtual-storage-with-blank-disk-images.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ include::modules/virt-about-datavolumes.adoc[leveloffset=+1]
1111

1212
include::modules/virt-creating-blank-disk-datavolumes.adoc[leveloffset=+1]
1313

14-
include::modules/virt-template-blank-disk-datavolume.adoc[leveloffset=+1]
14+
include::modules/virt-template-blank-disk-datavolume.adoc[leveloffset=+1]
15+
16+
[id="{context}_additional-resources"]
17+
== Additional resources
18+
19+
* xref:../../../virt/virtual_machines/virtual_disks/virt-using-preallocation-for-datavolumes.adoc#virt-using-preallocation-for-datavolumes[Configure preallocation mode] to improve write performance for data volume operations.

0 commit comments

Comments
 (0)