From 81102c8a277b9b6660ddec5063eac4f912c973c6 Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 21 Aug 2018 14:03:16 +0200 Subject: [PATCH] Bugs solved --- debian/changelog | 2 +- vn-vmware.pl | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 937e044..35918ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -vn-vmware (1.0.7) stable; urgency=low +vn-vmware (1.0.8) stable; urgency=low * Initial Release. diff --git a/vn-vmware.pl b/vn-vmware.pl index 1fab0b2..a0f40b9 100755 --- a/vn-vmware.pl +++ b/vn-vmware.pl @@ -14,6 +14,7 @@ use File::Path; use Net::OpenSSH; use Sys::CPU; use Term::ANSIColor; +use List::Util qw(min max); use constant false => 0; use constant true => 1; @@ -439,7 +440,7 @@ sub backup_machine() { log_message "Consolidating and removing snapshots."; $vm->RemoveAllSnapshots(); - my $gzip_cpus = int(Sys::CPU::cpu_count()) - 1; + my $gzip_cpus = max(1, int(Sys::CPU::cpu_count()) - 1); my $tar_command = "tar -I \"pigz -p $gzip_cpus\" -cf $tar_file -C $local_tmp_dir ."; log_message "Compressing with Gzip (using $gzip_cpus CPUs) to TAR file: $tar_file"; @@ -472,8 +473,6 @@ sub backup_machine() { sub rotate_backup() { log_message "Rotating '$vm_name' backups."; - use List::Util qw[min]; - my $local_dir = "$local_backup_dir/$vm_name"; if ($rotation_days == 0 && $rotation_count == 0) {