minLength => 2, maxLength => 20,
});
+PVE::JSONSchema::register_standard_option('pve-storage-id', {
+ description => "The storage identifier.",
+ type => 'string', format => 'pve-storage-id',
+});
+
+
my $format_list = {};
sub register_format {
return $id;
}
+PVE::JSONSchema::register_format('pve-storage-id', \&parse_storage_id);
+sub parse_storage_id {
+ my ($storeid, $noerr) = @_;
+
+ if ($storeid !~ m/^[a-z][a-z0-9\-\_\.]*[a-z0-9]$/i) {
+ return undef if $noerr;
+ die "storage ID '$storeid' contains illegal characters\n";
+ }
+ return $storeid;
+}
+
+
register_format('pve-vmid', \&pve_verify_vmid);
sub pve_verify_vmid {
my ($vmid, $noerr) = @_;