Attaching a virtual machine to an SR-IOV network

You can attach a virtual machine to use a Single Root I/O Virtualization (SR-IOV) network as a secondary network.

Prerequisites

Attaching a virtual machine to an SR-IOV network

You can attach the virtual machine to the SR-IOV network by including the network details in the virtual machine configuration.

Procedure

  1. Include the SR-IOV network details in the spec.domain.devices.interfaces and spec.networks of the virtual machine configuration:

    1. kind: VirtualMachine
    2. ...
    3. spec:
    4. domain:
    5. devices:
    6. interfaces:
    7. - name: <default> (1)
    8. masquerade: {} (2)
    9. - name: <nic1> (3)
    10. sriov: {}
    11. networks:
    12. - name: <default> (4)
    13. pod: {}
    14. - name: <nic1> (5)
    15. multus:
    16. networkName: <sriov-network> (6)
    17. ...
    1A unique name for the interface that is connected to the pod network.
    2The masquerade binding to the default pod network.
    3A unique name for the SR-IOV interface.
    4The name of the pod network interface. This must be the same as the interfaces.name that you defined earlier.
    5The name of the SR-IOV interface. This must be the same as the interfaces.name that you defined earlier.
    6The name of the SR-IOV network attachment definition.
  2. Apply the virtual machine configuration:

    1. $ oc apply -f <vm-sriov.yaml> (1)
    1The name of the virtual machine YAML file.