[pve-devel] [PATCH qemu-server 2/7] qm: add nextvmid

Alexandre DERUMIER aderumier at odiso.com
Wed Nov 7 16:29:19 CET 2018


>>why not use pvesh to get the next id in cluster instead of adding a new 
>>command? 

you are right. I dind't known that it was available through api.


"pvesh get /cluster/nextid"


I'll fix this. Thanks.


----- Mail original -----
De: "David Limbeck" <d.limbeck at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Mercredi 7 Novembre 2018 16:25:02
Objet: Re: [pve-devel] [PATCH qemu-server 2/7] qm: add nextvmid

why not use pvesh to get the next id in cluster instead of adding a new 
command? 

On 10/29/18 4:38 PM, Alexandre Derumier wrote: 
> return the next vmid free 
> --- 
> PVE/API2/Qemu.pm | 1 - 
> PVE/CLI/qm.pm | 19 +++++++++++++++++++ 
> 2 files changed, 19 insertions(+), 1 deletion(-) 
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm 
> index 64eaa0e..ac8b907 100644 
> --- a/PVE/API2/Qemu.pm 
> +++ b/PVE/API2/Qemu.pm 
> @@ -389,7 +389,6 @@ __PACKAGE__->register_method({ 
> }}); 
> 
> 
> - 
> __PACKAGE__->register_method({ 
> name => 'create_vm', 
> path => '', 
> diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm 
> index 46a7e2f..b1f146d 100755 
> --- a/PVE/CLI/qm.pm 
> +++ b/PVE/CLI/qm.pm 
> @@ -144,6 +144,23 @@ __PACKAGE__->register_method ({ 
> }}); 
> 
> __PACKAGE__->register_method ({ 
> + name => 'nextvmid', 
> + path => 'nextvmid', 
> + method => 'GET', 
> + description => "Return next free vmid.", 
> + parameters => { 
> + additionalProperties => 0, 
> + }, 
> + returns => { type => 'null'}, 
> + code => sub { 
> + my ($param) = @_; 
> + 
> + my $nextvmid = PVE::Cluster::complete_next_vmid; 
> + print $nextvmid->[0]; 
> + return undef; 
> + }}); 
> + 
> +__PACKAGE__->register_method ({ 
> name => 'status', 
> path => 'status', 
> method => 'GET', 
> @@ -896,6 +913,8 @@ our $cmddef = { 
> 
> mtunnel => [ __PACKAGE__, 'mtunnel', []], 
> 
> + nextvmid => [ __PACKAGE__, 'nextvmid', []], 
> + 
> nbdstop => [ __PACKAGE__, 'nbdstop', ['vmid']], 
> 
> terminal => [ __PACKAGE__, 'terminal', ['vmid']], 

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




More information about the pve-devel mailing list