From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 30B8E1FF15C for ; Fri, 28 Nov 2025 11:18:34 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E2307161BB; Fri, 28 Nov 2025 11:18:52 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Fri, 28 Nov 2025 11:18:23 +0100 Message-ID: <20251128101848.1580111-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251128101848.1580111-1-d.csapak@proxmox.com> References: <20251128101848.1580111-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager 2/5] server: api: pve: add cluster options api call X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 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 --- 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 { 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 { + let (remotes, _) = pdm_config::remotes::config()?; + + let options = connect_to_remote(&remotes, &remote)? + .cluster_options() + .await?; + + Ok(options) +} -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel