Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 20 additions & 36 deletions modules/virt-enabling-usb-host-passthrough.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,54 +77,38 @@ Device: 3-7
----


. Add the required USB device to the `permittedHostDevices` stanza of the `HyperConvered` CR. The following example adds a device with vendor ID `045e` and product ID `07a5`:
. Open the `HyperConverged` CR in your default editor by running the following command:
+
[source,terminal,subs="attributes+"]
----
oc patch {HCOCliKind} kubevirt-hyperconverged \
-n {CNVNamespace} \
--type=merge \
-p '{
"metadata": {
"annotations": {
"kubevirt.kubevirt.io/jsonpatch": "[{\"op\": \"add\", \"path\": \"/spec/permittedHostDevices/usbHostDevices/-\", \"value\": {\"resourceName\": \"kubevirt.io/peripherals\", \"selectors\": [{\"vendor\": \"045e\", \"product\": \"07a5\"}]}}]"
}
}
}'
$ oc edit {HCOCliKind} kubevirt-hyperconverged -n {CNVNamespace}
----

.Verification

* Ensure that the HCO CR contains the required USB devices:
. Add the required USB device to the `permittedHostDevices` stanza of the `HyperConvered` CR. The following example adds a device with vendor ID `045e` and product ID `07a5`:
+
[source,terminal,subs="attributes+"]
----
$ oc get {HCOCliKind} kubevirt-hyperconverged -n {CNVNamespace}
----
+
*Example output*
+
[source,yaml,subs="attributes+"]
[source,yaml,highlight=11..12,subs="attributes+"]
----
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
namespace: {CNVNamespace}
name: kubevirt-hyperconverged
namespace: {CNVNamespace}
spec:
permittedHostDevices: <1>
usbHostDevices: <2>
- resourceName: kubevirt.io/peripherals <3>
selectors:
- vendor: "045e"
product: "07a5"
- vendor: "062a"
product: "4102"
- vendor: "072f"
product: "b100"

permittedHostDevices:
usbHostDevices:
- resourceName: kubevirt.io/peripherals
selectors:
- vendor: "045e"
product: "07a5"
- vendor: "062a"
product: "4102"
- vendor: "072f"
product: "b100"
----
+
* `spec.permittedHostDevices` defines the host devices that have permission to be used in the cluster.
* `spec.permittedHostDevices.usbHostDevices` defines the available USB devices.
* Use `resourceName: deviceName` for each device you want to add and assign to the VM. In this example, the resource is bound to three devices, each of which is identified by `vendor` and `product` and is known as a `selector`.
* `spec.permittedHostDevices.usbHostDevices` defines a list of available USB devices.
* `spec.permittedHostDevices.usbHostDevices.resourceName` defines the USB device that you want to add and assign to the
VM. In this example, the resource is bound to three devices, each of which is identified by `vendor` and `product` and
is known as a `selector`.