From d8792b88efcf904a974e1b2fc3adc2ffe40f433d Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 27 Jan 2021 11:33:47 +0100 Subject: [PATCH] api2/types/tape/drive: add changer_drivenum so that an api user can see which drive belongs to which drivenum of a changer for ones with multiple drives Signed-off-by: Dominik Csapak --- src/api2/config/changer.rs | 1 + src/api2/config/drive.rs | 1 + src/api2/tape/changer.rs | 1 + src/api2/types/tape/drive.rs | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/src/api2/config/changer.rs b/src/api2/config/changer.rs index df8e042d..1b429659 100644 --- a/src/api2/config/changer.rs +++ b/src/api2/config/changer.rs @@ -134,6 +134,7 @@ pub fn list_changers( name: changer.name, path: changer.path.clone(), changer: None, + changer_drivenum: None, vendor: None, model: None, serial: None, diff --git a/src/api2/config/drive.rs b/src/api2/config/drive.rs index 7a05238b..32d74c19 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_drivenum: drive.changer_drive_id, vendor: None, model: None, serial: None, diff --git a/src/api2/tape/changer.rs b/src/api2/tape/changer.rs index 8239e041..87737d32 100644 --- a/src/api2/tape/changer.rs +++ b/src/api2/tape/changer.rs @@ -166,6 +166,7 @@ pub fn list_changers( name: changer.name, path: changer.path.clone(), changer: None, + changer_drivenum: None, vendor: None, model: None, serial: None, diff --git a/src/api2/types/tape/drive.rs b/src/api2/types/tape/drive.rs index 6e5e3b15..537cf55d 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, + /// Drive number in associated changer device + #[serde(skip_serializing_if="Option::is_none")] + pub changer_drivenum: Option, /// Vendor (autodetected) #[serde(skip_serializing_if="Option::is_none")] pub vendor: Option,