[pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot

Dominik Csapak d.csapak at proxmox.com
Mon Jan 25 16:30:56 CET 2021


so that an api user can see which drive belongs to which slot of a changer

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/api2/config/changer.rs   | 1 +
 src/api2/config/drive.rs     | 1 +
 src/api2/types/tape/drive.rs | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/src/api2/config/changer.rs b/src/api2/config/changer.rs
index c1e8c59e..3a838504 100644
--- a/src/api2/config/changer.rs
+++ b/src/api2/config/changer.rs
@@ -137,6 +137,7 @@ pub fn list_changers(
             name: changer.name,
             path: changer.path.clone(),
             changer: None,
+            changer_slot: None,
             vendor: None,
             model: None,
             serial: None,
diff --git a/src/api2/config/drive.rs b/src/api2/config/drive.rs
index 7a05238b..76092c49 100644
--- a/src/api2/config/drive.rs
+++ b/src/api2/config/drive.rs
@@ -127,6 +127,7 @@ pub fn list_drives(
             name: drive.name,
             path: drive.path.clone(),
             changer: drive.changer,
+            changer_slot: drive.changer_drive_id,
             vendor: None,
             model: None,
             serial: None,
diff --git a/src/api2/types/tape/drive.rs b/src/api2/types/tape/drive.rs
index 6e5e3b15..cc2d5d63 100644
--- a/src/api2/types/tape/drive.rs
+++ b/src/api2/types/tape/drive.rs
@@ -82,6 +82,7 @@ pub struct LinuxTapeDrive {
 
 #[api()]
 #[derive(Serialize,Deserialize)]
+#[serde(rename_all = "kebab-case")]
 /// Drive list entry
 pub struct DriveListEntry {
     /// Drive name
@@ -91,6 +92,9 @@ pub struct DriveListEntry {
     /// Associated changer device
     #[serde(skip_serializing_if="Option::is_none")]
     pub changer: Option<String>,
+    /// Slot in associated changer device
+    #[serde(skip_serializing_if="Option::is_none")]
+    pub changer_slot: Option<u64>,
     /// Vendor (autodetected)
     #[serde(skip_serializing_if="Option::is_none")]
     pub vendor: Option<String>,
-- 
2.20.1






More information about the pbs-devel mailing list