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

Alexandre Derumier aderumier at odiso.com
Wed Aug 21 05:22:37 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 5e2abda1..07c3e6d3 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 = [
@@ -554,6 +560,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