[pve-devel] [PATCH common] support for udev-systemd-style physical interface names (like enp3s0)

Dietmar Maurer dietmar at proxmox.com
Tue May 10 10:33:44 CEST 2016


comments inline:

> Signed-off-by: Igor Vlasenko <viy at altlinux.org>
> ---
>  src/PVE/INotify.pm | 8 ++++----
>  src/PVE/Network.pm | 6 +++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> index 74a0fe1..06c5aa5 100644
> --- a/src/PVE/INotify.pm
> +++ b/src/PVE/INotify.pm
> @@ -800,7 +800,7 @@ sub __read_etc_network_interfaces {
> 
>      if ($proc_net_dev) {
>      while (defined ($line = <$proc_net_dev>)) {
> -        if ($line =~ m/^\s*(eth\d+):.*/) {
> +        if ($line =~ m/^\s*(eth\d+|enp\d+s\d+):.*/) {
>          $ifaces->{$1}->{exists} = 1;
>          }
>      }
> @@ -973,7 +973,7 @@ sub __read_etc_network_interfaces {
>          $ifaces->{$1}->{exists} = 0;
>          $d->{exists} = 0;
>          }
> -    } elsif ($iface =~ m/^eth\d+$/) {
> +    } elsif ($iface =~ m/^(?:eth\d+|enp\d+s\d+)$/) {
>          if (!$d->{ovs_type}) {
>          $d->{type} = 'eth';
>          } elsif ($d->{ovs_type} eq 'OVSPort') {
> @@ -1200,7 +1200,7 @@ sub __write_etc_network_interfaces {
>          $d->{type} eq 'OVSBond') {
>          my $brname = $used_ports->{$iface};
>          if (!$brname || !$ifaces->{$brname}) {
> -        if ($iface =~ /^eth/) {
> +        if ($iface =~ /^(?:eth|enp)/) {
>              $ifaces->{$iface} = { type => 'eth',
>                        exists => 1,
>                        method => 'manual',
> @@ -1289,7 +1289,7 @@ NETWORKDOC
>      my $pri;
>      if ($iface eq 'lo') {
>          $pri = $if_type_hash->{loopback};
> -    } elsif ($iface =~ m/^eth\d+$/) {
> +    } elsif ($iface =~ m/^(?:eth\d+|enp\d+s\d+)$/) {
>          $pri = $if_type_hash->{eth} + $child;
>      } elsif ($iface =~ m/^bond\d+$/) {
>          $pri = $if_type_hash->{bond} + $child;
> diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
> index bda2067..81c2e77 100644
> --- a/src/PVE/Network.pm
> +++ b/src/PVE/Network.pm
> @@ -131,10 +131,10 @@ my $parse_tap_device_name = sub {
> 
>      my ($vmid, $devid);
> 
> -    if ($iface =~ m/^tap(\d+)i(\d+)$/) {
> +    if ($iface =~ m/^tap(\d+)i(\d+(?:s\d+)?)$/) {

why is this required?

>      $vmid = $1;
>      $devid = $2;
> -    } elsif ($iface =~ m/^veth(\d+)i(\d+)$/) {
> +    } elsif ($iface =~ m/^veth(\d+)i(\d+(?:s\d+)?)$/) {

why?




More information about the pve-devel mailing list