1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nw-sriov-network-attachment.adoc
2026-01-09 17:15:12 +00:00

203 lines
6.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/hardware_networks/configuring-sriov-net-attach.adoc
// * virt/vm_networking/virt-connecting-vm-to-sriov.adoc
// * virt/post_installation_configuration/virt-post-install-network-config.adoc
// Note: IB does not support ipam with `type=dhcp`.
ifeval::["{context}" == "configuring-sriov-net-attach"]
:rs: SriovNetwork
:ocp-sriov-net:
:object: pods
endif::[]
ifeval::["{context}" == "configuring-sriov-ib-attach"]
:rs: SriovIBNetwork
:ocp-sriov-net:
:object: pods
endif::[]
ifeval::["{context}" == "virt-connecting-vm-to-sriov"]
:rs: SriovNetwork
:virt-sriov-net:
:object: pods or virtual machines
endif::[]
:_mod-docs-content-type: PROCEDURE
ifdef::ocp-sriov-net[]
[id="nw-sriov-network-attachment_{context}"]
= Configuring SR-IOV additional network
[role="_abstract"]
You can configure an additional network that uses SR-IOV hardware by creating an `{rs}` object.
When you create an `{rs}` object, the SR-IOV Network Operator automatically creates a `NetworkAttachmentDefinition` object.
[NOTE]
=====
Do not modify or delete an `{rs}` object if it is attached to any {object} in a `running` state.
=====
.Prerequisites
* Install the {oc-first}.
* Log in as a user with `cluster-admin` privileges.
.Procedure
. Create a `{rs}` object, and then save the YAML in the `<name>.yaml` file, where `<name>` is a name for this additional network. The object specification might resemble the following example:
+
[source,yaml,subs="attributes+"]
----
apiVersion: sriovnetwork.openshift.io/v1
kind: {rs}
metadata:
name: attach1
namespace: openshift-sriov-network-operator
spec:
resourceName: net1
networkNamespace: project2
ipam: |-
{
"type": "host-local",
"subnet": "10.56.217.0/24",
"rangeStart": "10.56.217.171",
"rangeEnd": "10.56.217.181",
"gateway": "10.56.217.1"
}
----
. To create the object, enter the following command:
+
[source,terminal]
----
$ oc create -f <name>.yaml
----
+
where `<name>` specifies the name of the additional network.
. Optional: To confirm that the `NetworkAttachmentDefinition` object that is associated with the `{rs}` object that you created in the previous step exists, enter the following command. Replace `<namespace>` with the `networkNamespace` value you specified in the `{rs}` object.
+
[source,terminal]
----
$ oc get net-attach-def -n <namespace>
----
endif::ocp-sriov-net[]
// LEGACY
ifdef::virt-sriov-net[]
[id="nw-sriov-network-attachment_{context}"]
= Configuring SR-IOV additional network
You can configure an additional network that uses SR-IOV hardware by creating an `{rs}` object.
When you create an `{rs}` object, the SR-IOV Network Operator automatically creates a `NetworkAttachmentDefinition` object.
[NOTE]
=====
Do not modify or delete an `{rs}` object if it is attached to {object} in a `running` state.
=====
.Prerequisites
* Install the {oc-first}.
* Log in as a user with `cluster-admin` privileges.
.Procedure
. Create the following `SriovNetwork` object, and then save the YAML in the `<name>-sriov-network.yaml` file. Replace `<name>` with a name for this additional network.
+
[source,yaml]
----
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
name: <name>
namespace: openshift-sriov-network-operator
spec:
resourceName: <sriov_resource_name>
networkNamespace: <target_namespace>
vlan: <vlan>
spoofChk: "<spoof_check>"
linkState: <link_state>
maxTxRate: <max_tx_rate>
minTxRate: <min_rx_rate>
vlanQoS: <vlan_qos>
trust: "<trust_vf>"
capabilities: <capabilities>
ifdef::ocp-sriov-net[]
ipam: {}
linkState: <link_state>
maxTxRate: <max_tx_rate>
minTxRate: <min_tx_rate>
vlanQoS: <vlan_qos>
trust: "<trust_vf>"
capabilities: <capabilities>
endif::ocp-sriov-net[]
----
+
`metadata.name`:: Specify a name for the `SriovNetwork` object. The SR-IOV Network Operator creates a `NetworkAttachmentDefinition` object with same name.
`metadata.namespace`:: Specify the namespace where the SR-IOV Network Operator is installed.
`spec.resourceName`:: Specify the value of the `.spec.resourceName` parameter in the `SriovNetworkNodePolicy` object that defines the SR-IOV hardware for this additional network.
`spec.networkNamespace`:: Specify the target namespace for the `SriovNetwork` object. Only {object} in the target namespace can attach to the `SriovNetwork` object.
`spec.vlan`:: Optional: Specify a Virtual LAN (VLAN) ID for the additional network. The integer value must be from `0` to `4095`. The default value is `0`.
`spec.spoofChk`:: Optional: Specify the spoof check mode of the VF. The allowed values are the strings `"on"` and `"off"`.
+
[IMPORTANT]
====
You must enclose the value you specify in quotes or the CR is rejected by the SR-IOV Network Operator.
====
`spec.linkState`:: Optional: Specify the link state of virtual function (VF). Allowed values are `enable`, `disable` and `auto`.
`spec.maxTxRate`:: Optional: Specify the maximum transmission rate, in Mbps, for the VF.
`spec.minTxRate`:: Optional: Specify the minimum transmission rate, in Mbps, for the VF. This value should always be less than or equal to the maximum transmission rate.
+
[NOTE]
====
Intel NICs do not support the `minTxRate` parameter. For more information, see link:https://bugzilla.redhat.com/show_bug.cgi?id=1772847[BZ#1772847].
====
`spec.vlanQoS`:: Optional: Specify the IEEE 802.1p priority level for the VF. The default value is `0`.
`spec.trust`:: Optional: Specify the trust mode of the VF. The allowed values are the strings `"on"` and `"off"`.
+
[IMPORTANT]
====
You must enclose the value you specify in quotes or the CR is rejected by the SR-IOV Network Operator.
====
`spec.capabilities`:: Optional: Specify the capabilities to configure for this network.
ifdef::ocp-sriov-net[]
You can specify `"{ "ips": true }"` to enable IP address support or `"{ "mac": true }"` to enable MAC address support.
`spec.capabilities`:: Specify a configuration object for the IPAM CNI plugin as a YAML block scalar. The plugin manages IP address assignment for the attachment definition.
endif::ocp-sriov-net[]
[start=2]
. To create the object, enter the following command. Replace `<name>` with a name for this additional network.
+
[source,terminal]
----
$ oc create -f <name>-sriov-network.yaml
----
. Optional: To confirm that the `NetworkAttachmentDefinition` object associated with the `SriovNetwork` object that you created in the previous step exists, enter the following command. Replace `<namespace>` with the namespace you specified in the `SriovNetwork` object.
+
[source,terminal]
----
$ oc get net-attach-def -n <namespace>
----
// LEGACY
endif::virt-sriov-net[]
ifdef::object[]
:!object:
endif::[]
ifdef::rs[]
:!rs:
endif::[]
ifeval::["{context}" == "virt-connecting-vm-to-sriov"]
:!virt-sriov-net:
endif::[]
ifeval::["{context}" == "configuring-sriov-net-attach"]
:!ocp-sriov-net:
endif::[]