Revise tape thread complete success/failure logic
Tape read and tape write threads follow the same workflow until ~TapeCleaning()
is executed and they do the final thread completions. We cannot make the identical, because read and write are different and require different clean up/completion steps. But at least we can make them look similar to simplify the code comprehension.
This is a refactoring task.
Also: we have to make sure we mark the tape session as failed when there is any failure in ~TapeCleaning()
. At the moment no exceptions from the destructor can reach the run()
method - it is blind to any error happened in ~TapeCleaning()
and unconditionally goes with:
// The session completed successfully, and the cleaner (unmount) executed
// at the end of the previous block. Log the results.
cta::log::ScopedParamContainer params(m_logContext);
params.add("status", "success");
m_stats.totalTime = totalTimer.secs();
m_reportPacker.setTapeDone();
m_reportPacker.setTapeComplete();
Edited by Volodymyr Yurchenko