[pve-devel] [PATCH common] schema: explicitly set min/max for vmid option

Fiona Ebner f.ebner at proxmox.com
Fri Jun 16 09:35:37 CEST 2023


The associated pve_verify_vmid() method already restricts the value
to this range, but this wouldn't be visible in the API viewer for
example [0].

The verify method is also called by qemu-server's qmextract, so it's
not possible to just drop the method right now.

[0]: https://forum.proxmox.com/threads/128845/post-564526

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/JSONSchema.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 60b02cb..7589bba 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -59,8 +59,10 @@ sub get_standard_option {
 
 register_standard_option('pve-vmid', {
     description => "The (unique) ID of the VM.",
-    type => 'integer', format => 'pve-vmid',
-    minimum => 1
+    type => 'integer',
+    format => 'pve-vmid',
+    minimum => 100,
+    maximum => 999_999_999,
 });
 
 register_standard_option('pve-node', {
-- 
2.39.2






More information about the pve-devel mailing list