]> git.proxmox.com Git - pve-network.git/commitdiff
remove vnet bridge delete hook
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 7 Jun 2019 04:52:12 +0000 (06:52 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 12 Jun 2019 04:54:36 +0000 (06:54 +0200)
We can check that in local reload when we'll generate config

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/Network/Network/VnetPlugin.pm

index b255691c102aded0ea98dc763d1c1732b9b1dcf9..eeb7e8201eed33abf66baa0f305d73bf390b35a8 100644 (file)
@@ -8,29 +8,10 @@ use base('PVE::Network::Network::Plugin');
 
 use PVE::Cluster;
 
-# dynamically include PVE::QemuServer and PVE::LXC
-# to avoid dependency problems
-my $have_qemu_server;
-eval {
-    require PVE::QemuServer;
-    require PVE::QemuConfig;
-    $have_qemu_server = 1;
-};
-
-my $have_lxc;
-eval {
-    require PVE::LXC;
-    require PVE::LXC::Config;
-
-    $have_lxc = 1;
-};
-
 sub type {
     return 'vnet';
 }
 
-
-
 sub properties {
     return {
        transportzone => {
@@ -83,27 +64,7 @@ sub options {
 sub on_delete_hook {
     my ($class, $networkid, $network_cfg) = @_;
 
-    # verify than no vm or ct have interfaces in this bridge
-    my $vmdata = read_cluster_vm_config();
-
-    foreach my $vmid (sort keys %{$vmdata->{qemu}}) {
-       my $conf = $vmdata->{qemu}->{$vmid};
-       foreach my $netid (sort keys %$conf) {
-           next if $netid !~ m/^net(\d+)$/;
-           my $net = PVE::QemuServer::parse_net($conf->{$netid});
-           die "vnet $networkid is used by vm $vmid" if $net->{bridge} eq $networkid;
-       }
-    }
-
-    foreach my $vmid (sort keys %{$vmdata->{lxc}}) {
-       my $conf = $vmdata->{lxc}->{$vmid};
-       foreach my $netid (sort keys %$conf) {
-           next if $netid !~ m/^net(\d+)$/;
-           my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid});
-           die "vnet $networkid is used by ct $vmid" if $net->{bridge} eq $networkid;
-       }
-    }
-
+    return;
 }
 
 sub on_update_hook {
@@ -121,35 +82,4 @@ sub on_update_hook {
     }
 }
 
-sub read_cluster_vm_config {
-
-    my $qemu = {};
-    my $lxc = {};
-
-    my $vmdata = { qemu => $qemu, lxc => $lxc };
-
-    my $vmlist = PVE::Cluster::get_vmlist();
-    return $vmdata if !$vmlist || !$vmlist->{ids};
-    my $ids = $vmlist->{ids};
-
-    foreach my $vmid (keys %$ids) {
-       next if !$vmid;
-       my $d = $ids->{$vmid};
-       next if !$d->{type};
-       if ($d->{type} eq 'qemu' && $have_qemu_server) {
-           my $cfspath = PVE::QemuConfig->cfs_config_path($vmid);
-           if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
-               $qemu->{$vmid} = $conf;
-           }
-       } elsif ($d->{type} eq 'lxc' && $have_lxc) {
-           my $cfspath = PVE::LXC::Config->cfs_config_path($vmid);
-           if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
-               $lxc->{$vmid} = $conf;
-           }
-       }
-    }
-
-    return $vmdata;
-};
-
 1;