Commit 7b151944 authored by Dietmar Maurer's avatar Dietmar Maurer

allow to delete pools with non-existent VMs/Storage

parent 7f87932a
......@@ -311,6 +311,11 @@ __PACKAGE__->register_method ({
PVE::AccessControl::lock_user_config(
sub {
my $vmlist = PVE::Cluster::get_vmlist() || {};
my $idlist = $vmlist->{ids} || {};
my $storecfg = PVE::Storage::config();
my $usercfg = cfs_read_file("user.cfg");
my $pool = $param->{poolid};
......@@ -320,8 +325,15 @@ __PACKAGE__->register_method ({
die "pool '$pool' does not exist\n"
if !$data;
die "pool '$pool' is not empty\n"
if scalar (keys %{$data->{vms}}) || scalar(keys %{$data->{storage}});
foreach my $vmid (keys %{$data->{vms}}) {
next if !$idlist->{$vmid};
die "pool '$pool' is not empty (contains VM $vmid)\n";
}
foreach my $storeid (keys %{$data->{storage}}) {
next if !PVE::Storage::storage_config ($storecfg, $storeid, 1);
die "pool '$pool' is not empty (contains storage '$storeid')\n";
}
delete ($usercfg->{pools}->{$pool});
......
......@@ -4,6 +4,8 @@ pve-manager (3.0-19) unstable; urgency=low
* allow to upload files with spaces in filename (replace with '_')
* allow to delete pools with non-existent VMs/Storage
-- Proxmox Support Team <support@proxmox.com> Wed, 22 May 2013 06:04:49 +0200
pve-manager (3.0-18) unstable; urgency=low
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment