[pve-devel] [PATCH common] limit vmid with JSON format
Dominik Csapak
d.csapak at proxmox.com
Fri Feb 12 11:43:23 CET 2016
if we do not do this, vmids < 100 (not really bad) and
vmids > 999999999 are possible, which can lead to vms which you can
only get rid of, if you delete the config files manually
also this makes the api consistent with the webgui for vmids
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/JSONSchema.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 9552925..15e2c3c 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -137,7 +137,7 @@ register_format('pve-vmid', \&pve_verify_vmid);
sub pve_verify_vmid {
my ($vmid, $noerr) = @_;
- if ($vmid !~ m/^[1-9][0-9]+$/) {
+ if ($vmid !~ m/^[1-9][0-9]{2,8}$/) {
return undef if $noerr;
die "value does not look like a valid VM ID\n";
}
--
2.1.4
More information about the pve-devel
mailing list