Network: tap_create|plug : sdn : use bridge_vlan

find correct bridge/vlan from vnet config
This commit is contained in:
Alexandre Derumier 2020-02-10 17:26:47 +01:00 committed by Thomas Lamprecht
parent 55163d614a
commit c02d6d1c96

View File

@ -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 {}) };