[pve-devel] [PATCH V2 pve-network] vlan/qinq: use vlan-raw-device to support long predictable interfaces name

Alexandre Derumier aderumier at odiso.com
Sat Jan 11 13:48:50 CET 2020


users have reported in the forum some crazy long interfaces names
like "enp0s20f0u8u2c2".
So they are no space for create a "enp0s20f0u8u2c2.vlan".

changelog V2:

small fix with reclared ifaces_variable

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Network/SDN/Zones/QinQPlugin.pm | 18 ++++++++++++------
 PVE/Network/SDN/Zones/VlanPlugin.pm |  8 ++++----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm
index d36f0d8..d3f4b7d 100644
--- a/PVE/Network/SDN/Zones/QinQPlugin.pm
+++ b/PVE/Network/SDN/Zones/QinQPlugin.pm
@@ -52,18 +52,24 @@ sub generate_sdn_config {
 
     my $iface = PVE::Network::SDN::Zones::Plugin::get_uplink_iface($interfaces_config, $uplink);
 
-    $iface .= ".$zone_tag";
-
-    #tagged interface
+    #service vlan
     my @iface_config = ();
+    push @iface_config, "vlan-raw-device $iface";
+    push @iface_config, "vlan-id $zone_tag";
     push @iface_config, "vlan-protocol $vlanprotocol" if $vlanprotocol;
     push @iface_config, "mtu $mtu" if $mtu;
-    push(@{$config->{$iface}}, @iface_config) if !$config->{$iface};
+    push(@{$config->{"qinq$zoneid"}}, @iface_config) if !$config->{$iface};
+
+    #customer vlan
+    @iface_config = ();
+    push @iface_config, "vlan-raw-device qinq$zoneid";
+    push @iface_config, "vlan-id $tag";
+    push @iface_config, "mtu $mtu" if $mtu;
+    push(@{$config->{"vlan$vnetid"}}, @iface_config) if !$config->{$iface};
 
-    $iface .= ".$tag";
     #vnet bridge
     @iface_config = ();
-    push @iface_config, "bridge_ports $iface";
+    push @iface_config, "bridge_ports vlan$vnetid";
     push @iface_config, "bridge_stp off";
     push @iface_config, "bridge_fd 0";
     push @iface_config, "mtu $mtu" if $mtu;
diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm b/PVE/Network/SDN/Zones/VlanPlugin.pm
index 63db8ab..af76b43 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -50,16 +50,16 @@ sub generate_sdn_config {
 
     my $iface = PVE::Network::SDN::Zones::Plugin::get_uplink_iface($interfaces_config, $uplink);
 
-    $iface .= ".$tag";
-
     #tagged interface
     my @iface_config = ();
     push @iface_config, "mtu $mtu" if $mtu;
-    push(@{$config->{$iface}}, @iface_config) if !$config->{$iface};
+    push @iface_config, "vlan-raw-device $iface";
+    push @iface_config, "vlan-id $tag";
+    push(@{$config->{"vlan$vnetid"}}, @iface_config) if !$config->{$iface};
 
     #vnet bridge
     @iface_config = ();
-    push @iface_config, "bridge_ports $iface";
+    push @iface_config, "bridge_ports vlan$vnetid";
     push @iface_config, "bridge_stp off";
     push @iface_config, "bridge_fd 0";
     push @iface_config, "mtu $mtu" if $mtu;
-- 
2.20.1




More information about the pve-devel mailing list