You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an administrator, you can create mediated devices and expose them to the cluster by editing the `HyperConverged` custom resource (CR).
9
+
As an administrator, you can create mediated devices and expose them to the cluster by editing the `HyperConverged` custom resource (CR). Before you edit the CR, explore a worker node to find the configuration values that are specific to your hardware devices.
10
10
11
11
.Prerequisites
12
12
13
-
* You have installed the {oc-first}.
13
+
* You installed the {oc-first}.
14
14
* You enabled the Input-Output Memory Management Unit (IOMMU) driver.
15
15
* If your hardware vendor provides drivers, you installed them on the nodes where you want to create mediated devices.
16
16
** If you use NVIDIA cards, you link:https://docs.nvidia.com/datacenter/cloud-native/openshift/latest/openshift-virtualization.html[installed the NVIDIA GRID driver].
17
17
18
+
// [IMPORTANT]
19
+
// ====
20
+
// Before {VirtProductName} 4.14, the `mediatedDeviceTypes` field was named `mediatedDevicesTypes`. Ensure that you use the correct field name when configuring mediated devices.
21
+
// ====
22
+
18
23
.Procedure
19
24
25
+
. Identify the name selector and resource name values for the mediated devices by exploring a worker node:
26
+
27
+
.. Start a debugging session with the worker node by using the `oc debug` command. For example:
28
+
+
29
+
[source,terminal]
30
+
----
31
+
$ oc debug node/node-11.redhat.com
32
+
----
33
+
34
+
.. Change the root directory of the shell process to the file system of the host node by running the following command:
35
+
+
36
+
[source,terminal]
37
+
----
38
+
# chroot /host
39
+
----
40
+
41
+
.. Navigate to the `mdev_bus` directory and view its contents. Each subdirectory name is a PCI address of a physical GPU. For example:
42
+
+
43
+
[source,terminal]
44
+
----
45
+
# cd sys/class/mdev_bus && ls
46
+
----
47
+
+
48
+
Example output:
49
+
+
50
+
[source,terminal]
51
+
----
52
+
0000:4b:00.4
53
+
----
54
+
55
+
.. Go to the directory for your physical device and list the supported mediated device types as defined by the hardware vendor. For example:
. Create and expose the mediated devices by updating the configuration:
92
+
93
+
.. Create mediated devices by adding them to the `spec.mediatedDevicesConfiguration` stanza.
94
+
95
+
.. Expose the mediated devices to the cluster by adding the `mdevNameSelector` and `resourceName` values to the `spec.permittedHostDevices.mediatedDevices` stanza. The `resourceName` value is based on the `mdevNameSelector` value, but you use underscores instead of spaces.
96
+
+
97
+
Example `HyperConverged` CR:
26
98
+
27
-
.Example configuration file with mediated devices configured
28
-
[%collapsible]
29
-
====
30
99
[source,yaml,subs="attributes+"]
31
100
----
32
101
apiVersion: hco.kubevirt.io/v1
@@ -37,87 +106,45 @@ metadata:
37
106
spec:
38
107
mediatedDevicesConfiguration:
39
108
mediatedDeviceTypes:
40
-
- nvidia-231
109
+
- nvidia-745
41
110
nodeMediatedDeviceTypes:
42
111
- mediatedDeviceTypes:
43
-
- nvidia-233
112
+
- nvidia-746
44
113
nodeSelector:
45
114
kubernetes.io/hostname: node-11.redhat.com
46
115
permittedHostDevices:
47
116
mediatedDevices:
48
-
- mdevNameSelector: GRID T4-2Q
49
-
resourceName: nvidia.com/GRID_T4-2Q
50
-
- mdevNameSelector: GRID T4-8Q
51
-
resourceName: nvidia.com/GRID_T4-8Q
52
-
# ...
53
-
----
54
-
====
55
-
56
-
. Create mediated devices by adding them to the `spec.mediatedDevicesConfiguration` stanza:
57
-
+
58
-
.Example YAML snippet
59
-
[source,yaml]
60
-
----
61
-
# ...
62
-
spec:
63
-
mediatedDevicesConfiguration:
64
-
mediatedDeviceTypes: <1>
65
-
- <device_type>
66
-
nodeMediatedDeviceTypes: <2>
67
-
- mediatedDeviceTypes: <3>
68
-
- <device_type>
69
-
nodeSelector: <4>
70
-
<node_selector_key>: <node_selector_value>
117
+
- mdevNameSelector: NVIDIA A2-2Q
118
+
resourceName: nvidia.com/NVIDIA_A2-2Q
119
+
- mdevNameSelector: NVIDIA A2-4Q
120
+
resourceName: nvidia.com/NVIDIA_A2-4Q
71
121
# ...
72
122
----
73
-
<1> Required: Configures global settings for the cluster.
74
-
<2> Optional: Overrides the global configuration for a specific node or group of nodes. Must be used with the global `mediatedDeviceTypes` configuration.
75
-
<3> Required if you use `nodeMediatedDeviceTypes`. Overrides the global `mediatedDeviceTypes` configuration for the specified nodes.
76
-
<4> Required if you use `nodeMediatedDeviceTypes`. Must include a `key:value` pair.
77
123
+
78
-
[IMPORTANT]
79
-
====
80
-
Before {VirtProductName} 4.14, the `mediatedDeviceTypes` field was named `mediatedDevicesTypes`. Ensure that you use the correct field name when configuring mediated devices.
81
-
====
124
+
where:
82
125
83
-
. Identify the name selector and resource name values for the devices that you want to expose to the cluster. You will add these values to the `HyperConverged` CR in the next step.
84
-
.. Find the `resourceName` value by running the following command:
`mediatedDeviceTypes`:: Specifies global settings for the cluster and is required.
93
127
94
-
.. Find the `mdevNameSelector` value by viewing the contents of `/sys/bus/pci/devices/<slot>:<bus>:<domain>.<function>/mdev_supported_types/<type>/name`, substituting the correct values for your system.
95
-
+
96
-
For example, the name file for the `nvidia-231` type contains the selector string `GRID T4-2Q`. Using `GRID T4-2Q` as the `mdevNameSelector` value allows nodes to use the `nvidia-231` type.
128
+
`nodeMediatedDeviceTypes`:: Specifies global configuration overrides for a specific node or group of nodes and is optional. Must be used with the global `mediatedDeviceTypes` configuration.
97
129
98
-
. Expose the mediated devices to the cluster by adding the `mdevNameSelector` and `resourceName` values to the
99
-
`spec.permittedHostDevices.mediatedDevices` stanza of the `HyperConverged` CR:
100
-
+
101
-
.Example YAML snippet
102
-
[source,yaml]
103
-
----
104
-
# ...
105
-
permittedHostDevices:
106
-
mediatedDevices:
107
-
- mdevNameSelector: GRID T4-2Q <1>
108
-
resourceName: nvidia.com/GRID_T4-2Q <2>
109
-
# ...
110
-
----
111
-
<1> Exposes the mediated devices that map to this value on the host.
112
-
<2> Matches the resource name that is allocated on the node.
130
+
`mediatedDeviceTypes`:: Specifies an override to the global `mediatedDeviceTypes` configuration for the specified nodes. Required if you use `nodeMediatedDeviceTypes`.
131
+
132
+
`nodeSelector`:: Specifies the node selector and must include a `key:value` pair. Required if you use `nodeMediatedDeviceTypes`.
133
+
134
+
`mdevNameSelector`:: Specifies the mediated devices that map to this value on the host.
135
+
136
+
`resourceName`:: Specifies the matching resource name that is allocated on the node.
113
137
114
138
. Save your changes and exit the editor.
115
139
116
140
.Verification
117
141
118
-
* Optional: Confirm that a device was added to a specific node by running the following command:
142
+
* Confirm that the virtual GPU is attached to the node by running the following command:
0 commit comments