public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-network 0/3] zones: qinq : fix mutiples vnets/qinq zones
@ 2021-04-29 10:14 Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 1/3] zones: qinq: ovs: fix duplicate ovs_ports with multiple zones/vnets Alexandre Derumier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexandre Derumier @ 2021-04-29 10:14 UTC (permalink / raw)
  To: pve-devel

This fix bugs with qinq when vmbr0 is ovs or classic bridge,
when we define multiple vnets/qinq zones


Alexandre Derumier (3):
  zones: qinq: ovs: fix duplicate ovs_ports with multiple zones/vnets
  zones: qinq: classic bridge: fix bridge zone name with multiple
    zones/vnets
  zones: qinq: vlanaware bridge: add tests with multiple vnets/zones

 PVE/Network/SDN/Zones/QinQPlugin.pm           | 10 +++---
 .../zones/qinq/bridge/expected_sdn_interfaces | 33 +++++++++++++++++--
 test/zones/qinq/bridge/sdn_config             |  7 +++-
 .../bridge_vlanaware/expected_sdn_interfaces  | 21 ++++++++++++
 test/zones/qinq/bridge_vlanaware/sdn_config   |  7 +++-
 .../expected_sdn_interfaces                   |  6 ++--
 .../expected_sdn_interfaces                   |  6 ++--
 test/zones/qinq/ovs/expected_sdn_interfaces   | 28 +++++++++++++++-
 test/zones/qinq/ovs/sdn_config                |  7 +++-
 9 files changed, 107 insertions(+), 18 deletions(-)

-- 
2.20.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH pve-network 1/3] zones: qinq: ovs: fix duplicate ovs_ports with multiple zones/vnets
  2021-04-29 10:14 [pve-devel] [PATCH pve-network 0/3] zones: qinq : fix mutiples vnets/qinq zones Alexandre Derumier
@ 2021-04-29 10:14 ` Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 2/3] zones: qinq: classic bridge: fix bridge zone name " Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 3/3] zones: qinq: vlanaware bridge: add tests with multiple vnets/zones Alexandre Derumier
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Derumier @ 2021-04-29 10:14 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Zones/QinQPlugin.pm         |  8 +++---
 test/zones/qinq/ovs/expected_sdn_interfaces | 28 ++++++++++++++++++++-
 test/zones/qinq/ovs/sdn_config              |  7 +++++-
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm
index 0a5abf8..1543fc1 100644
--- a/PVE/Network/SDN/Zones/QinQPlugin.pm
+++ b/PVE/Network/SDN/Zones/QinQPlugin.pm
@@ -82,10 +82,10 @@ sub generate_sdn_config {
 	push @iface_config, "ovs_options vlan_mode=dot1q-tunnel tag=$stag other_config:qinq-ethtype=$vlanprotocol";
 	push(@{$config->{$svlan_iface}}, @iface_config) if !$config->{$svlan_iface};
 
-	#redefine main ovs bridge, ifupdown2 will merge ovs_ports
-	@iface_config = ();
-	push @iface_config, "ovs_ports $svlan_iface";
-	push(@{$config->{$bridge}}, @iface_config);
+        #redefine main ovs bridge, ifupdown2 will merge ovs_ports
+	@{$config->{$bridge}}[0] = "ovs_ports" if !@{$config->{$bridge}}[0];
+	my @ovs_ports = split / / , @{$config->{$bridge}}[0];
+	@{$config->{$bridge}}[0] .= " $svlan_iface" if !grep( $_ eq $svlan_iface, @ovs_ports );
 
 	#zone vlan aware bridge
 	@iface_config = ();
diff --git a/test/zones/qinq/ovs/expected_sdn_interfaces b/test/zones/qinq/ovs/expected_sdn_interfaces
index 71c7aa3..068ae7d 100644
--- a/test/zones/qinq/ovs/expected_sdn_interfaces
+++ b/test/zones/qinq/ovs/expected_sdn_interfaces
@@ -6,15 +6,33 @@ iface myvnet
 	bridge_stp off
 	bridge_fd 0
 
+auto myvnet2
+iface myvnet2
+	bridge_ports z_myzone.101
+	bridge_stp off
+	bridge_fd 0
+
+auto myvnet3
+iface myvnet3
+	bridge_ports z_myzone2.100
+	bridge_stp off
+	bridge_fd 0
+
 auto sv_myzone
 iface sv_myzone
 	ovs_type OVSIntPort
 	ovs_bridge vmbr0
 	ovs_options vlan_mode=dot1q-tunnel tag=10 other_config:qinq-ethtype=802.1q
 
+auto sv_myzone2
+iface sv_myzone2
+	ovs_type OVSIntPort
+	ovs_bridge vmbr0
+	ovs_options vlan_mode=dot1q-tunnel tag=20 other_config:qinq-ethtype=802.1q
+
 auto vmbr0
 iface vmbr0
-	ovs_ports sv_myzone
+	ovs_ports sv_myzone sv_myzone2
 
 auto z_myzone
 iface z_myzone
@@ -23,3 +41,11 @@ iface z_myzone
 	bridge-fd 0
 	bridge-vlan-aware yes
 	bridge-vids 2-4094
+
+auto z_myzone2
+iface z_myzone2
+	bridge-stp off
+	bridge-ports sv_myzone2
+	bridge-fd 0
+	bridge-vlan-aware yes
+	bridge-vids 2-4094
diff --git a/test/zones/qinq/ovs/sdn_config b/test/zones/qinq/ovs/sdn_config
index 1708d4c..6321603 100644
--- a/test/zones/qinq/ovs/sdn_config
+++ b/test/zones/qinq/ovs/sdn_config
@@ -3,9 +3,14 @@
   vnets   => {
                ids => {
                         myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                        myvnet2 => { tag => 101, type => "vnet", zone => "myzone" },
+                        myvnet3 => { tag => 100, type => "vnet", zone => "myzone2" },
                       },
              },
   zones   => {
-               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+               ids => { 
+			myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" },
+			myzone2 => { bridge => "vmbr0", tag => 20, ipam => "pve", type => "qinq" },
+		      },
              },
 }
-- 
2.20.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH pve-network 2/3] zones: qinq: classic bridge: fix bridge zone name with multiple zones/vnets
  2021-04-29 10:14 [pve-devel] [PATCH pve-network 0/3] zones: qinq : fix mutiples vnets/qinq zones Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 1/3] zones: qinq: ovs: fix duplicate ovs_ports with multiple zones/vnets Alexandre Derumier
@ 2021-04-29 10:14 ` Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 3/3] zones: qinq: vlanaware bridge: add tests with multiple vnets/zones Alexandre Derumier
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Derumier @ 2021-04-29 10:14 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Zones/QinQPlugin.pm           |  2 +-
 .../zones/qinq/bridge/expected_sdn_interfaces | 33 +++++++++++++++++--
 test/zones/qinq/bridge/sdn_config             |  7 +++-
 .../expected_sdn_interfaces                   |  6 ++--
 .../expected_sdn_interfaces                   |  6 ++--
 5 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm
