[pve-devel] [PATCH v2 guest-common 1/3] vzdump.conf: make pigz a property string
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Feb 10 08:57:52 CET 2020
On February 7, 2020 4:28 pm, Thomas Lamprecht wrote:
> On 2/4/20 3:56 PM, Moayad Almalat wrote:
>> From: Moayad <m.almalat at proxmox.com>
>>
>> and add blocksize property.
>>
>> Signed-off-by: Moayad <m.almalat at proxmox.com>
>> ---
>> PVE/VZDump/Common.pm | 26 ++++++++++++++++++++++----
>> 1 file changed, 22 insertions(+), 4 deletions(-)
>>
>> diff --git a/PVE/VZDump/Common.pm b/PVE/VZDump/Common.pm
>> index 4789a50..0ee7aba 100644
>> --- a/PVE/VZDump/Common.pm
>> +++ b/PVE/VZDump/Common.pm
>> @@ -60,6 +60,21 @@ sub parse_dow {
>> return $res;
>> };
>>
>> +my $pigzdesc = {
>
> this is a format, while I get where you come from I think it's
> nicer to have that envoded in the name of schema definitions for
> property string formats.
>
> my $pigzfmt = {
>
>> + threads => {
>> + type => "integer",
>> + description => "Use pigz instead of gzip when N>0.".
>> + " N=1 uses half of cores, N>1 uses N as thread count.",
>> + default => 0,
>> + default_key => 1,
>> + },
>> + blocksize => {
>> + type => "integer",
>> + description => "blocksize for compression with pigz",
>> + optional => 1,
>> + },
>> +};
>> +
>> my $confdesc = {
>> vmid => {
>> type => 'string', format => 'pve-vmid-list',
>> @@ -92,11 +107,10 @@ my $confdesc = {
>> default => '0',
>> },
>> pigz=> {
>> - type => "integer",
>> - description => "Use pigz instead of gzip when N>0.".
>> - " N=1 uses half of cores, N>1 uses N as thread count.",
>> + type => 'string',
>> + description => "pigz settings.",
>> + format => $pigzdesc,
>> optional => 1,
>> - default => 0,
>> },
>> quiet => {
>> type => 'boolean',
>> @@ -220,6 +234,10 @@ sub get_confdesc {
>> return $confdesc;
>> }
>>
>> +sub get_pigzdesc {
>> + return $pigzdesc;
>> +}
>
> not really required, isn't it? We already have the get_confdesc sub, from which you can
> get the format.
>
> my $vzdumpdesc = PVE::VZDump::Common::get_confdesc();
> my $pigzfmt = $vzdumpdesc->{pigz}->{format};
>
> This way we can avoid an dependency version bump from the pve-manager package to
> libpve-guest-common-perl package too.
we still need the versioned dependency, since the schema has changed in
a breaking way.. unless we want to have compat code in pve-manager that
upgrades the old, non-property string integer to a hash with just that
property set, just to avoid the versioned dependency ;)
>
>> +
>> # add JSON properties for create and set function
>> sub json_config_properties {
>> my $prop = shift;
>>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list