all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 2/5] server: api: lxc: add pending api
Date: Thu, 27 Nov 2025 12:34:25 +0100	[thread overview]
Message-ID: <20251127113428.911697-2-dietmar@proxmox.com> (raw)
In-Reply-To: <20251127113428.911697-1-dietmar@proxmox.com>

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
 server/src/api/pve/lxc.rs | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/server/src/api/pve/lxc.rs b/server/src/api/pve/lxc.rs
index ecf0bef..3c27d24 100644
--- a/server/src/api/pve/lxc.rs
+++ b/server/src/api/pve/lxc.rs
@@ -7,6 +7,7 @@ use proxmox_router::{
 };
 use proxmox_schema::api;
 use proxmox_sortable_macro::sortable;
+use pve_api_types::PendingConfigValue;
 
 use pdm_api_types::remotes::REMOTE_ID_SCHEMA;
 use pdm_api_types::{
@@ -33,6 +34,7 @@ const LXC_VM_ROUTER: Router = Router::new()
 #[sortable]
 const LXC_VM_SUBDIRS: SubdirMap = &sorted!([
     ("config", &Router::new().get(&API_METHOD_LXC_GET_CONFIG)),
+    ("pending", &Router::new().get(&API_METHOD_LXC_GET_PENDING)),
     ("rrddata", &super::rrddata::LXC_RRD_ROUTER),
     ("start", &Router::new().post(&API_METHOD_LXC_START)),
     ("status", &Router::new().get(&API_METHOD_LXC_GET_STATUS)),
@@ -147,6 +149,39 @@ pub async fn lxc_get_config(
         .await?)
 }
 
+#[api(
+    input: {
+        properties: {
+            remote: { schema: REMOTE_ID_SCHEMA },
+            node: {
+                schema: NODE_SCHEMA,
+                optional: true,
+            },
+            vmid: { schema: VMID_SCHEMA },
+        },
+    },
+    // Note: the trait `ApiType` is not implemented for `PendingConfigValue` because it contains Value
+    // returns: { description: "Configuration property with pending changes.", type: Array, items: { type: PendingConfigValue, }},
+    access: {
+        permission: &Permission::Privilege(&["resource", "{remote}", "guest", "{vmid}"], PRIV_RESOURCE_AUDIT, false),
+    },
+)]
+/// Get the pending configuration of a lxc container from a remote. If a node is provided, the container must be on that
+/// node, otherwise the node is determined automatically.
+pub async fn lxc_get_pending(
+    remote: String,
+    node: Option<String>,
+    vmid: u32,
+) -> Result<Vec<PendingConfigValue>, Error> {
+    let (remotes, _) = pdm_config::remotes::config()?;
+
+    let pve = connect_to_remote(&remotes, &remote)?;
+
+    let node = find_node_for_vm(node, vmid, pve.as_ref()).await?;
+
+    Ok(pve.lxc_get_pending(&node, vmid).await?)
+}
+
 #[api(
     input: {
         properties: {
-- 
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-11-27 11:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 11:34 [pdm-devel] [PATCH datacenter-manager 1/5] server: api: qemu: " Dietmar Maurer
2025-11-27 11:34 ` Dietmar Maurer [this message]
2025-11-27 12:38   ` [pdm-devel] [PATCH datacenter-manager 2/5] server: api: lxc: " Lukas Wagner
2025-11-27 11:34 ` [pdm-devel] [PATCH datacenter-manager 3/5] ui: add cdrom icon Dietmar Maurer
2025-11-27 12:39   ` Lukas Wagner
2025-11-27 11:34 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: add qemu Hardware and Options panel Dietmar Maurer
2025-11-27 12:39   ` Lukas Wagner
2025-11-27 11:34 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: add lxc resources, network, dns and options panels Dietmar Maurer
2025-11-27 12:39   ` Lukas Wagner
2025-11-27 12:38 ` [pdm-devel] [PATCH datacenter-manager 1/5] server: api: qemu: add pending api Lukas Wagner
2025-11-27 17:46 ` 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=20251127113428.911697-2-dietmar@proxmox.com \
    --to=dietmar@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal