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 ({ ...@@ -311,6 +311,11 @@ __PACKAGE__->register_method ({
PVE::AccessControl::lock_user_config( PVE::AccessControl::lock_user_config(
sub { sub {
my $vmlist = PVE::Cluster::get_vmlist() || {};
my $idlist = $vmlist->{ids} || {};
my $storecfg = PVE::Storage::config();
my $usercfg = cfs_read_file("user.cfg"); my $usercfg = cfs_read_file("user.cfg");
my $pool = $param->{poolid}; my $pool = $param->{poolid};
...@@ -320,8 +325,15 @@ __PACKAGE__->register_method ({ ...@@ -320,8 +325,15 @@ __PACKAGE__->register_method ({
die "pool '$pool' does not exist\n" die "pool '$pool' does not exist\n"
if !$data; if !$data;
die "pool '$pool' is not empty\n" foreach my $vmid (keys %{$data->{vms}}) {
if scalar (keys %{$data->{vms}}) || scalar(keys %{$data->{storage}}); 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}); delete ($usercfg->{pools}->{$pool});
......
...@@ -3,6 +3,8 @@ pve-manager (3.0-19) unstable; urgency=low ...@@ -3,6 +3,8 @@ pve-manager (3.0-19) unstable; urgency=low
* updated Chinese translation * updated Chinese translation
* allow to upload files with spaces in filename (replace with '_') * 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 -- Proxmox Support Team <support@proxmox.com> Wed, 22 May 2013 06:04:49 +0200
......
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