]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/Network/VxlanMulticastPlugin.pm
vlan, vxlan plugin : add on_delete_hook
[pve-network.git] / PVE / Network / Network / VxlanMulticastPlugin.pm
index d6cc4f68cd49ac2bca2067b2fde37111d763d5b4..f71094aaf27faf46df696ccfd59a047634344168 100644 (file)
@@ -84,9 +84,14 @@ sub generate_network_config {
 }
 
 sub on_delete_hook {
-    my ($class, $networkid, $scfg) = @_;
+    my ($class, $transportid, $network_cfg) = @_;
 
     # verify that no vnet are associated to this transport
+    foreach my $id (keys %{$network_cfg->{ids}}) {
+       my $network = $network_cfg->{ids}->{$id};
+       die "transport $transportid is used by vnet $id" 
+           if ($network->{type} eq 'vnet' && defined($network->{transportzone}) && $network->{transportzone} eq $transportid);
+    }
 }
 
 sub on_update_hook {