Commit 70689f36 authored by David COME's avatar David COME
Browse files

We now check if the tape if writeable juste after mounting the tape for migration

parent 04645425
......@@ -98,7 +98,20 @@ tapeFlush(const std::string& message,uint64_t bytes,uint64_t files,
m_reportPacker.reportFlush();
m_stats.flushTime += flushTime;
}
//------------------------------------------------------------------------------
// isTapeWritable
//-----------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeWriteSingleThread::
isTapeWritable() const {
// check that drive is not write protected
if(m_drive.isWriteProtected()) {
castor::exception::Exception ex;
ex.getMessage() <<
"End session with error. Drive is write protected. Aborting labelling...";
throw ex;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//run
//------------------------------------------------------------------------------
......@@ -126,6 +139,8 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
mountTape(castor::legacymsg::RmcProxy::MOUNT_MODE_READWRITE);
waitForDrive();
isTapeWritable();
m_stats.mountTime += timer.secs(utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
......
......@@ -119,7 +119,11 @@ private:
m_this.m_initialProcess.finish();
}
};
/**
* Will throw an exception if we cant write on the tape
*/
void isTapeWritable() const;
/**
* Log m_stats parameters into m_logContext with msg at the given level
*/
......
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