6.10. Host Devices

6.10.1. Adding a Host Device to a Virtual Machine

To improve performance, you can attach a host device to a virtual machine.

Host devices are physical devices connected to a particular host machine, such as:

  • SCSI tape drives, disks, and changers
  • PCI NICs, GPUs, and HBAs
  • USB mice, cameras, and disks

To add a host device to a virtual machine, you use the virtual machine’s Host Devices properties. First, you select one of the cluster hosts and a device type. Then, you choose and attach one or more of the host devices on that host.

Important

When you change the Pinned Host setting, it removes the current host devices. When you save these changes, in the virtual machine’s Host settings, it sets Start Running On to Specific Host(s) and specifies the host you selected earlier using the Pinned Host setting.

When you finish attaching one or more host devices, you run the virtual machine to apply the changes. The virtual machine starts on the host that has the attached host devices.

If the virtual machine cannot start on the specified host or access the host device, it cancels the start operation and produces an error message with information about the cause.

Prerequisites

  • The state of the host is Up.
  • The host is configured for direct device assignment.

Procedure

  1. In the Administration Portal, click ComputeVirtual Machines.
  2. Shut down the virtual machine.
  3. Click the name of the virtual machine to go to the details view.
  4. Click the Host Devices tab.
  5. Click Add device. This opens the Add Host Devices pane.
  6. Use Pinned Host to select the host where the virtual machine runs.
  7. Use Capability to list pci, scsi, nvdimm, or usb_device devices.

    Note

    The nvdimm option is a technical preview feature. For more information, see nvdimm host devices.

  8. Use Available Host Devices to select devices.
  9. Click the down arrow to move devices to Host Devices to be attached.
  10. Click OK to attach these devices to the virtual machine and close the window.
  11. Optional: If you attach a SCSI host device, configure the optimal driver.

    1. Click the Edit button. This opens the Edit Virtual Machine pane.
    2. Click the Custom Properties tab.
    3. Click the Please select a key and select scsi_hostdev from the bottom of the drop-down list.
    4. In most cases, select scsi-hd. Otherwise, for tape or CD changer devices, select the scsi_generic option. For more details, see Virtual Machine Custom Properties Settings Explained.
    5. Click the OK button.
  12. Run the virtual machine.
  13. While the virtual machine starts running, watch for Operation Canceled error messages.

Troubleshooting

If you cannot add a host device to a virtual machine, or a virtual machine cannot start running with the attached host devices, it generates Operation Canceled error messages. For example:

Operation Canceled
Error while executing action:

<vm name>:
* Cannot run VM. There is no host that satisfies current scheduling constraints. See below for details:
* The host <first_hostname> did not satisfy internal filter HostDevice because it does not support host device passthrough.
* The host <second_hostname> did not satisfy internal filter HostDevice because the host does not provide requested host devices.

You can fix the error by removing the host device from the virtual machine or correcting the issues the error message describes. For example:

  • Respond to a The host <hostname> did not satisfy internal filter HostDevice because it does not support host device passthrough message by configuring the host for device passthrough and restarting the virtual machine.
  • Respond to the The host <hostname> did not satisfy internal filter HostDevice because the host does not provide requested host devices message by adding the host device to the host.
  • Respond to a Cannot add Host devices because the VM is in Up status message by shutting down the virtual machine before adding a host device.
  • Verify that the state of the host is Up.

Additional resources

6.10.2. Removing Host Devices from a Virtual Machine

If you are removing all host devices directly attached to the virtual machine in order to add devices from a different host, you can instead add the devices from the desired host, which will automatically remove all of the devices already attached to the virtual machine.

Procedure

  1. Click ComputeVirtual Machines.
  2. Select a virtual machine to go to the details view.
  3. Click the Host Devices tab to list the host devices attached to the virtual machine.
  4. Select the host device to detach from the virtual machine, or hold Ctrl to select multiple devices, and click Remove device. This opens the Remove Host Device(s) window.
  5. Click OK to confirm and detach these devices from the virtual machine.

6.10.3. Pinning a Virtual Machine to Another Host

You can use the Host Devices tab in the details view of a virtual machine to pin it to a specific host.

If the virtual machine has any host devices attached to it, pinning it to another host automatically removes the host devices from the virtual machine.

Pinning a Virtual Machine to a Host

  1. Click a virtual machine name and click the Host Devices tab.
  2. Click Pin to another host. This opens the Pin VM to Host window.
  3. Use the Host drop-down menu to select a host.
  4. Click OK to pin the virtual machine to the selected host.

6.10.4. NVDIMM host devices

Note

NVDIMM devices are Technology Preview features only. Technology Preview features are not supported with Red Hat production service-level agreements (SLAs) and might not be functionally complete, and Red Hat does not recommend using them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information, see Red Hat Technology Preview Features Support Scope.

You can add emulated NVDIMM devices to virtual machines. Elsewhere, this type of memory is also known as virtual NVDIMM or vNVDIMM.

The emulated NVDIMM you can attach to a virtual machine is backed by real NVDIMM on the host machine where the virtual machine runs. Therefore, when you attach NVDIMM to a virtual machine, you also pin the virtual machine to a specific host.

You can reconfigure the mode, partitioning, and other properties of the emulated NVDIMM device in the virtual machine without affecting the settings of the physical NVDIMM on the host device.

To add emulated NVDIMM to a virtual machine, see Adding Host Devices to a Virtual Machine

Limitations

  • Memory snapshots are disabled when an NVDIMM device is present in a virtual machine. There is no way to make a snapshot of NVDIMM content, and a memory snapshot cannot work correctly without having the corresponding NVDIMM data.
  • In RHV, each NVDIMM device passed to a virtual machine has an automatically-assigned label area with a fixed size of 128 KB. IBM POWER hardware, and 128 KB is the minimum label size allowed by QEMU.
  • By default, the virtual machine uses the whole NVDIMM device. You cannot configure the size of the NVDIMM from the virtual machine. To configure its size, partition the NVDIMM device on the host and add the partition to the virtual machine.
  • The size of the NVDIMM device on the virtual machine may be slightly lower than on the host to comply with libvirt and QEMU alignment and size adjustments. Precise sizing is also needed to make memory hotplug work.
  • libvirt and QEMU adjust their size and label placement. If those internal arrangements change, it can cause data loss.
  • NVDIMM hotplug is not supported by the platform.
  • Virtual machines with NVDIMM devices cannot migrate because they are pinned to a host.
  • SELinux currently prevents access to NVDIMM devices in devdax mode. As a result, data persistence cannot be guaranteed if the host fails. See BZ1855336.
Important

Avoid using NVDIMM on IBM POWER hardware. This combination is currently not expected to be stable until further work is completed.