index 1543fc1..c5016f5 100644
--- a/PVE/Network/SDN/Zones/QinQPlugin.pm
+++ b/PVE/Network/SDN/Zones/QinQPlugin.pm
@@ -132,7 +132,7 @@ sub generate_sdn_config {
 	foreach my $bridge_iface (@bridge_ifaces) {
 
 	    # use named vlan interface to avoid too long names
-	    my $svlan_iface = "sv_$vnetid";
+	    my $svlan_iface = "sv_$zoneid";
 	    my $cvlan_iface = "cv_$vnetid";
 
 	    #svlan
diff --git a/test/zones/qinq/bridge/expected_sdn_interfaces b/test/zones/qinq/bridge/expected_sdn_interfaces
index 73db5b3..91ef667 100644
--- a/test/zones/qinq/bridge/expected_sdn_interfaces
+++ b/test/zones/qinq/bridge/expected_sdn_interfaces
@@ -2,7 +2,17 @@
 
 auto cv_myvnet
 iface cv_myvnet
-	vlan-raw-device sv_myvnet
+	vlan-raw-device sv_myzone
+	vlan-id 100
+
+auto cv_myvnet2
+iface cv_myvnet2
+	vlan-raw-device sv_myzone
+	vlan-id 101
+
+auto cv_myvnet3
+iface cv_myvnet3
+	vlan-raw-device sv_myzone2
 	vlan-id 100
 
 auto myvnet
@@ -11,7 +21,24 @@ iface myvnet
 	bridge_stp off
 	bridge_fd 0
 
-auto sv_myvnet
-iface sv_myvnet
+auto myvnet2
+iface myvnet2
+	bridge_ports  cv_myvnet2
+	bridge_stp off
+	bridge_fd 0
+
+auto myvnet3
+iface myvnet3
+	bridge_ports  cv_myvnet3
+	bridge_stp off
+	bridge_fd 0
+
+auto sv_myzone
+iface sv_myzone
 	vlan-raw-device eth0
 	vlan-id 10
+
+auto sv_myzone2
+iface sv_myzone2
+	vlan-raw-device eth0
+	vlan-id 20
diff --git a/test/zones/qinq/bridge/sdn_config b/test/zones/qinq/bridge/sdn_config
index 1708d4c..6321603 100644
--- a/test/zones/qinq/bridge/sdn_config
+++ b/test/zones/qinq/bridge/sdn_config
@@ -3,9 +3,14 @@
   vnets   => {
                ids => {
                         myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                        myvnet2 => { tag => 101, type => "vnet", zone => "myzone" },
+                        myvnet3 => { tag => 100, type => "vnet", zone => "myzone2" },
                       },
              },
   zones   => {
-               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+               ids => { 
+			myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" },
+			myzone2 => { bridge => "vmbr0", tag => 20, ipam => "pve", type => "qinq" },
+		      },
              },
 }
diff --git a/test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces
index ab7572e..59265fd 100644
--- a/test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces
+++ b/test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces
@@ -2,7 +2,7 @@
 
 auto cv_myvnet
 iface cv_myvnet
-	vlan-raw-device sv_myvnet
+	vlan-raw-device sv_myzone
 	vlan-id 100
 
 auto myvnet
@@ -13,7 +13,7 @@ iface myvnet
 	bridge-vlan-aware yes
 	bridge-vids 2-4094
 
-auto sv_myvnet
-iface sv_myvnet
+auto sv_myzone
+iface sv_myzone
 	vlan-raw-device eth0
 	vlan-id 10
diff --git a/test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces
index 460f1a5..528ceaa 100644
--- a/test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces
+++ b/test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces
@@ -2,7 +2,7 @@
 
 auto cv_myvnet
 iface cv_myvnet
-	vlan-raw-device sv_myvnet
+	vlan-raw-device sv_myzone
 	vlan-id 100
 
 auto myvnet
@@ -11,8 +11,8 @@ iface myvnet
 	bridge_stp off
 	bridge_fd 0
 
-auto sv_myvnet
-iface sv_myvnet
+auto sv_myzone
+iface sv_myzone
 	vlan-raw-device eth0
 	vlan-id 10
 	vlan-protocol 802.1ad
-- 
2.20.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH pve-network 3/3] zones: qinq: vlanaware bridge: add tests with multiple vnets/zones
  2021-04-29 10:14 [pve-devel] [PATCH pve-network 0/3] zones: qinq : fix mutiples vnets/qinq zones Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 1/3] zones: qinq: ovs: fix duplicate ovs_ports with multiple zones/vnets Alexandre Derumier
  2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 2/3] zones: qinq: classic bridge: fix bridge zone name " Alexandre Derumier
