From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 062471FF13C for ; Thu, 11 Jun 2026 17:01:15 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B8C98101F9; Thu, 11 Jun 2026 17:00:42 +0200 (CEST) From: David Riley To: pve-devel@lists.proxmox.com Subject: [PATCH pve-cluster 8/9] fix #7294: cluster: helpers: add cluster-wide version assertion Date: Thu, 11 Jun 2026 16:59:34 +0200 Message-ID: <20260611145935.147788-9-d.riley@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260611145935.147788-1-d.riley@proxmox.com> References: <20260611145935.147788-1-d.riley@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1781189945456 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.175 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 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: VXR2HP7S7Y7BSKLP7DIGNTIVJYE2I6ZZ X-Message-ID-Hash: VXR2HP7S7Y7BSKLP7DIGNTIVJYE2I6ZZ X-MailFrom: d.riley@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: Add function to assert a minimum version requirement for the whole cluster. Evaluates against the cluster configuration. Dies if any node is offline, or running an older version, ensuring cluster-wide feature compatibility before allowing an operation to proceed. Prevents older nodes from truncating newly structured user.cfg entries. Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294 Signed-off-by: David Riley --- src/PVE/Cluster/Helpers.pm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/PVE/Cluster/Helpers.pm b/src/PVE/Cluster/Helpers.pm index a4b41c9..3937e6d 100644 --- a/src/PVE/Cluster/Helpers.pm +++ b/src/PVE/Cluster/Helpers.pm @@ -47,5 +47,40 @@ sub version_cmp { return 0; } +# Asserts that all configured nodes in the cluster meet a minimum version requirement. +# Evaluates against the full, static cluster node list rather than only live nodes. +# Aborts if any node is offline, unreadable, or running an +# outdated version, preventing partial feature rollouts from corrupting cluster state. +sub assert_min_cluster_version { + my ($major, $minor, $release) = @_; + + my $nodestat = PVE::Cluster::get_node_kv('version-info') || {}; + + my $clinfo = PVE::Cluster::get_clinfo() || {}; + my $nodelist = $clinfo->{nodelist} || {}; + + foreach my $node (sort keys %$nodelist) { + my $raw_json = $nodestat->{$node}; + + if (!defined($raw_json)) { + die "cannot execute operation: cluster node '$node' is offline or not reporting its" + . " version. All nodes must be online to verify cluster-wide feature support.\n"; + } + + my $vinfo = eval { decode_json($raw_json) }; + if ($@ || !$vinfo || !$vinfo->{version}) { + die "cannot execute operation: failed to parse cluster version string for node" + . " '$node'.\n"; + } + + if (!pvecfg_min_version($vinfo->{version}, $major, $minor, $release)) { + die "cannot execute operation: cluster node '$node' runs an older version of Proxmox" + . " VE ($vinfo->{version}) than the required $major.$minor.$release. Please" + . " upgrade all nodes first.\n"; + } + } + return 1; +} + 1; -- 2.47.3