10.8.3. Connecting a virtual machine to an SR-IOV network by using the CLI
You can connect the virtual machine (VM) to the SR-IOV network by including the network details in the VM configuration.
Prerequisites
-
You have installed the OpenShift CLI (
oc).
Procedure
Add the SR-IOV network details to the
spec.domain.devices.interfacesandspec.networksstanzas of the VM configuration as in the following example:apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: name: example-vm spec: domain: devices: interfaces: - name: nic1 sriov: {} networks: - name: nic1 multus: networkName: sriov-network # ...-
spec.template.spec.domain.devices.interfaces.namespecifies a unique name for the SR-IOV interface. -
spec.template.spec.networks.namespecifies the name of the SR-IOV interface. This must be the same as theinterfaces.namethat you defined earlier. -
spec.template.spec.networks.multus.networkNamespecifies the name of the SR-IOV network attachment definition.
-
Apply the virtual machine configuration:
$ oc apply -f <vm_sriov>.yamlwhere:
<vm_sriov>- Specifies the name of the virtual machine YAML file.