From: Alexandre Derumier Date: Tue, 22 Sep 2015 06:26:58 +0000 (+0200) Subject: read|write network interfaces : add support for vlan interfaces X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=9c8089450c1ffdcb075721d9e3aac6320944936b read|write network interfaces : add support for vlan interfaces Signed-off-by: Alexandre Derumier --- diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 22f01d1..1c364ba 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -961,6 +961,14 @@ sub __read_etc_network_interfaces { $ifaces->{$1}->{exists} = 0; $d->{exists} = 0; } + } elsif ($iface =~ m/^(\S+)\.\d+$/) { + $d->{type} = 'vlan'; + if (defined ($ifaces->{$1})) { + $d->{exists} = $ifaces->{$1}->{exists}; + } else { + $ifaces->{$1}->{exists} = 0; + $d->{exists} = 0; + } } elsif ($iface =~ m/^eth\d+$/) { if (!$d->{ovs_type}) { $d->{type} = 'eth'; @@ -1291,24 +1299,24 @@ NETWORKDOC my $lookup_type_prio = sub { my $iface = shift; - my $alias = 0; - if ($iface =~ m/^(\S+):\d+$/) { + my $child = 0; + if ($iface =~ m/^(\S+)(\.|:)\d+$/) { $iface = $1; - $alias = 1; + $child = 1; } my $pri; if ($iface eq 'lo') { $pri = $if_type_hash->{loopback}; } elsif ($iface =~ m/^eth\d+$/) { - $pri = $if_type_hash->{eth} + $alias; + $pri = $if_type_hash->{eth} + $child; } elsif ($iface =~ m/^bond\d+$/) { - $pri = $if_type_hash->{bond} + $alias; + $pri = $if_type_hash->{bond} + $child; } elsif ($iface =~ m/^vmbr\d+$/) { - $pri = $if_type_hash->{bridge} + $alias; + $pri = $if_type_hash->{bridge} + $child; } - return $pri || ($if_type_hash->{unknown} + $alias); + return $pri || ($if_type_hash->{unknown} + $child); }; foreach my $iface (sort {