On 2/10/20 5:26 PM, Alexandre Derumier wrote: > 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 {}) }; > >
applied, but moved the repeating $have_sdn = 1; detection out to be module-wide. thanks! _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel