From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp 2/2] pve: lxc panels: prepare/add version feature gating
Date: Tue, 2 Dec 2025 11:00:01 +0100 [thread overview]
Message-ID: <20251202100012.1328096-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251202100012.1328096-1-d.csapak@proxmox.com>
add the pve-manager version as property to the various lxc panels, and
use it on the options to display the new 'env' and 'entrypoint' options,
analogous to how we do it for the qemu panel.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/configuration/pve/lxc_dns_panel.rs | 5 +++
src/configuration/pve/lxc_network_panel.rs | 5 +++
src/configuration/pve/lxc_options_panel.rs | 33 ++++++++++++++++---
.../pve/lxc_resources_panel/mod.rs | 5 +++
src/form/pve/lxc_property/mod.rs | 11 +++++++
src/form/pve/mod.rs | 10 +++---
6 files changed, 60 insertions(+), 9 deletions(-)
diff --git a/src/configuration/pve/lxc_dns_panel.rs b/src/configuration/pve/lxc_dns_panel.rs
index 303843a..1e3a969 100644
--- a/src/configuration/pve/lxc_dns_panel.rs
+++ b/src/configuration/pve/lxc_dns_panel.rs
@@ -21,6 +21,11 @@ pub struct LxcDnsPanel {
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]
diff --git a/src/configuration/pve/lxc_network_panel.rs b/src/configuration/pve/lxc_network_panel.rs
index 613448a..de78ff9 100644
--- a/src/configuration/pve/lxc_network_panel.rs
+++ b/src/configuration/pve/lxc_network_panel.rs
@@ -32,6 +32,11 @@ pub struct LxcNetworkPanel {
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]
diff --git a/src/configuration/pve/lxc_options_panel.rs b/src/configuration/pve/lxc_options_panel.rs
index a2d9760..96edd00 100644
--- a/src/configuration/pve/lxc_options_panel.rs
+++ b/src/configuration/pve/lxc_options_panel.rs
@@ -1,5 +1,7 @@
+use std::cmp::Ordering;
use std::rc::Rc;
+use proxmox_deb_version::cmp_versions;
use pwt::props::SubmitCallback;
use serde_json::Value;
@@ -19,12 +21,20 @@ use pve_api_types::LxcConfig;
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 LxcOptionsPanel {
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]
@@ -54,8 +64,13 @@ pub struct PveLxcOptionsPanel {
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::Lxc_name_property(vmid, mobile),
crate::form::pve::qemu_onboot_property(mobile),
crate::form::pve::qemu_startup_property(mobile),
@@ -68,7 +83,16 @@ fn properties(_node: &str, _vmid: u32, mobile: bool) -> Vec<EditableProperty> {
crate::form::pve::lxc_unpriviledged_property(),
crate::form::pve::lxc_features_property(mobile),
crate::form::pve::lxc_hookscript_property(),
- ]
+ ];
+
+ let version = pve_manager_version.unwrap_or(NEWEST_KNOWN_VERSION);
+
+ if cmp_versions(version, "9.1") != Ok(Ordering::Less) {
+ properties.push(crate::form::pve::lxc_entrypoint_property());
+ properties.push(crate::form::pve::lxc_env_property());
+ }
+
+ properties
}
impl Component for PveLxcOptionsPanel {
@@ -77,8 +101,9 @@ impl Component for PveLxcOptionsPanel {
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)),
}
}
diff --git a/src/configuration/pve/lxc_resources_panel/mod.rs b/src/configuration/pve/lxc_resources_panel/mod.rs
index 54e66aa..31eb859 100644
--- a/src/configuration/pve/lxc_resources_panel/mod.rs
+++ b/src/configuration/pve/lxc_resources_panel/mod.rs
@@ -35,6 +35,11 @@ pub struct LxcResourcesPanel {
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]
diff --git a/src/form/pve/lxc_property/mod.rs b/src/form/pve/lxc_property/mod.rs
index 2864359..54d175d 100644
--- a/src/form/pve/lxc_property/mod.rs
+++ b/src/form/pve/lxc_property/mod.rs
@@ -119,6 +119,17 @@ pub fn lxc_hookscript_property() -> EditableProperty {
EditableProperty::new("hookscript", tr!("Hookscript"))
}
+pub fn lxc_entrypoint_property() -> EditableProperty {
+ EditableProperty::new("entrypoint", tr!("Entrypoint"))
+}
+
+pub fn lxc_env_property() -> EditableProperty {
+ EditableProperty::new("env", tr!("Environment")).renderer(|_name, value, _data| match value {
+ Value::String(env) => env.split('\0').collect::<Vec<_>>().join(" ").into(),
+ _ => value.into(),
+ })
+}
+
pub fn lxc_tty_count_property(mobile: bool) -> EditableProperty {
let title = tr!("TTY count");
EditableProperty::new("tty", title.clone())
diff --git a/src/form/pve/mod.rs b/src/form/pve/mod.rs
index fc0e2c5..0be5e6f 100644
--- a/src/form/pve/mod.rs
+++ b/src/form/pve/mod.rs
@@ -54,11 +54,11 @@ pub use lxc_mount_options_selector::LxcMountOptionsSelector;
mod lxc_property;
pub use lxc_property::{
extract_used_mount_points, first_unused_mount_point, lxc_architecture_property,
- lxc_console_mode_property, lxc_console_property, lxc_cores_property, lxc_features_property,
- lxc_hookscript_property, lxc_hostname_property, lxc_memory_property, lxc_mount_point_property,
- lxc_nameserver_property, lxc_network_property, lxc_ostype_property, lxc_rootfs_property,
- lxc_searchdomain_property, lxc_swap_property, lxc_tty_count_property,
- lxc_unpriviledged_property, lxc_unused_volume_property,
+ lxc_console_mode_property, lxc_console_property, lxc_cores_property, lxc_entrypoint_property,
+ lxc_env_property, lxc_features_property, lxc_hookscript_property, lxc_hostname_property,
+ lxc_memory_property, lxc_mount_point_property, lxc_nameserver_property, lxc_network_property,
+ lxc_ostype_property, lxc_rootfs_property, lxc_searchdomain_property, lxc_swap_property,
+ lxc_tty_count_property, lxc_unpriviledged_property, lxc_unused_volume_property,
};
mod qemu_property;
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-12-02 10:00 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
2025-12-02 10:00 ` Dominik Csapak [this message]
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=20251202100012.1328096-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.