public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox Datacenter Manager development discussion
	<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH yew-comp 1/2] qemu: options/hardware: prepare and use version feature gating
Date: Tue, 2 Dec 2025 11:53:52 +0100	[thread overview]
Message-ID: <5686ab8f-e68a-47be-ac5a-d4e729698196@proxmox.com> (raw)
In-Reply-To: <ae17fe35-ea07-4001-bb12-68fd2a51b636@proxmox.com>



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 <d.csapak@proxmox.com>
>> ---
>>   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<String>,
> 
> 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<String>,
>> +
>>       /// Use Proxmox Datacenter Manager API endpoints
>>       #[builder(IntoPropValue, into_prop_value)]
>>       #[prop_or_default]
>> @@ -52,8 +62,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<&str>,
>> +    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 +87,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(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>) -> 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


  reply	other threads:[~2025-12-02 10:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02  9:59 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/6] add basic version guarding for pve guests Dominik Csapak
2025-12-02 10:00 ` [pdm-devel] [PATCH yew-comp 1/2] qemu: options/hardware: prepare and use version feature gating Dominik Csapak
2025-12-02 10:32   ` Thomas Lamprecht
2025-12-02 10:53     ` Dominik Csapak [this message]
2025-12-02 10:00 ` [pdm-devel] [PATCH yew-comp 2/2] pve: lxc panels: prepare/add " Dominik Csapak
2025-12-02 10:00 ` [pdm-devel] [PATCH datacenter-manager 1/4] ui: subscription_info: add subscription counts Dominik Csapak
2025-12-02 10:00 ` [pdm-devel] [PATCH datacenter-manager 2/4] lib/server: pve: add api call to get the cached version info from remotes Dominik Csapak
2025-12-02 10:00 ` [pdm-devel] [PATCH datacenter-manager 3/4] ui: pve: qemu: load and pass the pve-manager version to panels Dominik Csapak
2025-12-02 10:00 ` [pdm-devel] [PATCH datacenter-manager 4/4] ui: pve: lxc: " Dominik Csapak
2025-12-02 11:18 ` [pdm-devel] superseded: [PATCH datacenter-manager/yew-comp 0/6] add basic version guarding for pve guests Dominik Csapak

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=5686ab8f-e68a-47be-ac5a-d4e729698196@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    --cc=t.lamprecht@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