[pve-devel] [RFC common] add and use physical NIC regexp

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon May 22 13:00:33 CEST 2017


On Mon, May 22, 2017 at 12:36:16PM +0200, Alexandre DERUMIER wrote:
> >>+our $PHYSICAL_NIC_RE = qr/(?:eth\d+|en[^:.]+|ib\d+)/;
> 
> can also be p(\d+)p(\d+)
> 
> p1p1
> p1p2
> p2p1
> p2p2
> p2p3
> p2p4
> 
> 
> (pci port / nic port number)

possibly, but I did not want to change the behaviour, just make the code
cleaner ;)

where do you get the pXpY from? the "new" udev names for ethernet
devices all start with "en" followed by one of[1]

 *   b<number>                             — BCMA bus core number
 *   c<bus_id>                             — bus id of a grouped CCW or CCW device,
 *                                           with all leading zeros stripped [s390]
 *   o<index>[n<phys_port_name>|d<dev_port>]
 *                                         — on-board device index number
 *   s<slot>[f<function>][n<phys_port_name>|d<dev_port>]
 *                                         — hotplug slot index number
 *   x<MAC>                                — MAC address
 *   [P<domain>]p<bus>s<slot>[f<function>][n<phys_port_name>|d<dev_port>]
 *                                         — PCI geographical location
 *   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
 *                                         — USB port number chain
 *   v<slot>                               - VIO slot number (IBM PowerVM)
 *   a<vendor><model>i<instance>           — Platform bus ACPI instance id

all of those should be handled by "en[^:.]+".

the non-ethernet prefixes (for wireless lan, wireless wan and serial)
are not relevant for us.

1: https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L29




More information about the pve-devel mailing list