[pve-devel] [PATCH pve-manager V2 2/2] api2: network reload : generate local sdn config

Alexandre Derumier aderumier at odiso.com
Mon Jun 24 10:41:03 CEST 2019


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

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 00337fe2..58adfbfb 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -16,6 +16,12 @@ use IO::File;
 
 use base qw(PVE::RESTHandler);
 
+my $have_sdn;
+eval {
+    require PVE::API2::Network::SDN;
+    $have_sdn = 1;
+};
+
 my $iflockfn = "/etc/network/.pve-interfaces.lock";
 
 my $bond_mode_enum = [
@@ -547,6 +553,11 @@ __PACKAGE__->register_method({
 
 	    rename($new_config_file, $current_config_file) if -e $new_config_file;
 
+	    if ($have_sdn) {
+		my $rawconfig = PVE::Network::SDN::generate_etc_network_config();
+		PVE::Network::SDN::write_etc_network_config($rawconfig);
+	    }
+
 	    my $cmd = ['ifreload', '-a'];
 
 	    my $err = sub {
-- 
2.20.1




More information about the pve-devel mailing list