Skip to content

Commit e0ca00e

Browse files
committed
CNV-46346: Adding docs for controller revisions
1 parent 46003f4 commit e0ca00e

File tree

5 files changed

+94
-8
lines changed

5 files changed

+94
-8
lines changed

modules/virt-about-instance-types.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,10 @@ In addition to the required `cpu` and `memory` attributes, you can include the f
8282
`launchSecurity`:: Configure Secure Encrypted Virtualization (SEV).
8383
`nodeSelector`:: Specify node selectors to control the nodes where this VM is scheduled.
8484
`schedulerName`:: Define a custom scheduler to use for this VM instead of the default scheduler.
85+
86+
[id="virt-about-instance-types-controller-revisions_{context}"]
87+
== Controller revisions
88+
89+
When you create a VM by using an instance type, a `ControllerRevision` object retains an immutable snapshot of the instance type object. This snapshot locks in resource-related characteristics defined in the instance type object, such as the required guest CPU and memory. The VM status also contains a reference to the `ControllerRevision` object.
90+
91+
This snapshot is essential for versioning, and ensures that the VM instance created when starting a VM does not change if the underlying instance type object is updated while the VM is running.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/creating_vm/virt-creating-vms-from-instance-types.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-change-vm-instance-type-cli_{context}"]
7+
= Changing the instance type of a VM by using the CLI
8+
9+
[role="_abstract"]
10+
To change the instance type of a VM, change the `name` field in the VM spec. This triggers the update logic, which ensures that a new, immutable controller revision snapshot is taken of the new resource configuration.
11+
12+
.Prerequisites
13+
14+
* You have installed the {oc-first}.
15+
* You created the VM by using an instance type, or have administrator privileges for the VM that you want to modify.
16+
17+
.Procedure
18+
19+
. Stop the VM.
20+
21+
. Run the following command, and replace `<vm_name>` with the name of your VM, and `<new_instancetype>` with the name of the instance type you want to change to:
22+
+
23+
[source,terminal]
24+
----
25+
$ oc patch vm/<vm_name> --type merge -p '{"spec":{"instancetype":{"name": "<new_instancetype>"}}}'
26+
----
27+
28+
.Verification
29+
30+
* Check the controller revision reference in the updated VM `status` field. Run the following command and verify that the revision name is updated in the output:
31+
+
32+
[source,terminal]
33+
----
34+
$ oc get vms/<vm_name> -o json | jq .status.instancetypeRef
35+
----
36+
+
37+
*Example output*
38+
+
39+
[source,terminal]
40+
----
41+
{
42+
"controllerRevisionRef": {
43+
"name": "vm-cirros-csmall-csmall-3e86e367-9cd7-4426-9507-b14c27a08671-2"
44+
},
45+
"kind": "VirtualMachineInstancetype",
46+
"name": "csmall"
47+
}
48+
----
49+
50+
* Optional: Check that the VM instance is running the new configuration defined in the latest controller revision. For example, if you updated the instance type to use 2 vCPUs instead of 1, run the following command and check the output:
51+
+
52+
[source,terminal]
53+
----
54+
$ oc get vmi/<vm_name> -o json | jq .spec.domain.cpu
55+
----
56+
+
57+
*Example output that verifies that the revision uses 2 vCPUs*
58+
+
59+
[source,terminal]
60+
----
61+
{
62+
"cores": 1,
63+
"model": "host-model",
64+
"sockets": 2,
65+
"threads": 1
66+
}
67+
----

modules/virt-change-vm-instance-type.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="virt-change-vm-instance-type_{context}"]
7+
= Changing the instance type of a VM by using the web console
78

8-
= Changing the instance type of a VM
9-
9+
[role="_abstract"]
1010
You can change the instance type associated with a running virtual machine (VM) by using the web console. The change takes effect immediately.
1111

1212
.Prerequisites
@@ -36,4 +36,3 @@ You can change the instance type associated with a running virtual machine (VM)
3636
. Click *Reload*.
3737

3838
. Review the VM YAML to confirm that the instance type changed.
39-

modules/virt-creating-udn-namespace-cli.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Module included in the following assemblies:
22
//
3-
// * virt/vm_networking/virt-connecting-vm-to-primary-udn.adoc
3+
// * virt/vm_networking/virt-connecting-vm-to-primary-udn.adoc
44

5-
:_mod-docs-content-type: PROCEDURE
6-
[id="virt-creating-udn-namespace-cli_{context}"]
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-creating-udn-namespace-cli_{context}"]
77
= Creating a namespace for user-defined networks by using the CLI
88

99
You can create a namespace to be used with primary user-defined networks (UDNs) by using the CLI.
@@ -33,4 +33,4 @@ metadata:
3333
[source, terminal]
3434
----
3535
oc apply -f <filename>.yaml
36-
----
36+
----

virt/creating_vm/virt-creating-vms-from-instance-types.adoc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include::_attributes/common-attributes.adoc[]
66

77
toc::[]
88

9+
[role="_abstract"]
910
You can simplify virtual machine (VM) creation by using instance types, whether you use the {product-title} web console or the CLI to create VMs.
1011

1112
// special TP note for ROSA only:
@@ -40,4 +41,16 @@ ifndef::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
4041
* xref:../../virt/monitoring/virt-exposing-downward-metrics.adoc#virt-configuring-downward-metrics_virt-exposing-downward-metrics[Configuring a downward metrics device]
4142
endif::openshift-rosa,openshift-dedicated,openshift-rosa-hcp[]
4243

43-
include::modules/virt-change-vm-instance-type.adoc[leveloffset=+1]
44+
[id="virt-creating-vms-from-instance-types-changing-types_{context}"]
45+
== Changing the instance type for a VM
46+
47+
As a cluster administrator or VM owner, you might want to change the instance type for an existing VM for the following reasons:
48+
49+
* If a VM's workload has increased, you might change the instance type to one with more CPU, more memory, or specific hardware resources, to prevent performance bottlenecks.
50+
* If you are using specialized workloads, you might switch to a different instance type to improve performance, as some instance types are optimized for specific use cases.
51+
52+
You can use the {product-title} web console or the {oc-first} to change the instance type for an existing VM.
53+
54+
include::modules/virt-change-vm-instance-type.adoc[leveloffset=+2]
55+
56+
include::modules/virt-change-vm-instance-type-cli.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)