From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 482C91FF138 for ; Wed, 18 Mar 2026 12:11:34 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7257733DCC; Wed, 18 Mar 2026 12:11:48 +0100 (CET) From: Shannon Sterz 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 Message-ID: <20260318111111.114933-3-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260318111111.114933-1-s.sterz@proxmox.com> References: <20260318111111.114933-1-s.sterz@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773832230985 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.945 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: KUXQADSVCS4QRAEC2RT5FCTRSTGZO4TG X-Message-ID-Hash: KUXQADSVCS4QRAEC2RT5FCTRSTGZO4TG X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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