tape: cleanup load-slot api
This commit is contained in:
parent
5605ca5619
commit
93829fc680
|
@ -26,7 +26,7 @@ use crate::{
|
||||||
#[api(
|
#[api(
|
||||||
input: {
|
input: {
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
drive: {
|
||||||
schema: DRIVE_ID_SCHEMA,
|
schema: DRIVE_ID_SCHEMA,
|
||||||
},
|
},
|
||||||
slot: {
|
slot: {
|
||||||
|
@ -38,18 +38,18 @@ use crate::{
|
||||||
)]
|
)]
|
||||||
/// Load media via changer from slot
|
/// Load media via changer from slot
|
||||||
pub fn load_slot(
|
pub fn load_slot(
|
||||||
name: String,
|
drive: String,
|
||||||
slot: u64,
|
slot: u64,
|
||||||
_param: Value,
|
_param: Value,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
|
||||||
let (config, _digest) = config::drive::config()?;
|
let (config, _digest) = config::drive::config()?;
|
||||||
|
|
||||||
let drive: LinuxTapeDrive = config.lookup("linux", &name)?;
|
let drive_config: LinuxTapeDrive = config.lookup("linux", &drive)?;
|
||||||
|
|
||||||
let changer: ScsiTapeChanger = match drive.changer {
|
let changer: ScsiTapeChanger = match drive_config.changer {
|
||||||
Some(ref changer) => config.lookup("changer", changer)?,
|
Some(ref changer) => config.lookup("changer", changer)?,
|
||||||
None => bail!("drive '{}' has no associated changer", name),
|
None => bail!("drive '{}' has no associated changer", drive),
|
||||||
};
|
};
|
||||||
|
|
||||||
let drivenum = 0;
|
let drivenum = 0;
|
||||||
|
|
|
@ -280,7 +280,7 @@ fn update_linux_drive(
|
||||||
#[api(
|
#[api(
|
||||||
input: {
|
input: {
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
drive: {
|
||||||
schema: DRIVE_ID_SCHEMA,
|
schema: DRIVE_ID_SCHEMA,
|
||||||
},
|
},
|
||||||
slot: {
|
slot: {
|
||||||
|
|
Loading…
Reference in New Issue