After taking a quick look, isn't there another instance just above in the code 
on line 720 which would benefit from the same change?

---------
        if (my $vmid = $param->{vmid}) {
            return $vmid if !defined($idlist->{$vmid});
                   ^^^^^
            raise_param_exc({ vmid => "VM $vmid already exists" });
        }
---------

Cheers!


On 12/1/20 10:34 AM, Moayad Almalat wrote:

When call /cluster/nextid over API, it returns ID as a string format
like {"data":"100"}. in the API pve-viewer, the result type is an integer
format.

Signed-off-by: Moayad Almalat <m.alma...@proxmox.com>
---
  PVE/API2/Cluster.pm | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index bf0e3b4d..ab07b491 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -727,7 +727,7 @@ __PACKAGE__->register_method({
        }
for (my $i = 100; $i < 10000; $i++) {
-           return $i if !defined($idlist->{$i});
+           return int($i) if !defined($idlist->{$i});
        }
die "unable to get any free VMID\n";



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to