5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2025-03-23 10:50:27 +03:00

moved format definition from pve-storage

This commit is contained in:
Dietmar Maurer 2012-01-26 11:54:42 +01:00
parent 3250f5c799
commit 05e787c503

View File

@ -70,6 +70,12 @@ register_standard_option('pve-iface', {
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 {
@ -96,6 +102,18 @@ sub pve_verify_configid {
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) = @_;