all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Daniel Kral" <d.kral@proxmox.com>
To: "David Riley" <d.riley@proxmox.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH pve-cluster 8/9] fix #7294: cluster: helpers: add cluster-wide version assertion
Date: Mon, 22 Jun 2026 11:42:31 +0200	[thread overview]
Message-ID: <DJFHAMTGAK0N.3QTBCHTOK172P@proxmox.com> (raw)
In-Reply-To: <20260611145935.147788-9-d.riley@proxmox.com>

On Thu Jun 11, 2026 at 4:59 PM CEST, David Riley wrote:
> 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 <d.riley@proxmox.com>
> ---
>  src/PVE/Cluster/Helpers.pm | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)

As for the previous patch, this could go in PVE::Cluster as code that
already depends on some cluster-related functionality has it imported,
but no hard feelings about this.

>
> 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} || {};

This might be unnecessary for single-node setups as there we can enforce
versioned dependencies much more easily through package version
constraints, but it should be noted that the $nodelist hash will be
empty if no cluster has been created.

If we want to make this assertion also work on single-node setups, this
could use PVE::Cluster::get_nodelist(), which fakes the nodelist for a
single node.

Either way, that should probably go in the subroutine's description.

> +
> +    foreach my $node (sort keys %$nodelist) {

nit: for new code we use 'for' in favor of 'foreach' [0]

[0] https://pve.proxmox.com/wiki/Perl_Style_Guide#Perl_syntax_choices

> +        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;
>  






  reply	other threads:[~2026-06-22  9:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 14:59 [PATCH access-control/cluster/manager/network/qemu-server 0/9] fix #7294: pool: add SDN VNets as pool members David Riley
2026-06-11 14:59 ` [PATCH pve-manager 1/9] ui: replace var with let to match style guide for variable declaration David Riley
2026-06-11 14:59 ` [PATCH pve-manager 2/9] fix #7294: api: pool: add SDN VNets as pool members David Riley
2026-06-22 11:20   ` Daniel Kral
2026-06-22 13:37     ` David Riley
2026-06-24  7:32       ` Daniel Kral
2026-06-24 12:06         ` David Riley
2026-06-11 14:59 ` [PATCH pve-manager 3/9] fix #7294: ui: " David Riley
2026-06-11 14:59 ` [PATCH pve-access-control 4/9] fix #7294: acl: " David Riley
2026-06-11 14:59 ` [PATCH pve-network 5/9] fix #7294: sdn: register api formats for zones and vnets David Riley
2026-06-12 12:18   ` Gabriel Goller
2026-06-12 12:51     ` David Riley
2026-06-12 13:46       ` Gabriel Goller
2026-06-12 14:17         ` David Riley
2026-06-11 14:59 ` [PATCH pve-network 6/9] fix #7294: sdn: vnet: update pool members on vnet migration and deletion David Riley
2026-06-11 16:21   ` Gabriel Goller
2026-06-12  6:37     ` David Riley
2026-06-12  8:41       ` Gabriel Goller
2026-06-11 14:59 ` [PATCH pve-cluster 7/9] cluster: add helpers module with version comparison functions David Riley
2026-06-22  9:31   ` Daniel Kral
2026-06-22 11:44     ` David Riley
2026-06-11 14:59 ` [PATCH pve-cluster 8/9] fix #7294: cluster: helpers: add cluster-wide version assertion David Riley
2026-06-22  9:42   ` Daniel Kral [this message]
2026-06-22 11:53     ` David Riley
2026-06-11 14:59 ` [PATCH qemu-server 9/9] fix #7294: helpers: use cluster-wide version helper David Riley
2026-06-19 10:01 ` [PATCH access-control/cluster/manager/network/qemu-server 0/9] fix #7294: pool: add SDN VNets as pool members Jakob Klocker
2026-06-19 11:12   ` David Riley

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=DJFHAMTGAK0N.3QTBCHTOK172P@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=d.riley@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal