[PATCH datacenter-manager v2 21/25] api: fix /nodes/localhost/rrddata endpoint

Lukas Wagner
2026-03-19T09:46:48Z

We didn't use this existing endpoint so far, which is why this mistake
was not discovered yet. First, there was a typo in the API handler path,
and second the `node` parameter was missing from the handler itself.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
Tested-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
lib/pdm-client/src/lib.rs | 2 +-
server/src/api/nodes/mod.rs | 2 +-
server/src/api/nodes/rrddata.rs | 18 ++++++++++++++++--
3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 7ce9c244..2d98146b 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -380,7 +380,7 @@ impl<T: HttpApiClient> PdmClient<T> {
&self,
mode: RrdMode,
timeframe: RrdTimeframe,
- ) -> Result<pdm_api_types::rrddata::PdmNodeDatapoint, Error> {
+ ) -> Result<Vec<pdm_api_types::rrddata::PdmNodeDatapoint>, Error> {
let path = ApiPathBuilder::new("/api2/extjs/nodes/localhost/rrddata")
.arg("cf", mode)
.arg("timeframe", timeframe)
diff --git a/server/src/api/nodes/mod.rs b/server/src/api/nodes/mod.rs
index bd1396bc..7903d63a 100644
--- a/server/src/api/nodes/mod.rs
+++ b/server/src/api/nodes/mod.rs
@@ -48,7 +48,7 @@ pub const SUBDIRS: SubdirMap = &sorted!([
("journal", &journal::ROUTER),
("network", &network::ROUTER),
("report", &report::ROUTER),
- ("rrdata", &rrddata::ROUTER),
+ ("rrddata", &rrddata::ROUTER),
("sdn", &sdn::ROUTER),
("subscription", &subscription::ROUTER),
("status", &status::ROUTER),
diff --git a/server/src/api/nodes/rrddata.rs b/server/src/api/nodes/rrddata.rs
index 75900965..4c2302c8 100644
--- a/server/src/api/nodes/rrddata.rs
+++ b/server/src/api/nodes/rrddata.rs
@@ -1,10 +1,11 @@
use anyhow::Error;
use proxmox_rrd_api_types::{RrdMode, RrdTimeframe};

-use proxmox_router::Router;
+use proxmox_router::{http_bail, Router};
use proxmox_schema::api;

use pdm_api_types::rrddata::PdmNodeDatapoint;
+use pdm_api_types::NODE_SCHEMA;

use crate::api::rrd_common::{self, DataPoint};

@@ -36,6 +37,9 @@ impl DataPoint for PdmNodeDatapoint {
cf: {
type: RrdMode,
},
+ node: {
+ schema: NODE_SCHEMA,
+ },
},
},
returns: {
@@ -47,7 +51,17 @@ impl DataPoint for PdmNodeDatapoint {
}
)]
/// Read RRD data for this PDM node.
-fn get_node_rrddata(timeframe: RrdTimeframe, cf: RrdMode) -> Result<Vec<PdmNodeDatapoint>, Error> {
+fn get_node_rrddata(
+ node: String,
+ timeframe: RrdTimeframe,
+ cf: RrdMode,
+) -> Result<Vec<PdmNodeDatapoint>, Error> {
+ if node != "localhost" {
+ http_bail!(
+ BAD_REQUEST,
+ "PDM only supports `localhost` as a `node` parameter"
+ );
+ }
let base = "nodes/localhost";
rrd_common::create_datapoints_from_rrd(base, timeframe, cf)
}
--
2.47.3