[pve-devel] [PATCH v2 guest-common 1/3] vzdump.conf: make pigz a property string
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Feb 7 16:28:44 CET 2020
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.
> +
> # add JSON properties for create and set function
> sub json_config_properties {
> my $prop = shift;
>
More information about the pve-devel
mailing list