assign PCI slot for VM's NIC persistently

Bug #1821089 reported by Pavel Vaylov on 2019-03-20
62
This bug affects 15 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
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 Edit Tag help
tags: added: pci
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers