[pve-devel] [PATCH pve-common 1/1] Network: tap_create|plug : sdn : use bridge_vlan
Alexandre Derumier
aderumier at odiso.com
Mon Feb 10 17:26:47 CET 2020
find correct bridge/vlan from vnet config
---
src/PVE/Network.pm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index 5f40353..740c314 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -272,6 +272,17 @@ my $activate_interface = sub {
sub tap_create {
my ($iface, $bridge) = @_;
+ my $have_sdn;
+ eval {
+ require PVE::Network::SDN::Zones;
+ $have_sdn = 1;
+ };
+
+ if ($have_sdn) {
+ my ($bridgesdn, undef) = PVE::Network::SDN::Zones::get_bridge_vlan($bridge);
+ $bridge = $bridgesdn if $bridgesdn;
+ }
+
die "unable to get bridge setting\n" if !$bridge;
my $bridgemtu = &$read_bridge_mtu($bridge);
@@ -286,6 +297,17 @@ sub tap_create {
sub veth_create {
my ($veth, $vethpeer, $bridge, $mac) = @_;
+ my $have_sdn;
+ eval {
+ require PVE::Network::SDN::Zones;
+ $have_sdn = 1;
+ };
+
+ if ($have_sdn) {
+ my ($bridgesdn, undef) = PVE::Network::SDN::Zones::get_bridge_vlan($bridge);
+ $bridge = $bridgesdn if $bridgesdn;
+ }
+
die "unable to get bridge setting\n" if !$bridge;
my $bridgemtu = &$read_bridge_mtu($bridge);
@@ -377,6 +399,18 @@ my $cleanup_firewall_bridge = sub {
sub tap_plug {
my ($iface, $bridge, $tag, $firewall, $trunks, $rate) = @_;
+ my $have_sdn;
+ eval {
+ require PVE::Network::SDN::Zones;
+ $have_sdn = 1;
+ };
+
+ if ($have_sdn) {
+ my ($bridgesdn, $tag) = PVE::Network::SDN::Zones::get_bridge_vlan($bridge);
+ $bridge = $bridgesdn if $bridgesdn;
+ $trunks = undef;
+ }
+
#cleanup old port config from any openvswitch bridge
eval {run_command("/usr/bin/ovs-vsctl del-port $iface", outfunc => sub {}, errfunc => sub {}) };
--
2.20.1
More information about the pve-devel
mailing list