1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

[RFC] better naming for Azure MANA network devices (#34255)

The Azure MANA folks would like the PCI domain to be suppressed from
naming network interfaces. Let's introduce a somewhat generic way to do
this, without hardcoding anything to Azure.

Specifically: we'll ship a new hwdb entry that sets a new
ID_NET_NAME_INCLUDE_DOMAIN=0 property on relevant MANA devices. Then we
make net_id look for that property, and if it is set we simply suppress
the PCI domain.

(Untested as of now, needs feedback from Azure MANA folks that this
actually works and does what is requested here).
This commit is contained in:
Lennart Poettering 2024-12-20 09:52:40 +01:00 committed by GitHub
commit cdcb1eeeb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -3,3 +3,7 @@
# Dell iDRAC Virtual USB NIC # Dell iDRAC Virtual USB NIC
usb:v413CpA102* usb:v413CpA102*
ID_NET_NAME_FROM_DATABASE=idrac ID_NET_NAME_FROM_DATABASE=idrac
# Disable inclusion of PCI domain in interface names on Azure MANA
pci:v00001414d000000BA*
ID_NET_NAME_INCLUDE_DOMAIN=0

View File

@ -650,7 +650,16 @@ static int get_pci_slot_specifiers(
* where the slot makes up the upper 5 bits. */ * where the slot makes up the upper 5 bits. */
func += slot * 8; func += slot * 8;
if (domain > 0 && asprintf(&domain_spec, "P%u", domain) < 0) /* Include the PCI domain in the name if the ID_NET_NAME_INCLUDE_DOMAIN property says so, if it is
* set. If it is not set, include it if the domain is non-zero. */
r = device_get_property_bool(dev, "ID_NET_NAME_INCLUDE_DOMAIN");
if (r < 0) {
if (r != -ENOENT)
log_device_warning_errno(dev, r, "Failed to read property \"ID_NET_NAME_INCLUDE_DOMAIN\", ignoring: %m");
r = domain > 0;
}
if (r > 0 && asprintf(&domain_spec, "P%u", domain) < 0)
return log_oom_debug(); return log_oom_debug();
if (asprintf(&bus_and_slot_spec, "p%us%u", bus, slot) < 0) if (asprintf(&bus_and_slot_spec, "p%us%u", bus, slot) < 0)