From: Dietmar Maurer <dietmar@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 1/5] server: api: qemu: add pending api
Date: Thu, 27 Nov 2025 12:34:24 +0100 [thread overview]
Message-ID: <20251127113428.911697-1-dietmar@proxmox.com> (raw)
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
next 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 Dietmar Maurer [this message]
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
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-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox