From 9586ce2f4692f3a1dc2501acc2ddfb2b0d548c5a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 30 Jan 2021 08:03:17 +0100 Subject: [PATCH] tape: move scan_drives API code to correct file --- src/api2/tape/drive.rs | 21 --------------------- src/api2/tape/mod.rs | 27 +++++++++++++++++++++++++-- src/bin/proxmox_tape/drive.rs | 2 +- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs index 23991367..9811762d 100644 --- a/src/api2/tape/drive.rs +++ b/src/api2/tape/drive.rs @@ -34,7 +34,6 @@ use crate::{ Authid, DriveListEntry, LinuxTapeDrive, - TapeDeviceInfo, MediaIdFlat, LabelUuidMap, MamAttribute, @@ -179,26 +178,6 @@ pub async fn unload( }).await? } -#[api( - input: { - properties: {}, - }, - returns: { - description: "The list of autodetected tape drives.", - type: Array, - items: { - type: TapeDeviceInfo, - }, - }, -)] -/// Scan tape drives -pub fn scan_drives(_param: Value) -> Result, Error> { - - let list = linux_tape_device_list(); - - Ok(list) -} - #[api( input: { properties: { diff --git a/src/api2/tape/mod.rs b/src/api2/tape/mod.rs index 466f3b8b..b560f077 100644 --- a/src/api2/tape/mod.rs +++ b/src/api2/tape/mod.rs @@ -14,7 +14,10 @@ use proxmox::{ use crate::{ api2::types::TapeDeviceInfo, - tape::linux_tape_changer_list, + tape::{ + linux_tape_device_list, + linux_tape_changer_list, + }, }; pub mod drive; @@ -23,6 +26,26 @@ pub mod media; pub mod backup; pub mod restore; +#[api( + input: { + properties: {}, + }, + returns: { + description: "The list of autodetected tape drives.", + type: Array, + items: { + type: TapeDeviceInfo, + }, + }, +)] +/// Scan tape drives +pub fn scan_drives(_param: Value) -> Result, Error> { + + let list = linux_tape_device_list(); + + Ok(list) +} + #[api( input: { properties: {}, @@ -57,7 +80,7 @@ const SUBDIRS: SubdirMap = &[ ( "scan-drives", &Router::new() - .get(&drive::API_METHOD_SCAN_DRIVES), + .get(&API_METHOD_SCAN_DRIVES), ), ]; diff --git a/src/bin/proxmox_tape/drive.rs b/src/bin/proxmox_tape/drive.rs index da63f3a7..84bdb524 100644 --- a/src/bin/proxmox_tape/drive.rs +++ b/src/bin/proxmox_tape/drive.rs @@ -116,7 +116,7 @@ fn scan_for_drives( ) -> Result<(), Error> { let output_format = get_output_format(¶m); - let info = &api2::tape::drive::API_METHOD_SCAN_DRIVES; + let info = &api2::tape::API_METHOD_SCAN_DRIVES; let mut data = match info.handler { ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?, _ => unreachable!(),