public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH proxmox 09/26] disks: gate api macro behind 'api-types' feature
Date: Thu, 12 Mar 2026 14:52:10 +0100	[thread overview]
Message-ID: <20260312135229.420729-10-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260312135229.420729-1-l.wagner@proxmox.com>

Some users of this crate don't need the derived API types, so it is best
to gate it behind a feature.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 proxmox-disks/Cargo.toml   |  6 +++++-
 proxmox-disks/src/lib.rs   | 18 ++++++++++--------
 proxmox-disks/src/smart.rs |  9 +++++----
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/proxmox-disks/Cargo.toml b/proxmox-disks/Cargo.toml
index 29bf56fe..f581e464 100644
--- a/proxmox-disks/Cargo.toml
+++ b/proxmox-disks/Cargo.toml
@@ -26,5 +26,9 @@ proxmox-io.workspace = true
 proxmox-lang.workspace = true
 proxmox-log.workspace = true
 proxmox-parallel-handler.workspace = true
-proxmox-schema = { workspace = true, features = [ "api-macro", "api-types" ] }
+proxmox-schema = { workspace = true, features = [ "api-types" ], optional = true }
 proxmox-sys.workspace = true
+
+[features]
+default = [ "dep:proxmox-schema" ]
+api-types = [ "proxmox-schema/api-macro" ]
diff --git a/proxmox-disks/src/lib.rs b/proxmox-disks/src/lib.rs
index 4039b4cd..74907711 100644
--- a/proxmox-disks/src/lib.rs
+++ b/proxmox-disks/src/lib.rs
@@ -17,13 +17,15 @@ use ::serde::{Deserialize, Serialize};
 use proxmox_lang::{io_bail, io_format_err};
 use proxmox_log::info;
 use proxmox_parallel_handler::ParallelHandler;
-use proxmox_schema::api;
 use proxmox_sys::linux::procfs::{mountinfo::Device, MountInfo};
 
 use proxmox_schema::api_types::{
     BLOCKDEVICE_DISK_AND_PARTITION_NAME_REGEX, BLOCKDEVICE_NAME_REGEX, UUID_REGEX,
 };
 
+#[cfg(feature = "api-types")]
+use proxmox_schema::api;
+
 mod zfs;
 pub use zfs::*;
 mod zpool_status;
@@ -626,7 +628,7 @@ impl Disk {
     }
 }
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "lowercase")]
 /// This is just a rough estimate for a "type" of disk.
@@ -682,7 +684,7 @@ fn get_file_system_devices(lsblk_info: &[LsblkInfo]) -> Result<HashSet<u64>, Err
     Ok(device_set)
 }
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
 #[serde(rename_all = "lowercase")]
 /// What a block device partition is used for.
@@ -703,7 +705,7 @@ pub enum PartitionUsageType {
     FileSystem,
 }
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
 #[serde(rename_all = "lowercase")]
 /// What a block device (disk) is used for.
@@ -724,7 +726,7 @@ pub enum DiskUsageType {
     FileSystem,
 }
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 /// Basic information about a partition
@@ -747,7 +749,7 @@ pub struct PartitionInfo {
     pub uuid: Option<String>,
 }
 
-#[api(
+#[cfg_attr(feature = "api-types", api(
     properties: {
         used: {
             type: DiskUsageType,
@@ -765,7 +767,7 @@ pub struct PartitionInfo {
             }
         }
     }
-)]
+))]
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 /// Information about how a Disk is used
@@ -1302,7 +1304,7 @@ pub fn create_single_linux_partition(disk: &Disk) -> Result<Disk, Error> {
     }
 }
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Copy, Clone, Serialize, Deserialize, Eq, PartialEq)]
 #[serde(rename_all = "lowercase")]
 /// A file system type supported by our tooling.
