diff options
| author | Alexandre Derumier <aderumier@odiso.com> | 2019-11-26 10:00:30 +0100 |
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2019-11-26 12:33:40 +0100 |
| commit | 659c27c2fe16c577c31865719fb81e82e81b4ce6 (patch) | |
| tree | d93e08570905eec8fe06a00daef6cdbabc38b061 | |
| parent | 56cdcac99d114487873624ad013c9f7d2f74db63 (diff) | |
controller: evpn: use frr-reload.py for reloading frr
vtysh is not enough to cleanly reload configuration
This require frr-pythontools package
Also add default global values or frr-reload will try to remove them
each time
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
| -rw-r--r-- | PVE/Network/SDN/Controllers/EvpnPlugin.pm | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 5e0a275..0693e21 100644 --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -131,6 +131,8 @@ sub generate_controller_zone_config { push @controller_config, "vni $vrfvxlan"; push(@{$config->{frr}->{vrf}->{"$vrf"}}, @controller_config); + push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{""}}, "!"); + @controller_config = (); my $is_gateway = undef; @@ -262,8 +264,15 @@ sub generate_frr_recurse{ sub write_controller_config { my ($class, $plugin_config, $config) = @_; + my $nodename = PVE::INotify::nodename(); + my $final_config = []; push @{$final_config}, "log syslog informational"; + push @{$final_config}, "ip forwarding"; + push @{$final_config}, "ipv6 forwarding"; + push @{$final_config}, "frr defaults traditional"; + push @{$final_config}, "service integrated-vtysh-config"; + push @{$final_config}, "hostname $nodename"; push @{$final_config}, "!"; generate_frr_recurse($final_config, $config->{frr}, undef, 0); @@ -289,17 +298,22 @@ sub reload_controller { my ($class) = @_; my $conf_file = "/etc/frr/frr.conf"; - my $bin_path = "/usr/bin/vtysh"; + my $bin_path = "/usr/lib/frr/frr-reload.py"; + + if (!-e $bin_path) { + warn "missing $bin_path. Please install frr-pythontools package"; + return; + } my $err = sub { my $line = shift; - if ($line =~ /^line (\S+)/) { - print "$line \n"; + if ($line =~ /ERROR:/) { + warn "$line \n"; } }; if (-e $conf_file && -e $bin_path) { - PVE::Tools::run_command([$bin_path, '-m', '-f', $conf_file], outfunc => {}, errfunc => $err); + PVE::Tools::run_command([$bin_path, '--stdout', '--reload', $conf_file], outfunc => {}, errfunc => $err); } } |
