assign PCI slot for VM's NIC persistently

Bug #1821089 reported by Pavel Vaylov
74
This bug affects 18 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

Nova doesn't care about PCI slot number where virtual NIC is attached.
As a result guests (recent Ubuntu for example) in which NIC name depends on PCI slot number rename interfaces in circumstances described below:

1. Launch VM using Ubuntu cloud image with 1 interface.

Name of the interface will be like "ens3"

$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon

2. Attach more interfaces (nova interface-attach).

Attached interfaces will get names like "ens7"

$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon
00:07.0 Ethernet controller: Red Hat, Inc Virtio network device

3. Do "nova reboot --hard" for this VM (this action regenerates XML in Libvirt).

Interfaces "ens7" will be renamed to "ens4" since Libvirt XML for this VM will be recreated.

lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 Ethernet controller: Red Hat, Inc Virtio network device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:07.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon

4. Compare names of interfaces after step 2 and step 3.

Same happens after interfaces detached:
For example if VM has ens3, ens4, ens5 then detach ens4 then ens5 will be renamed to renamed on hard reboot.

Ideally I would expect from Nova to assign PCI slot number to attached devices and keep this assignment in XML in /var/lib/nova/instances/<instanceUUID>/libvirt.xml

OpenStack version: Newton (newer versions also affected)
hypervisor: Libvirt+KVM
networking type: Neutron with OpenVSwitch

Tags: pci
tags: added: pci
Revision history for this message
Spencer Yu (yushb) wrote :

Does someone have some idea of this bug?

Revision history for this message
sean mooney (sean-k-mooney) wrote :

Stable device naming within the guest is OS dependent and strictly out of scope of nova to fix.
nova does not chose the address at which device are attached and the nova api doe not
guarentee stable nic ordering. the vm pci adress is determined by libvirt.

the device role tagging feature was developed for this usecase specifically so that vms could determin the mapping
between device that are exposed to the guest and the openstack resouce the correspond to in a hyperviors and os independent way. https://specs.openstack.org/openstack/nova-specs/specs/mitaka/approved/virt-device-role-tagging.html

Changed in nova:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.