public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Moayad Almalat <m.almalat@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-manager]: api2:/cluster return intiger format for VMID
Date: Tue, 1 Dec 2020 10:41:14 +0100	[thread overview]
Message-ID: <c5dc7957-3e30-8bd8-3593-5842994a68b1@proxmox.com> (raw)
In-Reply-To: <20201201093450.101063-1-m.almalat@proxmox.com>

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.almalat@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";
> 




  reply	other threads:[~2020-12-01  9:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  9:34 Moayad Almalat
2020-12-01  9:41 ` Aaron Lauterer [this message]
2020-12-01  9:41 ` Dietmar Maurer
2020-12-01  9:42   ` Dietmar Maurer
2020-12-01 10:38     ` Stefan Reiter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5dc7957-3e30-8bd8-3593-5842994a68b1@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=m.almalat@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal