tape: add optional timeout to wait_until_ready
instead of hardcodign the default timeout as only option. This will come in handy when we need to wait for LTO9+ initialization that can take up to two hours. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
cbb478fa19
commit
ee6c5560a8
@ -571,9 +571,10 @@ impl SgTape {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wait_until_ready(&mut self) -> Result<(), Error> {
|
||||
pub fn wait_until_ready(&mut self, timeout: Option<u64>) -> Result<(), Error> {
|
||||
let start = SystemTime::now();
|
||||
let max_wait = std::time::Duration::new(Self::SCSI_TAPE_DEFAULT_TIMEOUT as u64, 0);
|
||||
let timeout = timeout.unwrap_or(Self::SCSI_TAPE_DEFAULT_TIMEOUT as u64);
|
||||
let max_wait = std::time::Duration::new(timeout, 0);
|
||||
|
||||
loop {
|
||||
match self.test_unit_ready() {
|
||||
|
@ -55,7 +55,7 @@ pub fn open_lto_tape_drive(config: &LtoTapeDrive) -> Result<LtoTapeHandle, Error
|
||||
}
|
||||
}
|
||||
|
||||
handle.sg_tape.wait_until_ready()?;
|
||||
handle.sg_tape.wait_until_ready(None)?;
|
||||
|
||||
handle.set_default_options()?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user