tape: sg-tape-cmd - add more ways to specify devices

This commit is contained in:
Dietmar Maurer
2021-01-14 13:05:26 +01:00
parent 781da7f6f0
commit 2d50a6192f
2 changed files with 91 additions and 15 deletions

View File

@ -331,6 +331,7 @@ impl LinuxTapeHandle {
let mut command = std::process::Command::new(
"/usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd");
command.args(&["cartridge-memory"]);
command.args(&["--stdin"]);
command.stdin(unsafe { std::process::Stdio::from_raw_fd(self.file.as_raw_fd())});
let output = run_command(command, None)?;
let result: Result<Vec<MamAttribute>, String> = serde_json::from_str(&output)?;
@ -350,6 +351,7 @@ impl LinuxTapeHandle {
let mut command = std::process::Command::new(
"/usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd");
command.args(&["volume-statistics"]);
command.args(&["--stdin"]);
command.stdin(unsafe { std::process::Stdio::from_raw_fd(self.file.as_raw_fd())});
let output = run_command(command, None)?;
let result: Result<Lp17VolumeStatistics, String> = serde_json::from_str(&output)?;
@ -492,6 +494,7 @@ impl TapeDriver for LinuxTapeHandle {
let mut command = std::process::Command::new(
"/usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd");
command.args(&["tape-alert-flags"]);
command.args(&["--stdin"]);
command.stdin(unsafe { std::process::Stdio::from_raw_fd(self.file.as_raw_fd())});
let output = run_command(command, None)?;
let result: Result<u64, String> = serde_json::from_str(&output)?;