* [PATCH datacenter-manager 1/3] clippy: cli: acme: redundant field names in struct initialization
2026-05-20 13:13 [PATCH datacenter-manager 0/3] various clippy fixes Lukas Wagner
@ 2026-05-20 13:13 ` Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 2/3] clippy: pdm-client: use parameter type for pve_list_storages Lukas Wagner
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Lukas Wagner @ 2026-05-20 13:13 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
cli/admin/src/acme.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cli/admin/src/acme.rs b/cli/admin/src/acme.rs
index 6bda844d..2e1037f3 100644
--- a/cli/admin/src/acme.rs
+++ b/cli/admin/src/acme.rs
@@ -181,11 +181,11 @@ async fn register_account(
let (eab_kid, eab_hmac_key) = eab_creds.unzip();
let parameters = AcmeRegistrationParams {
name: Some(name),
- contact: contact,
- tos_url: tos_url,
+ contact,
+ tos_url,
directory: Some(directory_url),
- eab_kid: eab_kid,
- eab_hmac_key: eab_hmac_key,
+ eab_kid,
+ eab_hmac_key,
};
let param = serde_json::to_value(parameters)?;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH datacenter-manager 2/3] clippy: pdm-client: use parameter type for pve_list_storages
2026-05-20 13:13 [PATCH datacenter-manager 0/3] various clippy fixes Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 1/3] clippy: cli: acme: redundant field names in struct initialization Lukas Wagner
@ 2026-05-20 13:13 ` Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 3/3] clippy: sdn-client: fix 'large size difference between variants' for error type Lukas Wagner
2026-05-21 13:00 ` partially-applied: [PATCH datacenter-manager 0/3] various clippy fixes Wolfgang Bumiller
3 siblings, 0 replies; 6+ messages in thread
From: Lukas Wagner @ 2026-05-20 13:13 UTC (permalink / raw)
To: pdm-devel
This API had a quite excessive number of parameters, some of which also
had the same type. A parameter type for the filter options reduces the
potential for errors. The `formats` parameters was kept as a distinct
function parameter and renamed to `include_formats`, to better convey
the meaning.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
lib/pdm-client/src/lib.rs | 43 +++++++++++++++++++--------
ui/src/widget/pve_storage_selector.rs | 19 ++++++++----
2 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 76b33ef8..c97c9db9 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -97,6 +97,20 @@ impl<T: HttpApiClient> std::ops::DerefMut for PdmClient<T> {
}
}
+/// Filter for [`PdmClient::pve_list_storages`].
+#[derive(Clone, Debug, Default, Eq, PartialEq)]
+pub struct PveListStoragesFilter {
+ /// Only list stores which support this content type.
+ pub content: Vec<StorageContent>,
+ /// Only list stores which are enabled (not disabled in config).
+ pub enabled: Option<bool>,
+ /// Only list status for specified storage
+ pub storage: Option<String>,
+ // If target is different to 'node', we only list shared storages which are accessible on
+ // this 'node' and the specified 'target' node.
+ pub target: Option<String>,
+}
+
impl<T: HttpApiClient> PdmClient<T> {
pub async fn list_remotes(&self) -> Result<Vec<Remote>, Error> {
Ok(self
@@ -1103,28 +1117,31 @@ impl<T: HttpApiClient> PdmClient<T> {
Ok(self.0.get(&path).await?.expect_json()?.data)
}
+ /// List storages for a given PVE remote node.
+ ///
+ /// The storages can be filtered using the `filter` parameter, for details see
+ /// [`PveListStoragesFilter`]. If `include_supported_disk_image_formats` is set
+ /// to true, the result will include information about supported disk image types
+ /// for each storage.
pub async fn pve_list_storages(
&self,
remote: &str,
node: &str,
- content: Option<Vec<StorageContent>>,
- enabled: Option<bool>,
- format: Option<bool>,
- storage: Option<String>,
- target: Option<String>,
+ filter: PveListStoragesFilter,
+ include_supported_disk_image_formats: bool,
) -> Result<Vec<StorageInfo>, Error> {
let mut builder = ApiPathBuilder::new(format!(
"/api2/extjs/pve/remotes/{remote}/nodes/{node}/storage"
))
- .maybe_arg("enabled", &enabled)
- .maybe_arg("format", &format)
- .maybe_arg("storage", &storage)
- .maybe_arg("target", &target);
- if let Some(content) = content {
- for ty in content {
- builder = builder.arg("content", ty);
- }
+ .arg("format", include_supported_disk_image_formats)
+ .maybe_arg("enabled", &filter.enabled)
+ .maybe_arg("storage", &filter.storage)
+ .maybe_arg("target", &filter.target);
+
+ for ty in filter.content {
+ builder = builder.arg("content", ty);
}
+
let path = builder.build();
Ok(self.0.get(&path).await?.expect_json()?.data)
diff --git a/ui/src/widget/pve_storage_selector.rs b/ui/src/widget/pve_storage_selector.rs
index 488175ab..f43234dc 100644
--- a/ui/src/widget/pve_storage_selector.rs
+++ b/ui/src/widget/pve_storage_selector.rs
@@ -22,7 +22,10 @@ use pwt::{
};
use pwt_macros::{builder, widget};
-use pdm_client::types::{StorageContent, StorageInfo};
+use pdm_client::{
+ types::{StorageContent, StorageInfo},
+ PveListStoragesFilter,
+};
#[widget(comp=PveStorageSelectorComp, @input)]
#[derive(Clone, Properties, PartialEq)]
@@ -85,15 +88,19 @@ impl PveStorageSelectorComp {
content: Option<Vec<StorageContent>>,
target: Option<AttrValue>,
) -> Result<Vec<StorageInfo>, Error> {
+ let filter = PveListStoragesFilter {
+ content: content.unwrap_or_default(),
+ enabled: Some(true),
+ target: target.as_ref().map(AttrValue::to_string),
+ ..Default::default()
+ };
+
let mut storages = crate::pdm_client()
.pve_list_storages(
&remote,
&node.unwrap_or(AttrValue::from("localhost")),
- content,
- Some(true),
- Some(true),
- None,
- target.as_ref().map(AttrValue::to_string),
+ filter,
+ true,
)
.await?;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH datacenter-manager 3/3] clippy: sdn-client: fix 'large size difference between variants' for error type
2026-05-20 13:13 [PATCH datacenter-manager 0/3] various clippy fixes Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 1/3] clippy: cli: acme: redundant field names in struct initialization Lukas Wagner
2026-05-20 13:13 ` [PATCH datacenter-manager 2/3] clippy: pdm-client: use parameter type for pve_list_storages Lukas Wagner
@ 2026-05-20 13:13 ` Lukas Wagner
2026-05-21 12:57 ` Wolfgang Bumiller
2026-05-21 13:00 ` partially-applied: [PATCH datacenter-manager 0/3] various clippy fixes Wolfgang Bumiller
3 siblings, 1 reply; 6+ messages in thread
From: Lukas Wagner @ 2026-05-20 13:13 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
Notes:
Not sure if we should just add an ignore instead
server/src/sdn_client.rs | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/server/src/sdn_client.rs b/server/src/sdn_client.rs
index 95e4d69b..f56519a6 100644
--- a/server/src/sdn_client.rs
+++ b/server/src/sdn_client.rs
@@ -2,7 +2,7 @@ use std::error::Error as StdError;
use std::sync::Arc;
use std::time::Duration;
-use anyhow::{self, bail, Context};
+use anyhow::{self, bail, format_err, Context};
use futures::{future::join_all, stream::FuturesUnordered, StreamExt, TryFutureExt};
use pdm_api_types::{remotes::Remote, RemoteUpid};
@@ -25,7 +25,7 @@ pub struct LockedSdnClient {
#[derive(Debug)]
pub enum LockedSdnClientError {
- Client(proxmox_client::Error),
+ Client(Box<proxmox_client::Error>),
Other(anyhow::Error),
}
@@ -49,7 +49,7 @@ impl std::fmt::Display for LockedSdnClientError {
impl From<proxmox_client::Error> for LockedSdnClientError {
fn from(value: proxmox_client::Error) -> Self {
- Self::Client(value)
+ Self::Client(Box::new(value))
}
}
@@ -219,15 +219,20 @@ impl<C> LockedSdnClients<C> {
}
}
- return match &error {
- LockedSdnClientError::Client(proxmox_client::Error::Api(status, _msg))
- if *status == 501 =>
- {
- bail!("remote {} does not support the sdn locking api, please upgrade to PVE 9 or newer!", remote.id)
+ return match error {
+ LockedSdnClientError::Client(error) => match *error {
+ proxmox_client::Error::Api(status_code, _msg) if status_code == 501 => {
+ Err(format_err!("remote {} does not support the sdn locking api, please upgrade to PVE 9 or newer!", remote.id))
+ }
+ _ => Err(error).with_context(|| format!(
+ "could not lock sdn configuration for remote {}",
+ remote.id
+ )),
}
- _ => Err(error).with_context(|| {
- format!("could not lock sdn configuration for remote {}", remote.id)
- }),
+ _ => Err(error).with_context(|| format!(
+ "could not lock sdn configuration for remote {}",
+ remote.id
+ )),
};
}
};
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread