From d3615c7df611e67247878873ed44b9fb95fcb996 Mon Sep 17 00:00:00 2001 From: Clint Branham Date: Sat, 21 Mar 2026 10:21:22 -0500 Subject: [PATCH] feat: add parameter-level version warnings for named params from newer PVE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warn (not block) when users pass named parameters that were added in later PVE versions: - Send-PveFile: -Checksum/-ChecksumAlgorithm require PVE 7.1 - New/Set-PveSdnSubnet: -DhcpRange requires PVE 8.1 These are warnings, not hard blocks — the parameter is still sent to the API, which will either accept it or return its own error. This only applies to named cmdlet parameters, not AdditionalConfig pass-through hashtables. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/PSProxmoxVE/Cmdlets/Network/NewPveSdnSubnetCmdlet.cs | 8 ++++++++ src/PSProxmoxVE/Cmdlets/Network/SetPveSdnSubnetCmdlet.cs | 8 ++++++++ src/PSProxmoxVE/Cmdlets/Storage/SendPveFileCmdlet.cs | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/src/PSProxmoxVE/Cmdlets/Network/NewPveSdnSubnetCmdlet.cs b/src/PSProxmoxVE/Cmdlets/Network/NewPveSdnSubnetCmdlet.cs index 0150626..ffd9b0f 100644 --- a/src/PSProxmoxVE/Cmdlets/Network/NewPveSdnSubnetCmdlet.cs +++ b/src/PSProxmoxVE/Cmdlets/Network/NewPveSdnSubnetCmdlet.cs @@ -45,6 +45,14 @@ namespace PSProxmoxVE.Cmdlets.Network var session = GetSession(); RequireVersion(session, "SDN", 6, 2, 8, 0); + + if (!string.IsNullOrEmpty(DhcpRange) + && session.ServerVersion != null && !session.ServerVersion.IsAtLeast(8, 1)) + { + WriteWarning("The -DhcpRange parameter requires PVE 8.1 or later. " + + $"Connected server is PVE {session.ServerVersion}. The parameter will be sent but may be ignored."); + } + using var client = new PveHttpClient(session); WriteVerbose($"Creating SDN subnet '{Subnet}' on VNet '{Vnet}'..."); diff --git a/src/PSProxmoxVE/Cmdlets/Network/SetPveSdnSubnetCmdlet.cs b/src/PSProxmoxVE/Cmdlets/Network/SetPveSdnSubnetCmdlet.cs index 4c7120d..cf35a8c 100644 --- a/src/PSProxmoxVE/Cmdlets/Network/SetPveSdnSubnetCmdlet.cs +++ b/src/PSProxmoxVE/Cmdlets/Network/SetPveSdnSubnetCmdlet.cs @@ -45,6 +45,14 @@ namespace PSProxmoxVE.Cmdlets.Network var session = GetSession(); RequireVersion(session, "SDN", 6, 2, 8, 0); + + if (!string.IsNullOrEmpty(DhcpRange) + && session.ServerVersion != null && !session.ServerVersion.IsAtLeast(8, 1)) + { + WriteWarning("The -DhcpRange parameter requires PVE 8.1 or later. " + + $"Connected server is PVE {session.ServerVersion}. The parameter will be sent but may be ignored."); + } + var service = new NetworkService(); WriteVerbose($"Updating SDN subnet '{Subnet}' on VNet '{Vnet}'..."); diff --git a/src/PSProxmoxVE/Cmdlets/Storage/SendPveFileCmdlet.cs b/src/PSProxmoxVE/Cmdlets/Storage/SendPveFileCmdlet.cs index 29c9a86..b169ccc 100644 --- a/src/PSProxmoxVE/Cmdlets/Storage/SendPveFileCmdlet.cs +++ b/src/PSProxmoxVE/Cmdlets/Storage/SendPveFileCmdlet.cs @@ -66,6 +66,14 @@ namespace PSProxmoxVE.Cmdlets.Storage return; var session = GetSession(); + + if ((!string.IsNullOrEmpty(Checksum) || !string.IsNullOrEmpty(ChecksumAlgorithm)) + && session.ServerVersion != null && !session.ServerVersion.IsAtLeast(7, 1)) + { + WriteWarning("The -Checksum and -ChecksumAlgorithm parameters require PVE 7.1 or later. " + + $"Connected server is PVE {session.ServerVersion}. The upload will proceed without checksum verification."); + } + using var client = new PveHttpClient(session); WriteVerbose($"Uploading {fileName} to {Node}/{Storage} (content={ContentType})...");