This will be used in cases where the VMID may not be important. For example some users do not care which VMID a CT/VM gets, they just want a CT/VM.
Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com> --- src/PVE/JSONSchema.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index caeefe2..7a4a601 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -56,6 +56,11 @@ register_standard_option('pve-vmid', { minimum => 1 }); +register_standard_option('pve-vmid-optional', { + description => "The (unique) ID of the VM or a '.' to autogenerate one.", + type => 'string', format => 'pve-vmid-optional', +}); + register_standard_option('pve-node', { description => "The cluster node name.", type => 'string', format => 'pve-node', @@ -155,6 +160,17 @@ sub pve_verify_vmid { return $vmid; } +register_format('pve-vmid-optional', \&pve_verify_vmid_optional); +sub pve_verify_vmid_optional { + my ($vmid, $noerr) = @_; + + if ($vmid !~ m/^([1-9][0-9]{2,8}|\.)$/) { + return undef if $noerr; + die "value does not look like a valid optional VM ID\n"; + } + return $vmid; +} + register_format('pve-node', \&pve_verify_node_name); sub pve_verify_node_name { my ($node, $noerr) = @_; -- 2.1.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel