[pve-devel] [PATCH pve-network] fix total removal of zones|vnets|controllers

Alexandre Derumier aderumier at odiso.com
Mon Mar 16 09:44:33 CET 2020


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Network/SDN/Controllers.pm | 3 ++-
 PVE/Network/SDN/Vnets.pm       | 2 +-
 PVE/Network/SDN/Zones.pm       | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/PVE/Network/SDN/Controllers.pm b/PVE/Network/SDN/Controllers.pm
index 16c664d..1741c95 100644
--- a/PVE/Network/SDN/Controllers.pm
+++ b/PVE/Network/SDN/Controllers.pm
@@ -33,7 +33,8 @@ sub sdn_controllers_config {
 
 sub config {
     my $config = cfs_read_file("sdn/controllers.cfg.new");
-    $config = cfs_read_file("sdn/controllers.cfg") if !keys %{$config->{ids}};
+    $config = cfs_read_file("sdn/controllers.cfg") if !-e "/etc/pve/sdn/controllers.cfg.new";
+
     return $config;
 }
 
diff --git a/PVE/Network/SDN/Vnets.pm b/PVE/Network/SDN/Vnets.pm
index 725605b..ca6e1d0 100644
--- a/PVE/Network/SDN/Vnets.pm
+++ b/PVE/Network/SDN/Vnets.pm
@@ -23,7 +23,7 @@ sub sdn_vnets_config {
 
 sub config {
     my $config = cfs_read_file("sdn/vnets.cfg.new");
-    $config = cfs_read_file("sdn/vnets.cfg") if !keys %{$config->{ids}};
+    $config = cfs_read_file("sdn/vnets.cfg") if !-e "/etc/pve/sdn/vnets.cfg.new";
     return $config;
 }
 
diff --git a/PVE/Network/SDN/Zones.pm b/PVE/Network/SDN/Zones.pm
index 17ef507..ae31fea 100644
--- a/PVE/Network/SDN/Zones.pm
+++ b/PVE/Network/SDN/Zones.pm
@@ -39,7 +39,8 @@ sub sdn_zones_config {
 
 sub config {
     my $config = cfs_read_file("sdn/zones.cfg.new");
-    $config = cfs_read_file("sdn/zones.cfg") if !keys %{$config->{ids}};
+    $config = cfs_read_file("sdn/zones.cfg") if !-e "/etc/pve/sdn/zones.cfg.new";
+
     return $config;
 }
 
-- 
2.20.1




More information about the pve-devel mailing list