[pve-devel] [PATCH v2 pve-network 15/15] controller: evpn: use frr-reload.py for reloading frr
Alexandre Derumier
aderumier at odiso.com
Tue Nov 26 10:00:30 CET 2019
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 at odiso.com>
---
PVE/Network/SDN/Controllers/EvpnPlugin.pm | 22 ++++++++++++++++++----
1 file 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);
}
}
--
2.20.1
More information about the pve-devel
mailing list