public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp v2 1/2] pve: qemu: options/hardware: prepare and use version feature gating
Date: Tue,  2 Dec 2025 12:13:30 +0100	[thread overview]
Message-ID: <20251202111533.2068448-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251202111533.2068448-1-d.csapak@proxmox.com>

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 <d.csapak@proxmox.com>
---
 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<Version>,
+
     /// 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<Version>,
+
     /// Use Proxmox Datacenter Manager API endpoints
     #[builder(IntoPropValue, into_prop_value)]
     #[prop_or_default]
@@ -52,8 +61,13 @@ pub struct PveQemuOptionsPanel {
     properties: Rc<Vec<EditableProperty>>,
 }
 
-fn properties(node: &str, vmid: u32, mobile: bool) -> Vec<EditableProperty> {
-    vec![
+fn properties(
+    node: &str,
+    vmid: u32,
+    pve_manager_version: Option<Version>,
+    mobile: bool,
+) -> Vec<EditableProperty> {
+    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<EditableProperty> {
         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>) -> 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


  reply	other threads:[~2025-12-02 11:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 11:13 [pdm-devel] [PATCH datacenter-manager/yew-comp v2 0/5] add basic version guarding for pve guests config Dominik Csapak
2025-12-02 11:13 ` Dominik Csapak [this message]
2025-12-02 12:16   ` [pdm-devel] applied: [PATCH yew-comp v2 1/2] pve: qemu: options/hardware: prepare and use version feature gating Thomas Lamprecht
2025-12-02 11:13 ` [pdm-devel] [PATCH yew-comp v2 2/2] pve: lxc panels: prepare/add " Dominik Csapak
2025-12-02 12:17   ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 11:13 ` [pdm-devel] [PATCH datacenter-manager v2 1/3] lib/server: pve: add api call to get the cached version info from remotes Dominik Csapak
2025-12-02 11:46   ` Thomas Lamprecht
2025-12-02 12:17   ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 11:13 ` [pdm-devel] [PATCH datacenter-manager v2 2/3] ui: pve: qemu: load and pass the pve-manager version to panels Dominik Csapak
2025-12-02 12:17   ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 11:13 ` [pdm-devel] [PATCH datacenter-manager v2 3/3] ui: pve: lxc: " Dominik Csapak
2025-12-02 12:17   ` [pdm-devel] applied: " Thomas Lamprecht

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=20251202111533.2068448-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal