[pve-devel] [PATCH pve-manager] api2 : network : use vtysh for frr reload instead systemd

Alexandre Derumier aderumier at odiso.com
Mon Sep 9 10:22:28 CEST 2019


avoid extra dep on frr-pythontools and parse error messages

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Network.pm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index ac5571a7..fa605ba7 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -578,8 +578,15 @@ __PACKAGE__->register_method({
 	    };
 	    PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err);
 
-	    if ($frr_config && -e "/usr/lib/frr/frr-reload.py") {
-		PVE::Tools::run_command(['systemctl', 'reload', 'frr']);
+	    my $err_frr = sub {
+		my $line = shift;
+		if ($line =~ /^line (\S+)/) {
+		    print "$line \n";
+		}
+	    };
+
+	    if ($frr_config && -e "/usr/bin/vtysh") {
+		PVE::Tools::run_command(['/usr/bin/vtysh', '-m', '-f', '/etc/frr/frr.conf'], outfunc => {}, errfunc => $err_frr);
 	    }
 	};
 	return $rpcenv->fork_worker('srvreload', 'networking', $authuser, $worker);
-- 
2.20.1




More information about the pve-devel mailing list