[pmg-devel] [PATCH pmg-api 2/5] backup: fix #3154 add 'include-statistics' to pbs

Stoiko Ivanov s.ivanov at proxmox.com
Wed Feb 24 19:30:59 CET 2021


This patch addresses part of #3154 - by adding the
'include-statistics' parameter for each remote in
/etc/pmg/pbs/pbs.conf.

The other part (actively asking the user whether to include it) is GUI
only, since the API already has the paramter for backup calls.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/API2/PBS/Job.pm | 2 +-
 src/PMG/PBSConfig.pm    | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/PMG/API2/PBS/Job.pm b/src/PMG/API2/PBS/Job.pm
index b218779..2387422 100644
--- a/src/PMG/API2/PBS/Job.pm
+++ b/src/PMG/API2/PBS/Job.pm
@@ -291,7 +291,7 @@ __PACKAGE__->register_method ({
 	die "PBS remote '$remote' does not exist\n" if !$remote_config;
 	die "PBS remote '$remote' is disabled\n" if $remote_config->{disable};
 
-	$param->{statistic} //= 1;
+	$param->{statistic} //= $remote_config->{'include-statistics'} // 1;
 
 	my $pbs = PVE::PBSClient->new($remote_config, $remote, $conf->{secret_dir});
 	my $backup_dir = "/var/lib/pmg/backup/current";
diff --git a/src/PMG/PBSConfig.pm b/src/PMG/PBSConfig.pm
index 2d80e78..29cff22 100644
--- a/src/PMG/PBSConfig.pm
+++ b/src/PMG/PBSConfig.pm
@@ -90,6 +90,11 @@ sub properties {
 	    description => "Username or API token ID on the Proxmox Backup Server"
 	}),
 	fingerprint => get_standard_option('fingerprint-sha256'),
+	'include-statistics' => {
+	    description => "Include statistics in scheduled backups",
+	    type => 'boolean',
+	    optional => 1,
+	},
 	%prune_properties,
     };
 }
@@ -102,6 +107,7 @@ sub options {
 	username => { optional => 1 },
 	password => { optional => 1 },
 	fingerprint => { optional => 1 },
+	'include-statistics' => { optional => 1 },
 	'keep-last' => { optional => 1 },
 	'keep-hourly' =>  { optional => 1 },
 	'keep-daily' => { optional => 1 },
-- 
2.20.1





More information about the pmg-devel mailing list