Skip to content

Commit eb81e7f

Browse files
authored
Merge pull request #100083 from openshift-cherrypick-robot/cherry-pick-97530-to-enterprise-4.20
2 parents 08176d7 + c3754a8 commit eb81e7f

15 files changed

+400
-348
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
:_newdoc-version: 2.18.5
2+
:_template-generated: 2025-08-14
3+
:_mod-docs-content-type: PROCEDURE
4+
5+
[id="virt-generating-a-vm-memory-dump_{context}"]
6+
= Generating a VM memory dump
7+
8+
When a virtual machine (VM) terminates unexpectedly, you can use the `virtctl memory-dump` to generate a memory dump command to output a VM memory dump and save it on a persistent volume claim (PVC). Afterwards, you can analyze the memory dump to diagnose and troubleshoot issues on the VM.
9+
10+
// You can specify an existing PVC or use the `--create-claim` flag to create a new PVC.
11+
12+
.Prerequisites
13+
14+
* The hot plug feature gate is enabled in the `HyperConverged` custom resource. To do so, run the following command:
15+
+
16+
[source,terminal,subs="attributes+"]
17+
----
18+
$ oc patch hyperconverged kubevirt-hyperconverged -n {CNVNamespace} \
19+
--type json -p '[{"op": "add", "path": "/spec/featureGates", \
20+
"value": "HotplugVolumes"}]'
21+
----
22+
23+
* Optional: You have an existing PVC on which you want to save the memory dump.
24+
** The PVC volume mode must be `FileSystem`.
25+
** The PVC must be large enough to contain the memory dump.
26+
+
27+
The formula for calculating the PVC size is `(VMMemorySize + 100Mi) * FileSystemOverhead`, where `100Mi` is the memory dump overhead, and `FileSystemOverhead` is defined in the `HCO` object.
28+
29+
.Procedure
30+
31+
. Create a memory dump of the required VM:
32+
33+
** If you have an existing PVC selected on which you want to save the memory dump:
34+
+
35+
[source,terminal]
36+
----
37+
$ virtctl memory-dump get <vm_name> --claim-name=<pvc_name>
38+
----
39+
40+
** If you want to create a new PVC for the memory dump:
41+
+
42+
[source,terminal]
43+
----
44+
$ virtctl memory-dump get <vm_name> --claim-name=<new_pvc_name> --create-claim
45+
----
46+
47+
. Download the memory dump:
48+
+
49+
[source,terminal]
50+
----
51+
$ virtctl memory-dump download <vm_name> --output=<output_file>
52+
----
53+
54+
. Attach the memory dump to a Red Hat Support case.
55+
+
56+
Alternatively, you can inspect the memory dump, for example by using link:https://github.com/volatilityfoundation/volatility3[the volatility3 tool].
57+
58+
. Optional: Remove the memory dump:
59+
+
60+
[source,terminal]
61+
----
62+
$ virtctl memory-dump remove <vm_name>
63+
----
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
:_newdoc-version: 2.18.5
2+
:_template-generated: 2025-08-13
3+
:_mod-docs-content-type: REFERENCE
4+
5+
[id="hot-plug-and-hot-unplug-commands_{context}"]
6+
= Hot plug and hot unplug commands
7+
8+
9+
You can use the following `virtctl` commands to add or remove resources from running virtual machines (VMs) and VM instances (VMIs).
10+
11+
.Hot plug and hot unplug commands
12+
[width="100%",cols="1a,2a",options="header"]
13+
|===
14+
|Command |Description
15+
|`virtctl addvolume <vm_name> --volume-name=<datavolume_or_PVC> [--persist] [--serial=<label>]`
16+
|Hot plug a data volume or persistent volume claim (PVC).
17+
18+
Optional:
19+
20+
* `--persist` mounts the virtual disk permanently on a VM. *This flag does not apply to VMIs.*
21+
* `--serial=<label>` adds a label to the VM. If you do not specify a label, the default label is the data volume or PVC name.
22+
23+
|`virtctl removevolume <vm_name> --volume-name=<virtual_disk>`
24+
|Hot unplug a virtual disk.
25+
26+
|`virtctl addinterface <vm_name> --network-attachment-definition-name <net_attach_def_name> --name <interface_name>`
27+
|Hot plug a Linux bridge network interface.
28+
29+
|`virtctl removeinterface <vm_name> --name <interface_name>`
30+
|Hot unplug a Linux bridge network interface.
31+
|===
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
:_newdoc-version: 2.18.5
2+
:_template-generated: 2025-08-13
3+
:_mod-docs-content-type: REFERENCE
4+
5+
[id="image-upload-commands_{context}"]
6+
= Image upload commands
7+
8+
You can use the following `virtctl image-upload` commands to upload a VM image to a data volume.
9+
10+
.Image upload commands
11+
[width="100%",cols="1a,2a",options="header"]
12+
|===
13+
|Command |Description
14+
|`virtctl image-upload dv <datavolume_name> --image-path=</path/to/image> --no-create`
15+
|Upload a VM image to a data volume that already exists.
16+
17+
|`virtctl image-upload dv <datavolume_name> --size=<datavolume_size> --image-path=</path/to/image>`
18+
|Upload a VM image to a new data volume of a specified requested size.
19+
20+
|`virtctl image-upload dv <datavolume_name> --datasource --size=<datavolume_size> --image-path=</path/to/image>`
21+
|Upload a VM image to a new data volume and create an associated `DataSource` object for it.
22+
|===
23+

0 commit comments

Comments
 (0)