[pdm-devel] [PATCH datacenter-manager 2/5] server: api: pve: add cluster options api call

Dominik Csapak d.csapak at proxmox.com
Fri Nov 28 11:18:23 CET 2025


just GET for now.

It returns a `serde_json::Value` since adding the proper return schema
is rather hard at the moment. See the relevant commit in the
pve-api-types crate.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 server/src/api/pve/mod.rs | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/server/src/api/pve/mod.rs b/server/src/api/pve/mod.rs
index 34d9b760..dddb5dc2 100644
--- a/server/src/api/pve/mod.rs
+++ b/server/src/api/pve/mod.rs
@@ -70,6 +70,7 @@ const REMOTE_SUBDIRS: SubdirMap = &sorted!([
     ("lxc", &lxc::ROUTER),
     ("firewall", &firewall::CLUSTER_FW_ROUTER),
     ("nodes", &NODES_ROUTER),
+    ("options", &OPTIONS_ROUTER),
     ("qemu", &qemu::ROUTER),
     ("resources", &RESOURCES_ROUTER),
     ("cluster-status", &STATUS_ROUTER),
@@ -84,6 +85,8 @@ const RESOURCES_ROUTER: Router = Router::new().get(&API_METHOD_CLUSTER_RESOURCES
 
 const STATUS_ROUTER: Router = Router::new().get(&API_METHOD_CLUSTER_STATUS);
 
+const OPTIONS_ROUTER: Router = Router::new().get(&API_METHOD_GET_OPTIONS);
+
 // converts a remote + PveUpid into a RemoteUpid and starts tracking it
 pub async fn new_remote_upid(remote: String, upid: PveUpid) -> Result<RemoteUpid, Error> {
     let remote_upid = remote_tasks::track_running_pve_task(remote, upid).await?;
@@ -498,3 +501,24 @@ pub async fn list_realm_remote_pve(
 
     Ok(list)
 }
+
+#[api(
+    input: {
+        properties: {
+            remote: { schema: REMOTE_ID_SCHEMA },
+        },
+    },
+    access: {
+        permission: &Permission::Privilege(&["resource", "{remote}"], PRIV_RESOURCE_AUDIT, false),
+    },
+)]
+/// Return the remote's cluster options.
+pub async fn get_options(remote: String) -> Result<serde_json::Value, Error> {
+    let (remotes, _) = pdm_config::remotes::config()?;
+
+    let options = connect_to_remote(&remotes, &remote)?
+        .cluster_options()
+        .await?;
+
+    Ok(options)
+}
-- 
2.47.3





More information about the pdm-devel mailing list