all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager 1/2] server: api: pbs: rename 'list_snapshots_2' to 'list_snapshots'
@ 2025-12-05 11:04 Dominik Csapak
  2025-12-05 11:04 ` [pdm-devel] [PATCH datacenter-manager 2/2] server: api: pbs: improve error message for datastore content Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-12-05 11:04 UTC (permalink / raw)
  To: pdm-devel

no functional change intended, just cosmetic

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 server/src/api/pbs/mod.rs | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/server/src/api/pbs/mod.rs b/server/src/api/pbs/mod.rs
index badefc39..e44a0adf 100644
--- a/server/src/api/pbs/mod.rs
+++ b/server/src/api/pbs/mod.rs
@@ -69,10 +69,7 @@ const DATASTORE_ITEM_SUBDIRS: SubdirMap = &sorted!([
         "namespaces",
         &Router::new().get(&API_METHOD_LIST_NAMESPACES)
     ),
-    (
-        "snapshots",
-        &Router::new().get(&API_METHOD_LIST_SNAPSHOTS_2)
-    ),
+    ("snapshots", &Router::new().get(&API_METHOD_LIST_SNAPSHOTS)),
 ]);
 
 // converts a remote + pbs_api_types::UPID into a RemoteUpid and starts tracking it
@@ -178,7 +175,7 @@ async fn list_namespaces(
     },
 )]
 /// List the PBS remote's datastores.
-async fn list_snapshots_2(
+async fn list_snapshots(
     remote: String,
     datastore: String,
     ns: Option<String>,
-- 
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] 2+ messages in thread

* [pdm-devel] [PATCH datacenter-manager 2/2] server: api: pbs: improve error message for datastore content
  2025-12-05 11:04 [pdm-devel] [PATCH datacenter-manager 1/2] server: api: pbs: rename 'list_snapshots_2' to 'list_snapshots' Dominik Csapak
@ 2025-12-05 11:04 ` Dominik Csapak
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Csapak @ 2025-12-05 11:04 UTC (permalink / raw)
  To: pdm-devel

the code here looks for the response code to determine what to do, but
since the 'extjs' formatter is used, that's always 200, so it's always
attempted to parse the body like a successful api call.

Change the api call to use the 'json' formatter, which correctly sets
the response code directly and not in the body.

This fixes an issue with a very non-informative error message when a pbs
datastore has an error (e.g. no '.chunks' folder) like

 missing field `data` at line 1 column xy

instead of the actual error message from the api call.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 server/src/pbs_client.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs
index f4f1f820..3f3d2b5f 100644
--- a/server/src/pbs_client.rs
+++ b/server/src/pbs_client.rs
@@ -185,10 +185,9 @@ impl PbsClient {
         datastore: &str,
         namespace: Option<&str>,
     ) -> Result<JsonRecords<pbs_api_types::SnapshotListItem>, anyhow::Error> {
-        let path =
-            ApiPathBuilder::new(format!("/api2/extjs/admin/datastore/{datastore}/snapshots"))
-                .maybe_arg("ns", &namespace)
-                .build();
+        let path = ApiPathBuilder::new(format!("/api2/json/admin/datastore/{datastore}/snapshots"))
+            .maybe_arg("ns", &namespace)
+            .build();
         let response = self
             .0
             .streaming_request(http::Method::GET, &path, None::<()>)
-- 
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] 2+ messages in thread

end of thread, other threads:[~2025-12-05 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-05 11:04 [pdm-devel] [PATCH datacenter-manager 1/2] server: api: pbs: rename 'list_snapshots_2' to 'list_snapshots' Dominik Csapak
2025-12-05 11:04 ` [pdm-devel] [PATCH datacenter-manager 2/2] server: api: pbs: improve error message for datastore content Dominik Csapak

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