mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-15 02:14:10 +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,
|
||||
key_fingerprint: Option<(Fingerprint, Uuid)>,
|
||||
) -> Result<(), Error> {
|
||||
let output = if let Some((fingerprint, uuid)) = key_fingerprint {
|
||||
if let Some((fingerprint, uuid)) = key_fingerprint {
|
||||
let fingerprint = fingerprint.signature();
|
||||
run_sg_tape_cmd(
|
||||
let output = run_sg_tape_cmd(
|
||||
"encryption",
|
||||
&["--fingerprint", &fingerprint, "--uuid", &uuid.to_string()],
|
||||
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)?;
|
||||
result.map_err(|err| format_err!("{}", err))
|
||||
} else {
|
||||
self.sg_tape.set_encryption(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user