allow to delete pools with non-existent VMs/Storage

This commit is contained in:
Dietmar Maurer 2013-05-22 07:47:15 +02:00
parent 7f87932adb
commit 7b151944c8
2 changed files with 16 additions and 2 deletions

View File

@ -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});

View File

@ -3,6 +3,8 @@ pve-manager (3.0-19) unstable; urgency=low
* updated Chinese translation
* 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