]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Zones/Plugin.pm
cleanup old transport/router/sdn_cfg references
[pve-network.git] / PVE / Network / SDN / Zones / Plugin.pm
index 3204d694482fb84ffaee99ca6720b4e3bd00b5e8..5d9aeff1d3b2fefc6224a4796c461aa6ee0ba74a 100644 (file)
@@ -102,13 +102,13 @@ sub generate_sdn_config {
 }
 
 sub generate_controller_config {
-    my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
+    my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_;
 
     die "please implement inside plugin";
 }
 
 sub generate_controller_vnet_config {
-    my ($class, $plugin_config, $controller, $transportid, $vnetid, $config) = @_;
+    my ($class, $plugin_config, $controller, $zoneid, $vnetid, $config) = @_;
 
 }
 
@@ -125,9 +125,14 @@ sub controller_reload {
 }
 
 sub on_delete_hook {
-    my ($class, $sndid, $scfg) = @_;
+    my ($class, $zoneid, $vnet_cfg) = @_;
 
-    # do nothing by default
+    # verify that no vnet are associated to this zone
+    foreach my $id (keys %{$vnet_cfg->{ids}}) {
+       my $vnet = $vnet_cfg->{ids}->{$id};
+       die "zone $zoneid is used by vnet $id"
+           if ($vnet->{type} eq 'vnet' && defined($vnet->{zone}) && $vnet->{zone} eq $zoneid);
+    }
 }
 
 sub on_update_hook {