Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 PVE/API2/Network.pm | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index fa605ba7..5e5cb5fd 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -18,7 +18,8 @@ use base qw(PVE::RESTHandler);
 
 my $have_sdn;
 eval {
-    require PVE::API2::Network::SDN;
+    require PVE::Network::SDN::Zones;
+    require PVE::Network::SDN::Controllers;
     $have_sdn = 1;
 };
 
@@ -554,22 +555,17 @@ __PACKAGE__->register_method({
        my $new_config_file = "/etc/network/interfaces.new";
 
        die "you need ifupdown2 to reload networking\n" if !-e 
'/usr/share/ifupdown2';
-       die "ifupdown2 reload is not compatible if openvswitch currently" if -x 
'/usr/bin/ovs-vsctl';
+       warn "openvswitch config can't be reloaded currently. Please reboot to 
apply ovs changes" if -x '/usr/bin/ovs-vsctl';
 
        my $worker = sub {
 
            rename($new_config_file, $current_config_file) if -e 
$new_config_file;
 
-           my $frr_config;
            if ($have_sdn) {
-               my $network_config = 
PVE::Network::SDN::generate_etc_network_config();
-               PVE::Network::SDN::write_etc_network_config($network_config);
-
-               $frr_config = PVE::Network::SDN::generate_frr_config();
-               PVE::Network::SDN::write_frr_config($frr_config) if $frr_config;
+               my $network_sdn_config = 
PVE::Network::SDN::Zones::generate_etc_network_config();
+               
PVE::Network::SDN::Zones::write_etc_network_config($network_sdn_config);
            }
 
-
            my $err = sub {
                my $line = shift;
                if ($line =~ /(warning|error): (\S+):/) {
@@ -578,15 +574,10 @@ __PACKAGE__->register_method({
            };
            PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err);
 
-           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);
+           if ($have_sdn) {
+               my $controller_config = 
PVE::Network::SDN::Controllers::generate_controller_config();
+               
PVE::Network::SDN::Controllers::write_controller_config($controller_config) if 
($controller_config);
+               PVE::Network::SDN::Controllers::reload_controller();
            }
        };
        return $rpcenv->fork_worker('srvreload', 'networking', $authuser, 
$worker);
-- 
2.20.1

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to