From b944a22a6d12e9d1d1052855ae9727b77afe7edb Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 1 Oct 2015 10:36:28 +0200 Subject: [PATCH] JSONSchema: added disk-size format It's a special case in some output functions as it needs to use format_size(), so it'll be its own type and handled in the upcoming print_property_string() function. --- src/PVE/JSONSchema.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 5beebd8..b9ef26a 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -341,6 +341,16 @@ sub pve_verify_address { return $addr; } +register_format('disk-size', \&pve_verify_disk_size); +sub pve_verify_disk_size { + my ($size, $noerr) = @_; + if (!defined(parse_size($size))) { + return undef if $noerr; + die "value does not look like a valid disk size: $size\n"; + } + return $size; +} + register_standard_option('spice-proxy', { description => "SPICE proxy server. This can be used by the client to specify the proxy server. All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one. By default, we return the node where the VM is currently running. As resonable setting is to use same node you use to connect to the API (This is window.location.hostname for the JS GUI).", type => 'string', format => 'address', -- 2.39.2