mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-15 14:35:06 +00:00
tape: don't call sg-tape-cmd for unloading encryption keys
since sg-tape-cmd is only necessary if we want to load the key, we don't have to call it when we don't have one. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
f1467d23f3
commit
8ee5a5d302
@ -271,18 +271,18 @@ impl TapeDriver for LtoTapeHandle {
|
|||||||
&mut self,
|
&mut self,
|
||||||
key_fingerprint: Option<(Fingerprint, Uuid)>,
|
key_fingerprint: Option<(Fingerprint, Uuid)>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let output = if let Some((fingerprint, uuid)) = key_fingerprint {
|
if let Some((fingerprint, uuid)) = key_fingerprint {
|
||||||
let fingerprint = fingerprint.signature();
|
let fingerprint = fingerprint.signature();
|
||||||
run_sg_tape_cmd(
|
let output = run_sg_tape_cmd(
|
||||||
"encryption",
|
"encryption",
|
||||||
&["--fingerprint", &fingerprint, "--uuid", &uuid.to_string()],
|
&["--fingerprint", &fingerprint, "--uuid", &uuid.to_string()],
|
||||||
self.sg_tape.file_mut().as_raw_fd(),
|
self.sg_tape.file_mut().as_raw_fd(),
|
||||||
)?
|
)?;
|
||||||
} else {
|
|
||||||
run_sg_tape_cmd("encryption", &[], self.sg_tape.file_mut().as_raw_fd())?
|
|
||||||
};
|
|
||||||
let result: Result<(), String> = serde_json::from_str(&output)?;
|
let result: Result<(), String> = serde_json::from_str(&output)?;
|
||||||
result.map_err(|err| format_err!("{}", err))
|
result.map_err(|err| format_err!("{}", err))
|
||||||
|
} else {
|
||||||
|
self.sg_tape.set_encryption(None)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user