@ 2021-04-29 10:14 ` Alexandre Derumier
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Derumier @ 2021-04-29 10:14 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 .../bridge_vlanaware/expected_sdn_interfaces  | 21 +++++++++++++++++++
 test/zones/qinq/bridge_vlanaware/sdn_config   |  7 ++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces
index a9ed991..94bdbca 100644
--- a/test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces
+++ b/test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces
@@ -6,6 +6,18 @@ iface myvnet
 	bridge_stp off
 	bridge_fd 0
 
+auto myvnet2
+iface myvnet2
+	bridge_ports z_myzone.101
+	bridge_stp off
+	bridge_fd 0
+
+auto myvnet3
+iface myvnet3
+	bridge_ports z_myzone2.100
+	bridge_stp off
+	bridge_fd 0
+
 auto z_myzone
 iface z_myzone
 	bridge-stp off
@@ -13,3 +25,12 @@ iface z_myzone
 	bridge-fd 0
 	bridge-vlan-aware yes
 	bridge-vids 2-4094
+
+auto z_myzone2
+iface z_myzone2
+	bridge-stp off
+	bridge-ports vmbr0.20
+	bridge-fd 0
+	bridge-vlan-aware yes
+	bridge-vids 2-4094
+
diff --git a/test/zones/qinq/bridge_vlanaware/sdn_config b/test/zones/qinq/bridge_vlanaware/sdn_config
index 1708d4c..6321603 100644
--- a/test/zones/qinq/bridge_vlanaware/sdn_config
+++ b/test/zones/qinq/bridge_vlanaware/sdn_config
@@ -3,9 +3,14 @@
   vnets   => {
                ids => {
                         myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                        myvnet2 => { tag => 101, type => "vnet", zone => "myzone" },
+                        myvnet3 => { tag => 100, type => "vnet", zone => "myzone2" },
                       },
              },
   zones   => {
-               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+               ids => { 
+			myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" },
+			myzone2 => { bridge => "vmbr0", tag => 20, ipam => "pve", type => "qinq" },
+		      },
              },
 }
-- 
2.20.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-29 10:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 10:14 [pve-devel] [PATCH pve-network 0/3] zones: qinq : fix mutiples vnets/qinq zones Alexandre Derumier
2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 1/3] zones: qinq: ovs: fix duplicate ovs_ports with multiple zones/vnets Alexandre Derumier
2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 2/3] zones: qinq: classic bridge: fix bridge zone name " Alexandre Derumier
2021-04-29 10:14 ` [pve-devel] [PATCH pve-network 3/3] zones: qinq: vlanaware bridge: add tests with multiple vnets/zones Alexandre Derumier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal