Commit 6690990a authored by Victor Kotlyar's avatar Victor Kotlyar
Browse files

Ported commits 006b997699682938ec8a6af9a41498c8194cf451

d1689f3b72329bcc6c342666095567f547f1678f from castor/master

CASTOR-4909: tapeserverd tries to unmount the tape when the mount
failed...

Made the ignoring of exception throw by DriveGeneric::waitUntilReady
more specific: we now ignore timeouts, but not the other exceptions.
parent ebfaf0f9
......@@ -67,10 +67,15 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeCleaning::~TapeClean
// First check that a tape is actually present in the drive. We can get here
// after failing to mount (library error) in which case there is nothing to
// do (and trying to unmount will only lead to a failure.)
// We give time to the drive for settling after a mount which might have
// just happened. If we time out, then we will simply find no tape in the
// drive, which is a fine situation (so timeout exceptions are discarded).
// Other exception, where we failed to access the drive somehow are at passed
// through.
const uint32_t waitMediaInDriveTimeout = 60;
try {
m_this.m_drive.waitUntilReady(waitMediaInDriveTimeout);
} catch (cta::exception::Exception &) {}
} catch (cta::exception::TimeOut &) {}
if (!m_this.m_drive.hasTapeInPlace()) {
m_this.m_logContext.log(cta::log::INFO, "TapeReadSingleThread: No tape to unload");
goto done;
......
......@@ -120,7 +120,7 @@ private:
const uint32_t waitMediaInDriveTimeout = 60;
try {
m_this.m_drive.waitUntilReady(waitMediaInDriveTimeout);
} catch (cta::exception::Exception &) {}
} catch (cta::exception::TimeOut &) {}
if (!m_this.m_drive.hasTapeInPlace()) {
m_this.m_logContext.log(cta::log::INFO, "TapeReadSingleThread: No tape to unload");
goto done;
......
......@@ -1178,7 +1178,7 @@ void drive::DriveGeneric::waitUntilReady(const uint32_t timeoutSecond) {
std::string("Could not read drive status: ") + m_SCSIInfo.nst_dev);
if(GMT_ONLINE(mtInfo.mt_gstat)==0) {
cta::exception::Exception ex;
cta::exception::TimeOut ex;
ex.getMessage() << "Tape drive empty after waiting " <<
timeoutSecond << " seconds.";
throw ex;
......
......@@ -154,6 +154,8 @@ namespace drive {
* at least timeoutSeconds or any errors occurred. We consider any not GOOD
* SCSI replay with sense keys not equals to NotReady or UnitAttention as
* errors.
* This method will pass through any exception encountered, and will throw
* a TimeOut exception if not tape is found after timeout.
*
* This method will at least query the tape drive once.
*
......
......@@ -31,6 +31,7 @@
#include "tapeserver/castor/tape/tapeserver/SCSI/Structures.hpp"
#include "tapeserver/castor/tape/tapeserver/system/Wrapper.hpp"
#include "common/exception/Exception.hpp"
#include "common/exception/TimeOut.hpp"
/**
* Class wrapping the tape server. Has to be templated (and hence fully in .hh)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment