[pve-devel] [PATCH pve-network 4/5] add on_delete_hook

Alexandre Derumier aderumier at odiso.com
Thu Apr 4 10:18:34 CEST 2019


empty for now
---
 PVE/API2/Network/Network.pm                 | 6 ++----
 PVE/Network/Network/Plugin.pm               | 6 ++++++
 PVE/Network/Network/VlanPlugin.pm           | 6 ++++++
 PVE/Network/Network/VnetPlugin.pm           | 6 ++++++
 PVE/Network/Network/VxlanMulticastPlugin.pm | 6 ++++++
 5 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/PVE/API2/Network/Network.pm b/PVE/API2/Network/Network.pm
index 20f3574..a647edf 100644
--- a/PVE/API2/Network/Network.pm
+++ b/PVE/API2/Network/Network.pm
@@ -219,12 +219,10 @@ __PACKAGE__->register_method ({
 
 		my $scfg = PVE::Network::Network::network_config($cfg, $networkid);
 
-#		my $plugin = PVE::Network::Network::Plugin->lookup($scfg->{type});
-#		$plugin->on_delete_hook($networkid, $scfg);
+		my $plugin = PVE::Network::Network::Plugin->lookup($scfg->{type});
+		$plugin->on_delete_hook($networkid, $scfg);
 
 		delete $cfg->{ids}->{$networkid};
-		#improveme:
- 		#check that vnet don't use this transport
 		PVE::Network::Network::write_config($cfg);
 
 	    }, "delete network object failed");
diff --git a/PVE/Network/Network/Plugin.pm b/PVE/Network/Network/Plugin.pm
index 4ec6d0a..b537535 100644
--- a/PVE/Network/Network/Plugin.pm
+++ b/PVE/Network/Network/Plugin.pm
@@ -52,6 +52,12 @@ sub generate_network_config {
     die "please implement inside plugin";
 }
 
+sub on_delete_hook {
+    my ($class, $networkid, $scfg) = @_;
+
+    # do nothing by default
+}
+
 #helpers
 sub parse_tag_number_or_range {
     my ($str, $max, $tag) = @_;
diff --git a/PVE/Network/Network/VlanPlugin.pm b/PVE/Network/Network/VlanPlugin.pm
index 6a84f71..c335764 100644
--- a/PVE/Network/Network/VlanPlugin.pm
+++ b/PVE/Network/Network/VlanPlugin.pm
@@ -96,6 +96,12 @@ sub generate_network_config {
     return $config;
 }
 
+sub on_delete_hook {
+    my ($class, $networkid, $scfg) = @_;
+
+    # verify that no vnet are associated to this transport  
+}
+
 1;
 
 
diff --git a/PVE/Network/Network/VnetPlugin.pm b/PVE/Network/Network/VnetPlugin.pm
index a1d49a7..983e6a2 100644
--- a/PVE/Network/Network/VnetPlugin.pm
+++ b/PVE/Network/Network/VnetPlugin.pm
@@ -61,5 +61,11 @@ sub options {
     };
 }
 
+sub on_delete_hook {
+    my ($class, $networkid, $scfg) = @_;
+
+    # verify than no vm or ct have interfaces in this bridge
+}
+
 
 1;
diff --git a/PVE/Network/Network/VxlanMulticastPlugin.pm b/PVE/Network/Network/VxlanMulticastPlugin.pm
index 99383e5..901f425 100644
--- a/PVE/Network/Network/VxlanMulticastPlugin.pm
+++ b/PVE/Network/Network/VxlanMulticastPlugin.pm
@@ -80,6 +80,12 @@ sub generate_network_config {
     return $config;
 }
 
+sub on_delete_hook {
+    my ($class, $networkid, $scfg) = @_;
+
+    # verify that no vnet are associated to this transport
+}
+
 1;
 
 
-- 
2.11.0




More information about the pve-devel mailing list