[pve-devel] [PATCH v2 pve-common 3/4] JSONSchema: added disk-size format
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Oct 1 10:36:28 CEST 2015
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.1.4
More information about the pve-devel
mailing list