USB(Universal Serial Bus) pass-through feature enables you to access and manage USB devices from a virtual machine.
Some applications running in virtual machines (VMs) have encryption requirements and need to interact with dedicated USB devices. In such cases, it is necessary to passthrough the USB devices from the host machine to the VM.
To assign a USB device to a VM, the USB device must be exposed via a ResourceName. This can be configured by editing the spec.permittedHostDevices.usbHostDevices
section in the HyperConverged CR under the kubevirt namespace.
Below is an example configuration for a USB device with ResourceName kubevirt.io/storage, where the vendor is 0bda
and the product is 8812
:
The vendor and product identifiers of a USB device can be obtained using the lsusb
command.
For example:
This command lists all connected USB devices, where ID displays the vendor:product pair.
Now, in the VM configuration, you can add spec.domain.devices.hostDevices.deviceName
to reference the ResourceName
provided in the previous step and assign it a local name.
For example:
Ensure the VM is stopped before editing the configuration.
After completing the configuration, execute the lsusb
command within the virtual machine. If the output lists the host node's USB device, the passthrough was successful.
For example:
You may want to passthrough multiple USB devices to a virtual machine, such as a keyboard, mouse, or smart card device. We support assigning multiple USB devices under the same resourceName. Here's how to configure it:
Note: All USB devices must be physically connected and detected on the host to ensure successful assignment to the virtual machine.