9.18.12.2. Connecting a USB device to a virtual machine


You can configure virtual machine (VM) access to a USB device. This configuration enables the VM to connect to USB hardware that is attached to an OpenShift Container Platform node, as if the hardware and the VM are physically connected.

Prerequisites

  • You have installed the OpenShift CLI (oc).
  • You have attached the required USB device as a resource at the cluster level.

Procedure

  1. In the HyperConverged custom resource (CR), find the assigned resource name of the USB device:

    $ oc get hyperconverged kubevirt-hyperconverged -n openshift-cnv

    Example output

    # ...
      spec:
        permittedHostDevices:
          usbHostDevices:
            - resourceName: kubevirt.io/peripherals
              selectors:
                - vendor: "045e"
                  product: "07a5"
                - vendor: "062a"
                  product: "4102"
                - vendor: "072f"
                  product: "b100"
  2. Open the VM instance CR:

    $ oc edit vmi <vmi_usb>

    where:

    <vmi_usb>
    Specifies the name of the VirtualMachineInstance CR.
  3. Edit the CR by adding the USB device, as shown in the following example:

    Example configuration

    apiVersion: kubevirt.io/v1
    kind: VirtualMachineInstance
    metadata:
      labels:
        special: vmi-usb
      name: vmi-usb
    spec:
      domain:
        devices:
          hostDevices:
          - deviceName: kubevirt.io/peripherals
            name: local-peripherals
    # ...
    • spec.domain.devices.hostDevices.name defines the name of the USB device.
  4. Apply the modifications to the VM configurations:

    $ oc apply -f <filename>.yaml

    where:

    <filename>
    Specifies the name of the VirtualMachineInstance manifest YAML file.
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る