tape: do not remove changer while still used
This commit is contained in:
parent
8a16c571d2
commit
43cfb3c35a
|
@ -11,6 +11,7 @@ use crate::{
|
|||
LINUX_DRIVE_PATH_SCHEMA,
|
||||
DriveListEntry,
|
||||
ScsiTapeChanger,
|
||||
LinuxTapeDrive,
|
||||
},
|
||||
tape::{
|
||||
linux_tape_changer_list,
|
||||
|
@ -216,6 +217,15 @@ pub fn delete_changer(name: String, _param: Value) -> Result<(), Error> {
|
|||
None => bail!("Delete changer '{}' failed - no such entry", name),
|
||||
}
|
||||
|
||||
let drive_list: Vec<LinuxTapeDrive> = config.convert_to_typed_array("linux")?;
|
||||
for drive in drive_list {
|
||||
if let Some(changer) = drive.changer {
|
||||
if changer == name {
|
||||
bail!("Delete changer '{}' failed - used by drive '{}'", name, drive.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config::drive::save_config(&config)?;
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in New Issue