[pve-devel] [PATCH common 1/1] JSONSchema: add pve-tag format

Dominik Csapak d.csapak at proxmox.com
Tue Sep 24 08:16:15 CEST 2019


On 9/23/19 5:30 PM, Thomas Lamprecht wrote:
> On 9/10/19 2:57 PM, Dominik Csapak wrote:
>> useful for vm/ct tags
> 
> a short sentence which describes the format would be appreciated..
> Also, I'd like to keep format registrations here relatively minimal,
> I mean they do not need to have the wide spread use all over our
> projects like default options need to have, but still...

yes makes sense

> 
> Do you have any known places where you would use that too, now or
> in the near future? Else I'd maybe put this into guest-common.

the most obvious things would be storages and nodes

> 
> Short hint that this is intended to be used as "tag-list" format, so
> that multiple tags are done through our "magic" -list format extension
> allowing to pass multiple comma-separated format values.

ok

> 
>>
>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>> ---
>>   src/PVE/JSONSchema.pm | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
>> index db38d44..e221dce 100644
>> --- a/src/PVE/JSONSchema.pm
>> +++ b/src/PVE/JSONSchema.pm
>> @@ -499,6 +499,17 @@ register_standard_option('bwlimit', {
>>       format => $bwlimit_format,
>>   });
>>   
>> +register_format('pve-tag', \&pve_verify_tag);
>> +sub pve_verify_tag {
>> +    my ($value, $noerr) = @_;
>> +
>> +    return $value if $value =~ m/^\w[\w\-\+\.]*$/;
>> +
>> +    return undef if $noerr;
>> +
>> +    die "invalid characters in tag\n";
>> +}
>> +
>>   sub pve_parse_startup_order {
>>       my ($value) = @_;
>>   
>>
> 





More information about the pve-devel mailing list