diff --git a/proxmox-disks/src/smart.rs b/proxmox-disks/src/smart.rs
index 1d41cee2..247bc4d3 100644
--- a/proxmox-disks/src/smart.rs
+++ b/proxmox-disks/src/smart.rs
@@ -7,9 +7,10 @@ use std::{
 use ::serde::{Deserialize, Serialize};
 use anyhow::Error;
 
+#[cfg(feature = "api-types")]
 use proxmox_schema::api;
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Serialize, Deserialize)]
 #[serde(rename_all = "lowercase")]
 /// SMART status
@@ -22,7 +23,7 @@ pub enum SmartStatus {
     Unknown,
 }
 
-#[api()]
+#[cfg_attr(feature = "api-types", api)]
 #[derive(Debug, Serialize, Deserialize)]
 /// SMART Attribute
 pub struct SmartAttribute {
@@ -51,7 +52,7 @@ pub struct SmartAttribute {
     threshold: Option<f64>,
 }
 
-#[api(
+#[cfg_attr(feature = "api-types", api(
     properties: {
         status: {
             type: SmartStatus,
@@ -69,7 +70,7 @@ pub struct SmartAttribute {
             },
         },
     },
-)]
+))]
 #[derive(Debug, Serialize, Deserialize)]
 /// Data from smartctl
 pub struct SmartData {
-- 
2.47.3





  parent reply	other threads:[~2026-03-12 13:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 13:52 [PATCH datacenter-manager/proxmox{,-backup,-yew-comp} 00/26] metric collection for the PDM host Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 01/26] sys: procfs: don't read from sysfs during unit tests Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 02/26] parallel-handler: import code from Proxmox Backup Server Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 03/26] parallel-handler: introduce custom error type Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 04/26] parallel-handler: add documentation Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 05/26] parallel-handler: add simple unit-test suite Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 06/26] disks: import from Proxmox Backup Server Lukas Wagner
2026-03-16 13:13   ` Arthur Bied-Charreton
2026-03-12 13:52 ` [PATCH proxmox 07/26] disks: fix typo in `initialize_gpt_disk` Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 08/26] disks: add parts of gather_disk_stats from PBS Lukas Wagner
2026-03-12 13:52 ` Lukas Wagner [this message]
2026-03-12 13:52 ` [PATCH proxmox 10/26] disks: clippy: collapse if-let chains where possible Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 11/26] procfs: add helpers for querying pressure stall information Lukas Wagner
2026-03-16 13:25   ` Arthur Bied-Charreton
2026-03-12 13:52 ` [PATCH proxmox 12/26] time: use u64 parse helper from nom Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-backup 13/26] tools: move ParallelHandler to new proxmox-parallel-handler crate Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-backup 14/26] tools: replace disks module with proxmox-disks Lukas Wagner
2026-03-16 13:27   ` Arthur Bied-Charreton
2026-03-12 13:52 ` [PATCH proxmox-backup 15/26] metric collection: use blockdev_stat_for_path from proxmox_disks Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-yew-comp 16/26] node status panel: add `children` property Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-yew-comp 17/26] RRDGrid: fix size observer by attaching node reference to rendered container Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-yew-comp 18/26] RRDGrid: add padding and increase gap between elements Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 19/26] metric collection: clarify naming for remote metric collection Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 20/26] metric collection: fix minor typo in error message Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 21/26] metric collection: collect PDM host metrics in a new collection task Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 22/26] api: fix /nodes/localhost/rrddata endpoint Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 23/26] pdm: node rrd data: rename 'total-time' to 'metric-collection-total-time' Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 24/26] pdm-api-types: add PDM host metric fields Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 25/26] ui: node status: add RRD graphs for PDM host metrics Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 26/26] ui: lxc/qemu/node: use RRD value render helpers Lukas Wagner
2026-03-16 13:42 ` [PATCH datacenter-manager/proxmox{,-backup,-yew-comp} 00/26] metric collection for the PDM host Arthur Bied-Charreton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260312135229.420729-10-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal