mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-15 08:55:18 +00:00
api: pool update: refactor/code-clean-up guest handling
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
a06d2fac44
commit
b7bc7ae9da
@ -172,15 +172,12 @@ __PACKAGE__->register_method ({
|
|||||||
delete $usercfg->{vms}->{$vmid};
|
delete $usercfg->{vms}->{$vmid};
|
||||||
} else {
|
} else {
|
||||||
die "VM $vmid is already a pool member\n" if $pool_config->{vms}->{$vmid};
|
die "VM $vmid is already a pool member\n" if $pool_config->{vms}->{$vmid};
|
||||||
my $existing_pool = $usercfg->{vms}->{$vmid};
|
if (defined(my $existing_pool = $usercfg->{vms}->{$vmid})) {
|
||||||
if (defined($existing_pool)) {
|
die "VM $vmid belongs already to pool '$existing_pool' and 'transfer' is not set\n"
|
||||||
if ($param->{transfer}) {
|
if !$param->{transfer};
|
||||||
$rpcenv->check($authuser, "/pool/$existing_pool", ['Pool.Allocate']);
|
|
||||||
my $existing_pool_config = $usercfg->{pools}->{$existing_pool};
|
$rpcenv->check($authuser, "/pool/$existing_pool", ['Pool.Allocate']);
|
||||||
delete $existing_pool_config->{vms}->{$vmid};
|
delete $usercfg->{pools}->{$existing_pool}->{vms}->{$vmid};
|
||||||
} else {
|
|
||||||
die "VM $vmid belongs already to pool '$existing_pool' and transfer is not set\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$pool_config->{vms}->{$vmid} = 1;
|
$pool_config->{vms}->{$vmid} = 1;
|
||||||
$usercfg->{vms}->{$vmid} = $pool;
|
$usercfg->{vms}->{$vmid} = $pool;
|
||||||
|
Loading…
Reference in New Issue
Block a user