From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 9D1A91FF187 for ; Tue, 2 Dec 2025 11:53:39 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D53D0C236; Tue, 2 Dec 2025 11:54:04 +0100 (CET) Message-ID: <5686ab8f-e68a-47be-ac5a-d4e729698196@proxmox.com> Date: Tue, 2 Dec 2025 11:53:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Thomas Lamprecht , Proxmox Datacenter Manager development discussion References: <20251202100012.1328096-1-d.csapak@proxmox.com> <20251202100012.1328096-2-d.csapak@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764672797893 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 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 Subject: Re: [pdm-devel] [PATCH yew-comp 1/2] qemu: options/hardware: prepare and use version feature gating X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" On 12/2/25 11:32 AM, Thomas Lamprecht wrote: > Am 02.12.25 um 11:00 schrieb Dominik Csapak: >> use the pve-manager version to feature gate the intel-tdx property for >> now, but also prepare the hardware panel so we can already start passing >> the version to it. If we need it there, we already have it then. >> >> Signed-off-by: Dominik Csapak >> --- >> Cargo.toml | 1 + >> .../pve/qemu_hardware_panel/mod.rs | 5 +++ >> src/configuration/pve/qemu_options_panel.rs | 33 ++++++++++++++++--- >> 3 files changed, 34 insertions(+), 5 deletions(-) >> >> diff --git a/Cargo.toml b/Cargo.toml >> index 622bb09..600fafa 100644 >> --- a/Cargo.toml >> +++ b/Cargo.toml >> @@ -88,6 +88,7 @@ proxmox-node-status = { version = "1", features = [] } >> >> pve-api-types = "8.1.2" >> pbs-api-types = "1" >> +proxmox-deb-version = "0.1.0" >> >> [features] >> default = [] >> diff --git a/src/configuration/pve/qemu_hardware_panel/mod.rs b/src/configuration/pve/qemu_hardware_panel/mod.rs >> index 38bc6fd..c04c01f 100644 >> --- a/src/configuration/pve/qemu_hardware_panel/mod.rs >> +++ b/src/configuration/pve/qemu_hardware_panel/mod.rs >> @@ -38,6 +38,11 @@ pub struct QemuHardwarePanel { >> vmid: u32, >> node: AttrValue, >> >> + #[prop_or_default] >> + #[builder(IntoPropValue, into_prop_value)] >> + /// The nodes pve-manager version, used to feature gate some entries. >> + pve_manager_version: Option, > > FWIW, proxmox_deb_version::Version might be a better fit here, it's effectively > boiling down to using as much allocated memory as the string here, but should be > a bit more convenient to use. > > I actually also want to change the usage I introduced in PDM directly to the > owned type, as after sleeping a night over that I noticed that if I assemble a > Vec of version String's, I might as well directly assemble a Vec of > proxmox_deb_version::Version. > > Anyhow, can be also fine as is, just wanted to point it out in case you > overlooked this possibility initially the same way I did ^^ > > Looks OK to me in general. > yes actually, i didn't see that, only the cmp_version function i'll see if i can change this to a version here >> + >> /// Use Proxmox Datacenter Manager API endpoints >> #[builder(IntoPropValue, into_prop_value)] >> #[prop_or_default] >> diff --git a/src/configuration/pve/qemu_options_panel.rs b/src/configuration/pve/qemu_options_panel.rs >> index 4843ed9..b45d9bd 100644 >> --- a/src/configuration/pve/qemu_options_panel.rs >> +++ b/src/configuration/pve/qemu_options_panel.rs >> @@ -1,3 +1,4 @@ >> +use std::cmp::Ordering; >> use std::rc::Rc; >> >> use pwt::props::SubmitCallback; >> @@ -13,16 +14,25 @@ use crate::pending_property_view::{pending_typed_load, PendingPropertyGrid, Pend >> use crate::EditableProperty; >> use crate::{http_put, percent_encoding::percent_encode_component}; >> >> +use proxmox_deb_version::cmp_versions; >> use pve_api_types::QemuConfig; >> >> use pwt_macros::builder; >> >> +// newest known pve-manager version we care for >> +const NEWEST_KNOWN_VERSION: &str = "9.1.2"; >> + >> #[derive(Clone, PartialEq, Properties)] >> #[builder] >> pub struct QemuOptionsPanel { >> vmid: u32, >> node: AttrValue, >> >> + #[prop_or_default] >> + #[builder(IntoPropValue, into_prop_value)] >> + /// The nodes pve-manager version, used to feature gate some entries >> + pve_manager_version: Option, >> + >> /// Use Proxmox Datacenter Manager API endpoints >> #[builder(IntoPropValue, into_prop_value)] >> #[prop_or_default] >> @@ -52,8 +62,13 @@ pub struct PveQemuOptionsPanel { >> properties: Rc>, >> } >> >> -fn properties(node: &str, vmid: u32, mobile: bool) -> Vec { >> - vec![ >> +fn properties( >> + node: &str, >> + vmid: u32, >> + pve_manager_version: Option<&str>, >> + mobile: bool, >> +) -> Vec { >> + let mut properties = vec![ >> crate::form::pve::qemu_name_property(vmid, mobile), >> crate::form::pve::qemu_onboot_property(mobile), >> crate::form::pve::qemu_startup_property(mobile), >> @@ -72,8 +87,15 @@ fn properties(node: &str, vmid: u32, mobile: bool) -> Vec { >> crate::form::pve::qemu_spice_enhancement_property(mobile), >> crate::form::pve::qemu_vmstatestorage_property(node, mobile), >> crate::form::pve::qemu_amd_sev_property(mobile), >> - crate::form::pve::qemu_intel_tdx_property(mobile), >> - ] >> + ]; >> + >> + let version = pve_manager_version.unwrap_or(NEWEST_KNOWN_VERSION); >> + >> + if cmp_versions(version, "9.1") != Ok(Ordering::Less) { >> + properties.push(crate::form::pve::qemu_intel_tdx_property(mobile)); >> + } >> + >> + properties >> } >> >> impl Component for PveQemuOptionsPanel { >> @@ -82,8 +104,9 @@ impl Component for PveQemuOptionsPanel { >> >> fn create(ctx: &Context) -> Self { >> let props = ctx.props(); >> + let version = props.pve_manager_version.as_deref(); >> Self { >> - properties: Rc::new(properties(&props.node, props.vmid, props.mobile)), >> + properties: Rc::new(properties(&props.node, props.vmid, version, props.mobile)), >> } >> } >> > _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel