From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <l.nunner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id C47A591A78
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 10:27:42 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id ACCDD219B0
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 10:27:12 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 10:27:11 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BF717461F0
 for <pve-devel@lists.proxmox.com>; Thu,  9 Feb 2023 10:27:11 +0100 (CET)
From: Leo Nunner <l.nunner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu,  9 Feb 2023 10:27:04 +0100
Message-Id: <20230209092705.29496-3-l.nunner@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20230209092705.29496-1-l.nunner@proxmox.com>
References: <20230209092705.29496-1-l.nunner@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.148 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [cluster.pm, setup.pm]
Subject: [pve-devel] [PATCH cluster] fix #4234: vzdump: add cluster-wide
 configuration
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 09 Feb 2023 09:27:42 -0000

Introduce a cluster-wide vzdump.conf file which gets filled with the
default vzdump configuration.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
---

 data/PVE/Cluster.pm       |  1 +
 data/PVE/Cluster/Setup.pm | 32 +++++++++++++++++++++++++++++---
 data/src/status.c         |  1 +
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 0154aae..efca58f 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -45,6 +45,7 @@ my $dbbackupdir = "/var/lib/pve-cluster/backup";
 # using a computed version and only those can be used by the cfs_*_file methods
 my $observed = {
     'vzdump.cron' => 1,
+    'vzdump.conf' => 1,
     'jobs.cfg' => 1,
     'storage.cfg' => 1,
     'datacenter.cfg' => 1,
diff --git a/data/PVE/Cluster/Setup.pm b/data/PVE/Cluster/Setup.pm
index 108817e..061fe08 100644
--- a/data/PVE/Cluster/Setup.pm
+++ b/data/PVE/Cluster/Setup.pm
@@ -579,6 +579,28 @@ PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 
 __EOD
 
+my $vzdump_conf_dummy = <<__EOD;
+# vzdump default settings
+# these are overruled by the node-specific configuration in /etc/vzdump.conf
+
+#tmpdir: DIR
+#dumpdir: DIR
+#storage: STORAGE_ID
+#mode: snapshot|suspend|stop
+#bwlimit: KBPS
+#performance: max-workers=N
+#ionice: PRI
+#lockwait: MINUTES
+#stopwait: MINUTES
+#stdexcludes: BOOLEAN
+#mailto: ADDRESSLIST
+#prune-backups: keep-INTERVAL=N[,...]
+#script: FILENAME
+#exclude-path: PATHLIST
+#pigz: N
+#notes-template: {{guestname}}
+__EOD
+
 sub gen_pve_vzdump_symlink {
 
     my $filename = "/etc/pve/vzdump.cron";
@@ -593,10 +615,14 @@ sub gen_pve_vzdump_symlink {
 
 sub gen_pve_vzdump_files {
 
-    my $filename = "/etc/pve/vzdump.cron";
+    my $cron = "/etc/pve/vzdump.cron";
+    my $conf = "/etc/pve/vzdump.conf";
+
+    PVE::Tools::file_set_contents($cron, $vzdump_cron_dummy)
+	if ! -f $cron;
 
-    PVE::Tools::file_set_contents($filename, $vzdump_cron_dummy)
-	if ! -f $filename;
+    PVE::Tools::file_set_contents($conf, $vzdump_conf_dummy)
+	if ! -f $conf;
 
     gen_pve_vzdump_symlink();
 };
diff --git a/data/src/status.c b/data/src/status.c
index 5e1e841..9e520a5 100644
--- a/data/src/status.c
+++ b/data/src/status.c
@@ -89,6 +89,7 @@ static memdb_change_t memdb_change_array[] = {
 	{ .path = "priv/ipam.db" },
 	{ .path = "datacenter.cfg" },
 	{ .path = "vzdump.cron" },
+	{ .path = "vzdump.conf" },
 	{ .path = "jobs.cfg" },
 	{ .path = "ha/crm_commands" },
 	{ .path = "ha/manager_status" },
-- 
2.30.2