Skip to content

Commit 95c3bc1

Browse files
authored
Merge pull request #98887 from jherrman/managing-cdroms_CNV-57724
OSDOCS#57724: Adding CD-ROM management in CNV
2 parents 68b87e5 + 7fac8ca commit 95c3bc1

File tree

5 files changed

+217
-0
lines changed

5 files changed

+217
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4927,6 +4927,8 @@ Topics:
49274927
File: virt-configuring-shared-volumes-for-vms
49284928
- Name: Migrating VM disks to a different storage class
49294929
File: virt-migrating-storage-class
4930+
- Name: Inserting CD-ROMs in virtual machines
4931+
File: virt-inserting-cd-roms-in-virtual-machines
49304932
- Name: Networking
49314933
Dir: vm_networking
49324934
Topics:
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
:_newdoc-version: 2.18.5
2+
:_template-generated: 2025-09-11
3+
:_mod-docs-content-type: PROCEDURE
4+
5+
// Module included in the following assemblies:
6+
//
7+
// * virt/managing_vms/virtual_disks/virt-inserting-cd-roms-in-virtual-machines.adoc
8+
9+
[id="virt-inserting-a-cd-rom-in-a-vm-by-using-the-command-line_{context}"]
10+
= Inserting a CD-ROM in a live VM by using the command line
11+
12+
[role="_abstract"]
13+
To make data on a CD-ROM storage device available to a running virtual machine (VM), create a virtual CD-ROM drive in the VM and insert the CD-ROM into the drive as an ISO image.
14+
15+
Setting up a virtual CD-ROM drive requires rebooting the VM, but afterwards, you can insert and eject ISO images in the drive while the VM is running.
16+
// See https://kubevirt.io/user-guide/storage/hotplug_volumes/#inject-cd-rom for upstream info
17+
18+
:FeatureName: Inserting and ejecting CD-ROMs in running VMs
19+
include::snippets/technology-preview.adoc[]
20+
21+
.Prerequisites
22+
23+
include::snippets/virt-cdrom-feature-gate-requirements.adoc[]
24+
25+
* You have an ISO image of a CD-ROM available in the cluster.
26+
27+
.Procedure
28+
29+
. Run the following command to edit the configuration of the VM in which you want to insert the CD-ROM:
30+
+
31+
[source,terminal]
32+
----
33+
$ oc edit vm <vm-name> -n <namespace>
34+
----
35+
+
36+
where:
37+
38+
* `<vm-name>` is the name of the VM
39+
* `<namespace>` is the name of the project name space that contains the VM
40+
41+
. Add a `cdrom` disk to the `spec.template.spec.domains.devices.disks` section of the VM configuration. For example:
42+
+
43+
[source,yaml]
44+
----
45+
apiVersion: kubevirt.io/v1
46+
kind: VirtualMachine
47+
metadata:
48+
name: example-vm
49+
spec:
50+
runStrategy: Always
51+
template:
52+
spec:
53+
domain:
54+
devices:
55+
disks:
56+
- cdrom:
57+
bus: sata
58+
name: cdrom
59+
----
60+
61+
. If the VM is running, shut it down.
62+
63+
. Insert a CD-ROM volume in the `spec.template.spec.volumes` section of the VM configuration. For example:
64+
+
65+
[source,yaml]
66+
----
67+
apiVersion: kubevirt.io/v1
68+
kind: VirtualMachine
69+
metadata:
70+
name: example-vm
71+
spec:
72+
template:
73+
spec:
74+
volumes:
75+
- dataVolume:
76+
name: cdrom-example
77+
hotpluggable: true
78+
name: cdrom
79+
----
80+
+
81+
You can insert a CD-ROM this way while the VM is running, but the dataVolume must have the `hotpluggable: true` parameter set.
82+
83+
. Optional: In the guest operating system, verify that the CD-ROM has been detected.
84+
85+
. Optional: Eject the CD-ROM volume. To do so, remove the `cdrom` volume from the `spec.template.spec.volumes` section of the VM configuration. You can do this while the VM is running.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
:_newdoc-version: 2.18.5
2+
:_template-generated: 2025-09-11
3+
:_mod-docs-content-type: PROCEDURE
4+
5+
// Module included in the following assemblies:
6+
//
7+
// * virt/managing_vms/virtual_disks/virt-inserting-cd-roms-in-virtual-machines.adoc
8+
9+
[id="virt-inserting-a-cd-rom-in-a-vm-by-using-the-web-console_{context}"]
10+
= Inserting a CD-ROM in a live VM by using the web console
11+
12+
[role="_abstract"]
13+
To make data on a CD-ROM storage device available to a running virtual machine (VM), create a virtual CD-ROM drive in the VM and insert the CD-ROM into the drive as an ISO image.
14+
15+
Setting up a virtual CD-ROM drive requires rebooting the VM, but you can insert and eject ISO images in the drive while the VM is running.
16+
17+
:FeatureName: Inserting and ejecting CD-ROMs in running VMs
18+
include::snippets/technology-preview.adoc[]
19+
20+
.Prerequisites
21+
22+
include::snippets/virt-cdrom-feature-gate-requirements.adoc[]
23+
24+
.Procedure
25+
26+
. In the {product-title} web console, go to *Virtualization* → *VirtualMachines*.
27+
28+
. Click the name of the VM in which you want to insert the CD-ROM.
29+
30+
. On the VM details page, click the *Configuration* tab.
31+
32+
. Open the *Storage* pane.
33+
34+
. Click *Add*.
35+
+
36+
A drop-down menu opens.
37+
38+
. Click *CD-ROM*.
39+
40+
. In the *Name* field, add a name for the CD-ROM drive device.
41+
42+
. Select the ISO image to add to the drive as a CD-ROM volume. To do so, click the drop-down button, and select from the volumes available in the cluster.
43+
+
44+
Alternatively, you can upload a new ISO file and insert it into the CD-ROM drive after it is created. To do so:
45+
46+
.. Ensure that the *Upload a new ISO file to the cluster* line is checked.
47+
.. Drag and drop an ISO file in the *Upload ISO* field, or click *Upload* and select the ISO image that you want to upload.
48+
.. In the *Upload mode* field, select *Mount uploaded ISO as DataVolume*.
49+
50+
. Click *Add*.
51+
+
52+
The CD-ROM drive is added to the *Storage* list.
53+
54+
. If the VM is running, shut it down or restart it.
55+
56+
. To insert the ISO file attached to the CD-ROM drive as a CD-ROM volume into the VM, click the Options menu {kebab} next to the CD-ROM drive, and click *Inject*. You can do this while the VM is running.
57+
58+
. Optional: In the guest operating system, verify that the CD-ROM has been detected.
59+
60+
. Optional: To eject the CD-ROM from the VM, click the Options menu {kebab} next to the CD-ROM device in the web console, and select *Eject*. You can do this while the VM is running.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//This snippet appears in the following modules & assemblies:
2+
//
3+
// * modules/virt-inserting-a-cd-rom-in-a-vm-by-using-the-command-line.adoc
4+
// * modules/virt-inserting-a-cd-rom-in-a-vm-by-using-the-command-line.adoc
5+
6+
:_mod-docs-content-type: SNIPPET
7+
8+
* The `DeclarativeHotplugVolumes` feature gate must be enabled. To ensure this, the `HyperConverged` CR must contain the `declarativeHotplugVolumes: true` line in the `spec.featureGates` configuration section:
9+
+
10+
[source,yaml,subs="attributes+"]
11+
----
12+
apiVersion: hco.kubevirt.io/v1
13+
kind: HyperConverged
14+
metadata:
15+
name: kubevirt-hyperconverged
16+
namespace: {CNVNamespace}
17+
spec:
18+
featureGates:
19+
declarativeHotplugVolumes: true
20+
----
21+
22+
* The `HotplugVolumes` feature gate must be disabled. This feature gate is required for using ephemeral volumes, but is incompatible with `DeclarativeHotplugVolumes`.
23+
+
24+
[source,yaml,subs="attributes+"]
25+
----
26+
apiVersion: hco.kubevirt.io/v1
27+
kind: HyperConverged
28+
metadata:
29+
name: kubevirt-hyperconverged
30+
namespace: {CNVNamespace}
31+
spec:
32+
featureGates:
33+
HotplugVolumes: false
34+
----
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
:_newdoc-version: 2.18.5
2+
:_template-generated: 2025-09-11
3+
:_mod-docs-content-type: ASSEMBLY
4+
5+
[id="virt-inserting-cd-roms-in-virtual-machines"]
6+
= Inserting CD-ROMs in live virtual machines
7+
8+
include::_attributes/common-attributes.adoc[]
9+
:context: virt-inserting-cd-roms-in-virtual-machines
10+
11+
toc::[]
12+
13+
[role="_abstract"]
14+
To attach a storage device to a virtual machine (VM) without rebooting the VM, you can configure a VM to use a virtual CD-ROM drive, and insert an ISO image in the drive.
15+
16+
This also makes it possible to install an operating system from a CD-ROM in the VM.
17+
18+
:FeatureName: Inserting and ejecting CD-ROMs in running VMs
19+
include::snippets/technology-preview.adoc[]
20+
21+
////
22+
Ticket: https://issues.redhat.com/browse/CNV-7383
23+
24+
User stories:
25+
* As a VM owner, I want to be able to attach a CD-ROM for the purposes of installing an operating system, then be able eject the CD and perform a guest-side reboot to use the operating system.
26+
* As a VM Owner I want to attach an ISO/CDROM from my desktop to the VM without the need to reboot the VM
27+
* As a VM Owner I want to attach a Container-Disk-ISO from the registry to my VM without the need to reboot the VM
28+
* As a VM Owner I want to attach a PVC which contains an ISO to my VM without the need to reboot the VM
29+
* As a VM Owner I want to be able to "eject" (remove) the ISO/CD from my VM without the need to reboot the VM
30+
////
31+
32+
33+
include::modules/virt-inserting-a-cd-rom-in-a-vm-by-using-the-command-line.adoc[leveloffset=+1]
34+
35+
include::modules/virt-inserting-a-cd-rom-in-a-vm-by-using-the-web-console.adoc[leveloffset=+1]
36+

0 commit comments

Comments
 (0)