- Editing virtual machines
- Editing a virtual machine in the web console
- Editing a virtual machine YAML configuration using the web console
- Editing a virtual machine YAML configuration using the CLI
- Adding a virtual disk to a virtual machine
- Adding a network interface to a virtual machine
- Editing CD-ROMs for Virtual Machines
- Additional resources
Editing virtual machines
- Editing a virtual machine in the web console
- Editing a virtual machine YAML configuration using the web console
- Editing a virtual machine YAML configuration using the CLI
- Adding a virtual disk to a virtual machine
- Adding a network interface to a virtual machine
- Editing CD-ROMs for Virtual Machines
- Additional resources
You can update a virtual machine configuration using either the YAML editor in the web console or the OpenShift CLI on the command line. You can also update a subset of the parameters in the Virtual Machine Details screen.
Editing a virtual machine in the web console
Edit select values of a virtual machine in the web console by clicking the pencil icon next to the relevant field. Other values can be edited using the CLI.
Labels and annotations are editable for both preconfigured Red Hat templates and your custom virtual machine templates. All other values are editable only for custom virtual machine templates that users have created using the Red Hat templates or the Create Virtual Machine Template wizard.
Procedure
Click Workloads → Virtualization from the side menu.
Click the Virtual Machines tab.
Select a virtual machine.
Click the Details tab.
Click the pencil icon to make a field editable.
Make the relevant changes and click Save.
If the virtual machine is running, changes to Boot Order or Flavor will not take effect until you restart the virtual machine. You can view pending changes by clicking View Pending Changes on the right side of the relevant field. The Pending Changes banner at the top of the page displays a list of all changes that will be applied when the virtual machine restarts. |
Editing a virtual machine YAML configuration using the web console
You can edit the YAML configuration of a virtual machine in the web console. Some parameters cannot be modified. If you click Save with an invalid configuration, an error message indicates the parameter that cannot be changed.
If you edit the YAML configuration while the virtual machine is running, changes will not take effect until you restart the virtual machine.
Navigating away from the YAML screen while editing cancels any changes to the configuration you have made. |
Procedure
Click Workloads → Virtualization from the side menu.
Select a virtual machine.
Click the YAML tab to display the editable configuration.
Optional: You can click Download to download the YAML file locally in its current state.
Edit the file and click Save.
A confirmation message shows that the modification has been successful and includes the updated version number for the object.
Editing a virtual machine YAML configuration using the CLI
Use this procedure to edit a virtual machine YAML configuration using the CLI.
Prerequisites
You configured a virtual machine with a YAML object configuration file.
You installed the
oc
CLI.
Procedure
Run the following command to update the virtual machine configuration:
$ oc edit <object_type> <object_ID>
Open the object configuration.
Edit the YAML.
If you edit a running virtual machine, you need to do one of the following:
Restart the virtual machine.
Run the following command for the new configuration to take effect:
$ oc apply <object_type> <object_ID>
Adding a virtual disk to a virtual machine
Use this procedure to add a virtual disk to a virtual machine.
Procedure
Click Workloads → Virtualization from the side menu.
Click the Virtual Machines tab.
Select a virtual machine to open the Virtual Machine Overview screen.
Click the Disks tab.
In the Add Disk window, specify the Source, Name, Size, Type, Interface, and Storage Class.
Advanced: You can enable preallocation if you use a blank disk source and require maximum write performance when creating data volumes. To do so, select the Enable preallocation checkbox.
Optional: In the Advanced list, specify the Volume Mode and Access Mode for the virtual disk. If you do not specify these parameters, the system uses the default values from the
kubevirt-storage-class-defaults
config map.
Click Add.
If the virtual machine is running, the new disk is in the pending restart state and will not be attached until you restart the virtual machine. The Pending Changes banner at the top of the page displays a list of all changes that will be applied when the virtual machine restarts. |
For more information on the kubevirt-storage-class-defaults
config map, see Storage defaults for data volumes.
Storage fields
Name | Selection | Description | ||
---|---|---|---|---|
Source | Blank (creates PVC) | Create an empty disk. | ||
Import via URL (creates PVC) | Import content via URL (HTTP or S3 endpoint). | |||
Use an existing PVC | Use a PVC that is already available in the cluster. | |||
Clone existing PVC (creates PVC) | Select an existing PVC available in the cluster and clone it. | |||
Import via Registry (creates PVC) | Import content via container registry. | |||
Container (ephemeral) | Upload content from a container located in a registry accessible from the cluster. The container disk should be used only for read-only filesystems such as CD-ROMs or temporary virtual machines. | |||
Name | Name of the disk. The name can contain lowercase letters ( | |||
Size | Size of the disk in GiB. | |||
Type | Type of disk. Example: Disk or CD-ROM | |||
Interface | Type of disk device. Supported interfaces are virtIO, SATA, and SCSI. | |||
Storage Class | The storage class that is used to create the disk. | |||
Advanced → Volume Mode
| Defines whether the persistent volume uses a formatted file system or raw block state. Default is Filesystem. |
Advanced storage settings
Name | Parameter | Description | ||
---|---|---|---|---|
Volume Mode
| Filesystem | Stores the virtual disk on a file system-based volume. | ||
Block | Stores the virtual disk directly on the block volume. Only use |
Adding a network interface to a virtual machine
Use this procedure to add a network interface to a virtual machine.
Procedure
Click Workloads → Virtualization from the side menu.
Click the Virtual Machines tab.
Select a virtual machine to open the Virtual Machine Overview screen.
Click the Network Interfaces tab.
Click Add Network Interface.
In the Add Network Interface window, specify the Name, Model, Network, Type, and MAC Address of the network interface.
Click Add.
If the virtual machine is running, the new network interface is in the pending restart state and changes will not take effect until you restart the virtual machine. The Pending Changes banner at the top of the page displays a list of all changes that will be applied when the virtual machine restarts. |
Networking fields
Name | Description |
---|---|
Name | Name for the network interface controller. |
Model | Indicates the model of the network interface controller. Supported values are e1000e and virtio. |
Network | List of available network attachment definitions. |
Type | List of available binding methods. For the default pod network, |
MAC Address | MAC address for the network interface controller. If a MAC address is not specified, one is assigned automatically. |
Editing CD-ROMs for Virtual Machines
Use the following procedure to edit CD-ROMs for virtual machines.
Procedure
Click Workloads → Virtualization from the side menu.
Click the Virtual Machines tab.
Select a virtual machine to open the Virtual Machine Overview screen.
Click the Disks tab.
Click the Options menu for the CD-ROM that you want to edit and select Edit.
In the Edit CD-ROM window, edit the fields: Source, Persistent Volume Claim, Name, Type, and Interface.
Click Save.