cleanup: move scan changers API implementation
This commit is contained in:
parent
16b4d78400
commit
887f1cb90c
|
@ -1,3 +1,5 @@
|
|||
//! The Proxmox Backup Server API
|
||||
|
||||
pub mod access;
|
||||
pub mod admin;
|
||||
pub mod backup;
|
||||
|
@ -18,7 +20,7 @@ use proxmox::list_subdirs_api_method;
|
|||
|
||||
const NODES_ROUTER: Router = Router::new().match_all("node", &node::ROUTER);
|
||||
|
||||
pub const SUBDIRS: SubdirMap = &[
|
||||
const SUBDIRS: SubdirMap = &[
|
||||
("access", &access::ROUTER),
|
||||
("admin", &admin::ROUTER),
|
||||
("backup", &backup::ROUTER),
|
||||
|
|
|
@ -12,7 +12,6 @@ use crate::{
|
|||
CHANGER_NAME_SCHEMA,
|
||||
DriveListEntry,
|
||||
ScsiTapeChanger,
|
||||
TapeDeviceInfo,
|
||||
MtxStatusEntry,
|
||||
MtxEntryKind,
|
||||
},
|
||||
|
@ -137,26 +136,6 @@ pub async fn transfer(
|
|||
}).await?
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {},
|
||||
},
|
||||
returns: {
|
||||
description: "The list of autodetected tape changers.",
|
||||
type: Array,
|
||||
items: {
|
||||
type: TapeDeviceInfo,
|
||||
},
|
||||
},
|
||||
)]
|
||||
/// Scan for SCSI tape changers
|
||||
pub fn scan_changers(_param: Value) -> Result<Vec<TapeDeviceInfo>, Error> {
|
||||
|
||||
let list = linux_tape_changer_list();
|
||||
|
||||
Ok(list)
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {},
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
//! Tape Backup Management
|
||||
|
||||
use proxmox::api::router::SubdirMap;
|
||||
use proxmox::api::Router;
|
||||
use proxmox::list_subdirs_api_method;
|
||||
use anyhow::Error;
|
||||
use serde_json::Value;
|
||||
|
||||
use proxmox::{
|
||||
api::{
|
||||
api,
|
||||
router::SubdirMap,
|
||||
Router,
|
||||
},
|
||||
list_subdirs_api_method,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
api2::types::TapeDeviceInfo,
|
||||
tape::linux_tape_changer_list,
|
||||
};
|
||||
|
||||
pub mod drive;
|
||||
pub mod changer;
|
||||
|
@ -10,7 +23,27 @@ pub mod media;
|
|||
pub mod backup;
|
||||
pub mod restore;
|
||||
|
||||
pub const SUBDIRS: SubdirMap = &[
|
||||
#[api(
|
||||
input: {
|
||||
properties: {},
|
||||
},
|
||||
returns: {
|
||||
description: "The list of autodetected tape changers.",
|
||||
type: Array,
|
||||
items: {
|
||||
type: TapeDeviceInfo,
|
||||
},
|
||||
},
|
||||
)]
|
||||
/// Scan for SCSI tape changers
|
||||
pub fn scan_changers(_param: Value) -> Result<Vec<TapeDeviceInfo>, Error> {
|
||||
|
||||
let list = linux_tape_changer_list();
|
||||
|
||||
Ok(list)
|
||||
}
|
||||
|
||||
const SUBDIRS: SubdirMap = &[
|
||||
("backup", &backup::ROUTER),
|
||||
("changer", &changer::ROUTER),
|
||||
("drive", &drive::ROUTER),
|
||||
|
@ -19,7 +52,7 @@ pub const SUBDIRS: SubdirMap = &[
|
|||
(
|
||||
"scan-changers",
|
||||
&Router::new()
|
||||
.get(&changer::API_METHOD_SCAN_CHANGERS),
|
||||
.get(&API_METHOD_SCAN_CHANGERS),
|
||||
),
|
||||
];
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ fn scan_for_changers(
|
|||
) -> Result<(), Error> {
|
||||
|
||||
let output_format = get_output_format(¶m);
|
||||
let info = &api2::tape::changer::API_METHOD_SCAN_CHANGERS;
|
||||
let info = &api2::tape::API_METHOD_SCAN_CHANGERS;
|
||||
let mut data = match info.handler {
|
||||
ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
|
||||
_ => unreachable!(),
|
||||
|
|
Loading…
Reference in New Issue