From ce955e1635961c4243d32957647cc2400cbfeb33 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 14 Dec 2020 09:56:59 +0100 Subject: [PATCH] tape: implement eod cli command (debug tool) --- src/bin/proxmox-tape.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs index 0a47dd76..3e41b2a2 100644 --- a/src/bin/proxmox-tape.rs +++ b/src/bin/proxmox-tape.rs @@ -25,6 +25,7 @@ use proxmox_backup::{ MEDIA_POOL_NAME_SCHEMA, }, }, + tape::open_drive, config::{ self, drive::complete_drive_name, @@ -411,6 +412,29 @@ async fn barcode_label_media( Ok(()) } +#[api( + input: { + properties: { + drive: { + schema: DRIVE_NAME_SCHEMA, + optional: true, + }, + }, + }, +)] +/// Move to end of media (MTEOM, used to debug) +fn move_to_eom(param: Value) -> Result<(), Error> { + + let (config, _digest) = config::drive::config()?; + + let drive = lookup_drive_name(¶m, &config)?; + let mut drive = open_drive(&config, &drive)?; + + drive.move_to_eom()?; + + Ok(()) +} + fn main() { let cmd_def = CliCommandMap::new() @@ -425,6 +449,11 @@ fn main() { CliCommand::new(&API_METHOD_REWIND) .completion_cb("drive", complete_drive_name) ) + .insert( + "eod", + CliCommand::new(&API_METHOD_MOVE_TO_EOM) + .completion_cb("drive", complete_drive_name) + ) .insert( "erase", CliCommand::new(&API_METHOD_ERASE_MEDIA)