[pve-devel] [PATCH v2 manager 2/3] vzdump: handle pigz property string

Moayad Almalat m.almalat at proxmox.com
Tue Feb 4 15:56:02 CET 2020


From: Moayad <m.almalat at proxmox.com>

Signed-off-by: Moayad <m.almalat at proxmox.com>
---
 PVE/VZDump.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 3caa7ab8..0f04d4db 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -405,6 +405,10 @@ sub new {
 	}
     }
 
+    if (defined($opts->{pigz})) {
+	$opts->{pigz} = PVE::JSONSchema::parse_property_string(PVE::VZDump::Common::get_pigzdesc(), $opts->{pigz});
+    }
+
     $opts->{dumpdir} =~ s|/+$|| if ($opts->{dumpdir});
     $opts->{tmpdir} =~ s|/+$|| if ($opts->{tmpdir});
 
@@ -582,8 +586,8 @@ sub compressor_info {
     } elsif ($opt_compress eq '1' || $opt_compress eq 'lzo') {
 	return ('lzop', 'lzo');
     } elsif ($opt_compress eq 'gzip') {
-	if ($opts->{pigz} > 0) {
-	    my $pigz_threads = $opts->{pigz};
+	if (defined($opts->{pigz}) && $opts->{pigz}->{threads} > 0) {
+	    my $pigz_threads = $opts->{pigz}->{threads};
 	    if ($pigz_threads == 1) {
 		my $cpuinfo = PVE::ProcFSTools::read_cpuinfo();
 		$pigz_threads = int(($cpuinfo->{cpus} + 1)/2);
-- 
2.20.1




More information about the pve-devel mailing list