From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH cluster v4 2/2] pmxcfs: don't abort join when backup fails and keep old config database
Date: Wed, 18 Mar 2026 12:11:11 +0100 [thread overview]
Message-ID: <20260318111111.114933-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260318111111.114933-1-s.sterz@proxmox.com>
by moving it out of the way of the new database instead of unlinking
it. this should improve situations where a failed backup would leave
the cluster that is being joined in an inconsistent state, while
making sure that the pre-existing database on the joining node stays
around.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/PVE/Cluster.pm | 5 +++++
src/PVE/Cluster/Setup.pm | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Cluster.pm b/src/PVE/Cluster.pm
index e96a7fe..e678479 100644
--- a/src/PVE/Cluster.pm
+++ b/src/PVE/Cluster.pm
@@ -917,4 +917,9 @@ sub cfs_backup_database {
return $dbfile;
}
+# NOTE: Should only be called on cluster join to clean up a database pre-join.
+sub cfs_move_existing_db {
+ rename $dbfile, "$dbfile.bak";
+}
+
1;
diff --git a/src/PVE/Cluster/Setup.pm b/src/PVE/Cluster/Setup.pm
index 75d3507..9de6235 100644
--- a/src/PVE/Cluster/Setup.pm
+++ b/src/PVE/Cluster/Setup.pm
@@ -808,8 +808,9 @@ sub finish_join {
my $cmd = ['systemctl', 'stop', 'pve-cluster'];
PVE::Tools::run_command($cmd, errmsg => "can't stop pve-cluster service");
- my $dbfile = PVE::Cluster::cfs_backup_database();
- unlink $dbfile;
+ eval { PVE::Cluster::cfs_backup_database(); };
+ warn $@ if $@;
+ PVE::Cluster::cfs_move_existing_db();
$cmd = ['systemctl', 'start', 'corosync', 'pve-cluster'];
PVE::Tools::run_command($cmd, errmsg => "starting pve-cluster failed");
--
2.47.3
next prev parent reply other threads:[~2026-03-18 11:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 11:11 [PATCH cluster v4 0/2] pmxcfs fix backup directory permissions Shannon Sterz
2026-03-18 11:11 ` [PATCH cluster v4 1/2] pmxcfs: remove world-readable permissions from backups Shannon Sterz
2026-03-18 11:11 ` Shannon Sterz [this message]
2026-03-18 14:27 ` applied: [PATCH cluster v4 0/2] pmxcfs fix backup directory permissions Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260318111111.114933-3-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox