all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager 1/5] server: api: qemu: add pending api
@ 2025-11-27 11:34 Dietmar Maurer
  2025-11-27 11:34 ` [pdm-devel] [PATCH datacenter-manager 2/5] server: api: lxc: " Dietmar Maurer
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Dietmar Maurer @ 2025-11-27 11:34 UTC (permalink / raw)
  To: pdm-devel

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

diff --git a/server/src/api/pve/qemu.rs b/server/src/api/pve/qemu.rs
index 4f144b7..effa7e5 100644
--- a/server/src/api/pve/qemu.rs
+++ b/server/src/api/pve/qemu.rs
@@ -14,7 +14,7 @@ use pdm_api_types::{
     PRIV_RESOURCE_MANAGE, PRIV_RESOURCE_MIGRATE, SNAPSHOT_NAME_SCHEMA, VMID_SCHEMA,
 };
 
-use pve_api_types::{QemuMigratePreconditions, StartQemuMigrationType};
+use pve_api_types::{PendingConfigValue, QemuMigratePreconditions, StartQemuMigrationType};
 
 use crate::api::pve::get_remote;
 
@@ -33,6 +33,7 @@ const QEMU_VM_ROUTER: Router = Router::new()
 #[sortable]
 const QEMU_VM_SUBDIRS: SubdirMap = &sorted!([
     ("config", &Router::new().get(&API_METHOD_QEMU_GET_CONFIG)),
+    ("pending", &Router::new().get(&API_METHOD_QEMU_GET_PENDING)),
     ("rrddata", &super::rrddata::QEMU_RRD_ROUTER),
     ("start", &Router::new().post(&API_METHOD_QEMU_START)),
     ("status", &Router::new().get(&API_METHOD_QEMU_GET_STATUS)),
@@ -152,6 +153,39 @@ pub async fn qemu_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 qemu VM from a remote. If a node is provided, the VM must be on that
+/// node, otherwise the node is determined automatically.
+pub async fn qemu_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.qemu_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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-27 17:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-27 11:34 [pdm-devel] [PATCH datacenter-manager 1/5] server: api: qemu: add pending api Dietmar Maurer
2025-11-27 11:34 ` [pdm-devel] [PATCH datacenter-manager 2/5] server: api: lxc: " Dietmar Maurer
2025-11-27 12:38   ` 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

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