use PVE::Network;
use PVE::ProcFSTools;
+my $have_sdn;
+eval {
+ require PVE::Network::SDN::Zones;
+ $have_sdn = 1;
+};
+
die "got unexpected argument count\n" if scalar(@ARGV) != 5;
my ($vmid, $arg2, $arg3, $type, $iface) = @ARGV;
die "got unexpected argument ($arg3 != up)\n" if $arg3 ne 'up';
die "got unexpected argument ($type != veth)\n" if $type ne 'veth';
-
+
die "got unexpected environment" if $vmid ne $ENV{LXC_NAME};
die "missing vmid parameter\n" if !$vmid;
die "unable to find network definition for interface '$iface'\n"
if !defined($netconf);
-my $net = PVE::LXC::parse_lxc_network($netconf);
-
+my $net = PVE::LXC::Config->parse_lxc_network($netconf);
+
my $tag = $net->{tag};
my $firewall = $net->{firewall};
my $bridge = $net->{bridge};
my $trunks = $net->{trunks};
+my $rate = $net->{rate};
die "missing bridge configuration" if !$bridge;
PVE::Tools::run_command("/sbin/ip link set dev $iface up mtu $bridgemtu");
PVE::Tools::run_command("/sbin/ip addr add 0.0.0.0/0 dev $iface");
- PVE::Network::tap_plug($iface, $bridge, $tag, $firewall, $trunks);
+
+ if ($have_sdn) {
+ PVE::Network::SDN::Zones::tap_plug($iface, $net->{bridge}, $tag, $firewall, $trunks, $rate);
+ } else {
+ PVE::Network::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate);
+ }
}
exit 0;