Signed-off-by: Alexandre Derumier <aderum...@odiso.com> --- PVE/API2/Qemu.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index b2c8908..2427925 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -898,6 +898,8 @@ my $update_vm_api = sub { my $defaults = PVE::QemuServer::load_defaults(); + my $running = PVE::QemuServer::check_running($vmid); + &$resolve_cdrom_alias($param); # now try to verify all parameters @@ -952,6 +954,18 @@ my $update_vm_api = sub { if $balloon && $balloon > $maxmem; } + if ($running && defined($param->{maxcpus})){ + if( (defined($conf->{maxcpus}) && $param->{maxcpus} != $conf->{maxcpus}) || (!$conf->{maxcpus} && $param->{maxcpus}) ){ + raise_param_exc({ maxcpus => "you can't change maxcpus when vm is running" }); + } + } + + foreach my $opt (@delete) { # delete + if ($running && $opt eq 'maxcpus' && defined($conf->{maxcpus})){ + raise_param_exc({ maxcpus => "you can't change maxcpus when vm is running" }); + } + } + PVE::Cluster::log_msg('info', $authuser, "update VM $vmid: " . join (' ', @paramarr)); my $worker = sub { -- 1.7.10.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel