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 v2 09/10] fix #7294: cluster: helpers: add cluster-wide version assertion
Date: Mon, 06 Jul 2026 15:00:20 +0200	[thread overview]
Message-ID: <DJRI9PPCCDF9.1M4WVXITTS2ZB@proxmox.com> (raw)
In-Reply-To: <20260626131035.112374-10-d.riley@proxmox.com>

On Fri Jun 26, 2026 at 3:10 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 configuration
> entries.
>
> Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294
> Signed-off-by: David Riley <d.riley@proxmox.com>
> ---
>  src/PVE/Cluster.pm | 43 +++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/Cluster.pm b/src/PVE/Cluster.pm
> index 034b78c..3ecde03 100644
> --- a/src/PVE/Cluster.pm
> +++ b/src/PVE/Cluster.pm
> @@ -20,7 +20,7 @@ use PVE::IPCC;
>  use PVE::JSONSchema;
>  use PVE::Network;
>  use PVE::SafeSyslog;
> -use PVE::Tools qw(run_command);
> +use PVE::Tools qw(run_command pvecfg_min_version);
>  
>  use PVE::Cluster::IPCConst;
>  
> @@ -30,7 +30,9 @@ our @EXPORT_OK = qw(
>      cfs_read_file
>      cfs_write_file
>      cfs_register_file
> -    cfs_lock_file);
> +    cfs_lock_file
> +    assert_min_cluster_version

This export is not needed anymore if the function is always called as
PVE::Cluster::assert_min_cluster_version().

> +);
>  
>  # x509 certificate utils
>  
> @@ -929,4 +931,41 @@ sub cfs_rename_db_unsafe {
>      rename $dbfile, "$dbfile.$ctime.bak" or warn "failed to rename old config database - $!\n";
>  }
>  
> +# 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.
> +# NOTE: Uses PVE::Tools::pvecfg_min_version, which currently checks basic major.minor.release
> +# triples. If gatekeeping a feature right around a major release transition, be aware that it
> +# does not yet lexically sort trailing Debian revision suffixes (e.g., distinguishing '9.0.0' as
> +# newer than '9.0.0~22').
> +sub assert_min_cluster_version {
> +    my ($major, $minor, $release) = @_;
> +
> +    my $nodestat = get_node_kv('version-info') || {};
> +    my $nodelist = get_nodelist() || [];

nit: get_node_kv() will always return an empty hash ref {} and
     get_nodelist() will always return an empty array ref [], so the
     fallbacks aren't really needed

> +
> +    for my $node (sort @$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;

Modulo the nits, consider this:

Reviewed-by: Daniel Kral <d.kral@proxmox.com>




  reply	other threads:[~2026-07-06 13:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 13:10 [PATCH access-control/cluster/common/manager/network/proxmox-widget-toolkit/qemu-server v2 00/10] fix #7294: pool: add SDN VNets as pool members David Riley
2026-06-26 13:10 ` [PATCH pve-manager v2 01/10] ui: replace var with let to match style guide for variable declaration David Riley
2026-07-03 13:14   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-manager v2 02/10] fix #7294: api: pool: add SDN VNets as pool members David Riley
2026-07-03 13:19   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-manager v2 03/10] fix #7294: ui: " David Riley
2026-07-06 14:17   ` Daniel Kral
2026-06-26 13:10 ` [PATCH proxmox-widget-toolkit v2 04/10] fix #7294: css: theme: add opacity override for pool VNet icon David Riley
2026-07-03 13:30   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-access-control v2 05/10] fix #7294: acl: pool: add SDN VNets as pool members David Riley
2026-07-03 14:35   ` Daniel Kral
2026-07-06 11:56   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-network v2 06/10] fix #7294: sdn: register api formats for zones and vnets David Riley
2026-07-06 12:21   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-network v2 07/10] fix #7294: sdn: vnet: update pool members on vnet migration and deletion David Riley
2026-07-06 12:29   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-common v2 08/10] tools: add helpers for version comparison David Riley
2026-07-06 13:02   ` Daniel Kral
2026-06-26 13:10 ` [PATCH pve-cluster v2 09/10] fix #7294: cluster: helpers: add cluster-wide version assertion David Riley
2026-07-06 13:00   ` Daniel Kral [this message]
2026-06-26 13:10 ` [PATCH qemu-server v2 10/10] fix #7294: helpers: use cluster-wide version helper David Riley
2026-07-06 13:20   ` Daniel Kral
2026-07-06 14:07 ` [PATCH access-control/cluster/common/manager/network/proxmox-widget-toolkit/qemu-server v2 00/10] fix #7294: pool: add SDN VNets as pool members Daniel Kral

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=DJRI9PPCCDF9.1M4WVXITTS2ZB@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