From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D52351FF065 for ; Mon, 23 Nov 2026 18:59:30 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 529CE20A57; Mon, 23 Nov 2026 18:59:30 +0100 (CET) From: Christian Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH pve-cluster 1/3] api: join info: include the cluster's highest manager version Date: Mon, 23 Nov 2026 18:59:13 +0100 Message-ID: <20261123175915.396455-2-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261123175915.396455-1-c.ebner@proxmox.com> References: <20261123175915.396455-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795456766148 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.353 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: YTSS5RP4MF6MG7RC6SNDSV7SVVGAHU74 X-Message-ID-Hash: YTSS5RP4MF6MG7RC6SNDSV7SVVGAHU74 X-MailFrom: c.ebner@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: Joining a node that runs a different Proxmox VE version than the cluster can cause problems, for example when a node freshly installed from a newer ISO joins a cluster that was not yet upgraded. So far, neither the join information nor the join dialog gave any indication of such a mismatch. Return the highest manager version that any cluster node broadcast via the cluster's key-value store, so that clients can compare it with the version of the joining node and warn the user beforehand. The highest version is used rather than the one of the node that the join information was requested from, as a cluster that is in the middle of an upgrade should be joined with the version it is upgraded to. The field is optional, as the version is only available once pvestatd has broadcast it. Signed-off-by: Christian Ebner --- src/PVE/API2/ClusterConfig.pm | 9 +++++++++ src/PVE/Cluster.pm | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/PVE/API2/ClusterConfig.pm b/src/PVE/API2/ClusterConfig.pm index bfffb88..4c8ca57 100644 --- a/src/PVE/API2/ClusterConfig.pm +++ b/src/PVE/API2/ClusterConfig.pm @@ -569,6 +569,11 @@ __PACKAGE__->register_method({ }, }, preferred_node => get_standard_option('pve-node'), + pve_version => { + type => 'string', + description => "The highest Proxmox VE manager version of all cluster nodes.", + optional => 1, + }, totem => { type => 'object' }, config_digest => { type => 'string' }, }, @@ -606,6 +611,10 @@ __PACKAGE__->register_method({ config_digest => $corosync_config_digest, }; + # informational only, so do not fail if the version info cannot be queried + my $version = eval { PVE::Cluster::get_highest_pvecfg_version() }; + $res->{pve_version} = $version if defined($version); + return $res; }, }); diff --git a/src/PVE/Cluster.pm b/src/PVE/Cluster.pm index cceb686..230ba87 100644 --- a/src/PVE/Cluster.pm +++ b/src/PVE/Cluster.pm @@ -1002,6 +1002,31 @@ sub get_node_pvecfg_version { return $version_info->{version}; } +# Returns the highest manager version that any cluster node broadcast, or undef if none did. Offline +# nodes are included with the last version they broadcast. Debian revision suffixes are ignored. +sub get_highest_pvecfg_version { + my $nodes_version_info = get_node_kv('version-info'); + + my ($highest, @highest_parts); + for my $raw (values $nodes_version_info->%*) { + my $version = eval { decode_json($raw)->{version} } // next; + my @parts = ($version =~ m/^(\d+)\.(\d+)(?:[.-](\d+))?/) or next; + $parts[2] //= 0; + + if (defined($highest)) { + my $cmp = + $parts[0] <=> $highest_parts[0] + || $parts[1] <=> $highest_parts[1] + || $parts[2] <=> $highest_parts[2]; + next if $cmp <= 0; + } + $highest = $version; + @highest_parts = @parts; + } + + return $highest; +} + sub node_pvecfg_version_at_least { my ($node, $major, $minor, $release) = @_; -- 2.47.3