Skip to content

Commit 9a11af2

Browse files
authored
Merge pull request #80363 from sabrinajess/CNV31862
#CNV-38162: new inferfromvolume content
2 parents 34d74e7 + 87ba920 commit 9a11af2

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4389,6 +4389,8 @@ Topics:
43894389
File: virt-creating-vms-by-cloning-pvcs
43904390
- Name: Connecting to VM consoles
43914391
File: virt-accessing-vm-consoles
4392+
- Name: Specifying an instance type or preference
4393+
File: virt-specifying-instance-preference
43924394
- Name: Configuring SSH access to VMs
43934395
File: virt-accessing-vm-ssh
43944396
- Name: Editing virtual machines
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-specifying-instance-preference.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-infer-instancetype-preference_{context}"]
7+
= Inferring an instance type or preference
8+
9+
Inferring instance types, preferences, or both is enabled by default, and the `inferFromVolumeFailure` policy of the `inferFromVolume` attribute is set to `Ignore`. When inferring from the boot volume, errors are ignored, and the VM is created with the instance type and preference left unset.
10+
11+
However, when flags are applied, the `inferFromVolumeFailure` policy defaults to `Reject`. When inferring from the boot volume, errors result in the rejection of the creation of that VM.
12+
13+
You can use the `--infer-instancetype` and `--infer-preference` flags to infer which instance type, preference, or both to use to define the workload sizing and runtime characteristics of a VM.
14+
15+
.Prerequisites
16+
17+
* You have installed the `virtctl` tool.
18+
19+
.Procedure
20+
21+
* To explicitly infer instance types from the volume used to boot the virtual machine, use the `--infer-instancetype` flag. To explicitly infer preferences, use the `--infer-preference` flag. The following command includes both flags:
22+
23+
+
24+
[source,terminal]
25+
----
26+
$ virtctl create vm --volume-import type:pvc,src:my-ns/my-pvc --infer-instancetype --infer-preference
27+
----
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-specifying-instance-preference.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="inferfromvolume-labels_{context}"]
7+
= Setting the inferFromVolume labels
8+
9+
Use the following labels on your PVC, data source, or data volume to instruct the inference mechanism which instance type, preference, or both to use when trying to boot from a volume.
10+
11+
* A cluster-wide instance type: `instancetype.kubevirt.io/default-instancetype` label.
12+
* A namespaced instance type: `instancetype.kubevirt.io/default-instancetype-kind` label. Defaults to the `VirtualMachineClusterInstancetype` label if left empty.
13+
* A cluster-wide preference: `instancetype.kubevirt.io/default-preference` label.
14+
* A namespaced preference: `instancetype.kubevirt.io/default-preference-kind` label. Defaults to `VirtualMachineClusterPreference` label, if left empty.
15+
16+
.Prerequisites
17+
18+
* You must have an instance type, preference, or both on the cluster.
19+
20+
.Procedure
21+
22+
* To apply a label to a data source, use `oc label`. The following command applies a label that points to a cluster-wide instance type:
23+
24+
+
25+
[source,terminal]
26+
----
27+
$ oc label DataSource foo instancetype.kubevirt.io/default-instancetype=<my_instancetype>
28+
----

modules/virt-using-flags-specify.adoc

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/virt-specifying-instance-preference.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-using-flags-specify_{context}"]
7+
= Using flags to specify instance types and preferences
8+
9+
Specify instance types and preferences by using flags.
10+
11+
.Prerequisites
12+
13+
* You must have an instance type, preference, or both on the cluster.
14+
15+
.Procedure
16+
17+
. To specify an instance type when creating a VM, use the `--instancetype` flag. To specify a preference, use the `--preference` flag. The following example includes both flags:
18+
19+
+
20+
[source,terminal]
21+
----
22+
$ virtctl create vm --instancetype <my_instancetype> --preference <my_preference>
23+
----
24+
25+
. Optional: To specify a namespaced instance type or preference, include the `kind` in the value passed to the `--instancetype` or `--preference` flag command. The namespaced instance type or preference must be in the same namespace you are creating the VM in. The following example includes flags for a namespaced instance type and a namespaced preference:
26+
27+
+
28+
[source,terminal]
29+
----
30+
$ virtctl create vm --instancetype virtualmachineinstancetype/<my_instancetype> --preference virtualmachinepreference/<my_preference>
31+
----
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="virt-specifying-instance-preference"]
3+
= Specifying an instance type or preference
4+
include::_attributes/common-attributes.adoc[]
5+
:context: virt-specifying-instance-preference
6+
7+
toc::[]
8+
9+
You can specify an instance type, a preference, or both to define a set of workload sizing and runtime characteristics for reuse across multiple VMs.
10+
11+
include::modules/virt-using-flags-specify.adoc[leveloffset=+1]
12+
13+
include::modules/virt-infer-instancetype-preference.adoc[leveloffset=+1]
14+
15+
include::modules/virt-inferfromvolume-labels.adoc[leveloffset=+1]
16+

0 commit comments

Comments
 (0)