[pdm-devel] [PATCH datacenter-manager 05/21] pdm-client: add scan_remote and probe_tls methods

Lukas Wagner l.wagner at proxmox.com
Tue Aug 19 13:55:02 CEST 2025


On Fri May 16, 2025 at 3:35 PM CEST, Dominik Csapak wrote:
> so we can use that in the ui instead of making the api calls manually
> via the path.
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  lib/pdm-client/src/lib.rs | 45 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>
> diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
> index 61a8ebd..d656ab1 100644
> --- a/lib/pdm-client/src/lib.rs
> +++ b/lib/pdm-client/src/lib.rs
> @@ -3,6 +3,7 @@
>  use std::collections::HashMap;
>  use std::time::Duration;
>  
> +use pdm_api_types::remotes::ScanResult;
>  use pdm_api_types::resource::{PveResource, RemoteResources, TopEntities};
>  use pdm_api_types::rrddata::{
>      LxcDataPoint, NodeDataPoint, PbsDatastoreDataPoint, PbsNodeDataPoint, QemuDataPoint,
> @@ -865,6 +866,50 @@ impl<T: HttpApiClient> PdmClient<T> {
>          .build();
>          Ok(self.0.get(&path).await?.expect_json()?.data)
>      }
> +
> +    /// uses /pve/scan to probe the tls connection to the given host
> +    pub async fn pve_probe_tls(
> +        &self,
> +        hostname: &str,
> +        fingerprint: Option<&str>,
> +    ) -> Result<ScanResult, Error> {
> +        let mut params = json!({
> +            "hostname": hostname,
> +        });
> +        if let Some(fp) = fingerprint {
> +            params["fingerprint"] = fp.into();
> +        }
> +        Ok(self
> +            .0
> +            .post("/api2/extjs/pve/scan", &params)
> +            .await?
> +            .expect_json()?
> +            .data)
> +    }
> +
> +    /// Uses /pve/scan to scan the remote cluster for node/fingerprint information
> +    pub async fn pve_scan_remote(
> +        &self,
> +        hostname: &str,
> +        fingerprint: Option<&str>,
> +        authid: &str,
> +        token: &str,
> +    ) -> Result<ScanResult, Error> {
> +        let mut params = json!({
> +            "hostname": hostname,
> +            "authid": authid,
> +            "token": token,
> +        });
> +        if let Some(fp) = fingerprint {
> +            params["fingerprint"] = fp.into();
> +        }
> +        Ok(self
> +            .0
> +            .post("/api2/extjs/pve/scan", &params)
> +            .await?
> +            .expect_json()?
> +            .data)
> +    }
>  }

Yep, this also confirms my opinion that the /scan endpoint is a bit odd
right now and should better be split up :)

>  
>  /// Builder for migration parameters.





More information about the pdm-devel mailing list