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 0F8211FF187 for ; Tue, 2 Dec 2025 12:15:44 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 630DECC34; Tue, 2 Dec 2025 12:16:08 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Tue, 2 Dec 2025 12:13:30 +0100 Message-ID: <20251202111533.2068448-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251202111533.2068448-1-d.csapak@proxmox.com> References: <20251202111533.2068448-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Subject: [pdm-devel] [PATCH yew-comp v2 1/2] pve: 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 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 | 6 ++++ src/configuration/pve/qemu_options_panel.rs | 32 ++++++++++++++++--- 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..03ec910 100644 --- a/src/configuration/pve/qemu_hardware_panel/mod.rs +++ b/src/configuration/pve/qemu_hardware_panel/mod.rs @@ -13,6 +13,7 @@ use pve_api_types::QemuConfig; use yew::html::{IntoEventCallback, IntoPropValue}; use yew::virtual_dom::{VComp, VNode}; +use proxmox_deb_version::Version; use pwt::prelude::*; use pwt::props::SubmitCallback; use pwt_macros::builder; @@ -38,6 +39,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, + /// 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..be91e44 100644 --- a/src/configuration/pve/qemu_options_panel.rs +++ b/src/configuration/pve/qemu_options_panel.rs @@ -13,16 +13,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::Version; 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 +61,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, + 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 +86,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(Version::new(NEWEST_KNOWN_VERSION, None)); + + if version >= Version::new("9.1", None) { + properties.push(crate::form::pve::qemu_intel_tdx_property(mobile)); + } + + properties } impl Component for PveQemuOptionsPanel { @@ -82,8 +103,9 @@ impl Component for PveQemuOptionsPanel { fn create(ctx: &Context) -> Self { let props = ctx.props(); + let version = props.pve_manager_version.clone(); Self { - properties: Rc::new(properties(&props.node, props.vmid, props.mobile)), + properties: Rc::new(properties(&props.node, props.vmid, version, props.mobile)), } } -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel