This is a cache of https://docs.openshift.com/container-platform/4.2/cnv/cnv_users_guide/cnv-edit-vms.html. It is a snapshot of the page at 2024-11-26T02:55:59.993+0000.
Editing virtual machines - Container-native virtualization user's guide | Container-native virtualization | OpenShift Container Platform 4.2
×

Edit a virtual machine by completing one of the following tasks:

  • Editing a virtual machine YAML configuration using the web console

  • Editing a virtual machine YAML configuration using the cli

Editing a virtual machine YAML configuration using the web console

Using the web console, edit the YAML configuration of a virtual machine.

Not all parameters can be updated. If you edit values that cannot be changed and click Save, an error message indicates the parameter that was not able to be updated.

The YAML configuration can be edited while the virtual machine is Running, however the changes will only take effect after the virtual machine has been stopped and started again.

Navigating away from the YAML screen while editing cancels any changes to the configuration you have made.

Procedure
  1. click WorkloadsVirtual Machine from the side menu.

  2. Select a virtual machine.

  3. click the YAML tab to display the editable configuration.

  4. Optional: You can click Download to download the YAML file locally in its current state.

  5. 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

Prerequisites
  • You configured a virtual machine with a YAML object configuration file.

  • You installed the oc cli.

Procedure
  1. Run the following command to update the virtual machine configuration.

    $ oc edit <object_type> <object_ID>
  2. Open the object configuration.

  3. Edit the YAML.

  4. 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

Add a disk to a virtual machine.

Procedure
  1. From the Virtual Machines tab, select your virtual machine.

  2. Select the Disks tab.

  3. click Add Disks to open the Add Disk window.

  4. In the Add Disk window, specify Source, Name, Size, Interface, and Storage Class.

  5. Edit the disk configuration by using the drop-down lists and check boxes.

  6. click OK.

Adding a network interface to a virtual machine

Procedure
  1. From the Virtual Machines tab, select the virtual machine.

  2. Select the Network Interfaces tab.

  3. click Create Network Interface.

  4. In the Create Network Interface list row, specify the Name, Model, Network, Type, and MAC Address of the network interface.

  5. click the green check-mark to the right of the row to add the network interface.

  6. Restart the virtual machine to enable access.

  7. Edit the drop-down lists and check boxes to configure the network interface.

  8. click Save Changes.

  9. click OK.

The new network interface displays at the top of the Create Network Interface list until the user restarts it.

The new network interface has a Pending VM restart Link State until you restart the virtual machine. Hover over the Link State to display more detailed information.

The Link State is set to Up by default when the network interface card is defined on the virtual machine and connected to the network.