CPS instances require that network interfaces be assigned IP addresses statically. The names of network interfaces (eth0, eth1, and so on) are assumed to reflect network interfaces representing neutron ports passed to OpenStack nova-boot or heat template in that order. In this case, eth0 is assumed to reflect the first neutron port, eth1 the second, and so on.
For CPS deployments on OpenStack which use SR-IOV, often two or more network drivers are used. When more than one network driver is used, network interface names can become unpredictable and can change based on the order in which the network drivers are loaded into the kernel.
The following section describes how to map a network interface for a given network drivers type to its correct expected name in the guest OS.
Correct IP address assignment requires that network names used in the network interfaces file must match the name of the network interface in the guest OS.
The order of neutron ports of a given type (non-SR-IOV or SR-IOV) in nova-boot or heat template directly maps to the order of the PCI device slot of the associated network interfaces in the guest OS.
The mapping between the network interface of a given network driver type and network driver name are passed during the creation of an instance through the cloud-init configuration.
The expected network interface name configuration is passed into CPS instance’s guest OS using a YAML format configuration file located at: /var/lib/cloud/instance/payload/ifrename.yaml.
The file should have a section for each driver type and list the interfaces for that driver type with the following information:
Rank order (0, 1, 2…) for the interface among other interfaces of the same driver type, as is specified in the nova boot command/heat template
Expected name of the interface (eth0, eth1, eth2 etc.)
- path: /var/lib/cloud/instance/payload/ifrename.yaml
0 : eth0
0 : eth1
1 : eth2
Driver names for SR-IOV ports can be determined by checking the interface card vendor documentation. For regular virtio ports, the driver name is ‘virtio_net’.
This ifrename.yaml file must be added in the existing write_files: section of cloud-init configurations for each CPS VM.
The configuration file above instructs cloud-init to create a file ifrename.yaml at /var/lib/cloud/instance/payload, owned by root, with permissions of 644 and contents as mentioned in “content:” section. In this example:
the first SR-IOV neutron port (managed by ‘ixgbevf’ driver) is mapped to to eth1
the second SR-IOV port (managed by ‘ixgbevf’ driver) is mapped to eth2
the only non-SR-IOV port (managed by ‘virtio-net’ driver) to eth0.
Regardless of the order in which neutron ports are passed, or order in which network drivers are loaded, this configuration file specifies which network interface name should go to which network interface.