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']], -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel