Commit 1f1f3abe authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[cta-taped] Added a specific error message when the drive device file is not...

[cta-taped] Added a specific error message when the drive device file is not found when a drive is set UP
parent 7963944c
......@@ -148,6 +148,9 @@ schedule:
driveState.up = false;
driveState.forceDown = false;
std::string errorMsg = "A tape was detected in the drive. Putting the drive down.";
cta::optional<std::string> probeErrorMsg = emptyDriveProbe.getProbeErrorMsg();
if(probeErrorMsg)
errorMsg = probeErrorMsg.value();
int logLevel = cta::log::ERR;
driveState.setReasonFromLogMsg(logLevel,errorMsg);
m_scheduler.setDesiredDriveState(securityIdentity, m_driveConfig.unitName, driveState, lc);
......
......@@ -51,6 +51,7 @@ bool castor::tape::tapeserver::daemon::EmptyDriveProbe::driveIsEmpty() throw() {
errorMessage = "Caught an unknown exception";
}
m_probeErrorMsg = std::string("EmptyDriveProbe: ") + errorMessage;
// Reaching this point means the probe failed and an exception was thrown
std::list<cta::log::Param> params = {
cta::log::Param("tapeDrive", m_driveConfig.unitName),
......@@ -59,6 +60,13 @@ bool castor::tape::tapeserver::daemon::EmptyDriveProbe::driveIsEmpty() throw() {
return false;
}
//------------------------------------------------------------------------------
// getProbeErrorMsg()
//------------------------------------------------------------------------------
cta::optional<std::string> castor::tape::tapeserver::daemon::EmptyDriveProbe::getProbeErrorMsg(){
return m_probeErrorMsg;
}
//------------------------------------------------------------------------------
// exceptionThrowingDriveIsEmpty
//------------------------------------------------------------------------------
......
......@@ -30,6 +30,7 @@
#include "castor/tape/tapeserver/SCSI/Device.hpp"
#include "castor/tape/tapeserver/system/Wrapper.hpp"
#include "mediachanger/MediaChangerFacade.hpp"
#include "common/optional.hpp"
#include <memory>
......@@ -63,6 +64,11 @@ namespace daemon {
*/
bool driveIsEmpty() throw();
/**
* Returns the eventual probe error message
*/
cta::optional<std::string> getProbeErrorMsg();
private:
/**
......@@ -95,6 +101,11 @@ namespace daemon {
*/
std::unique_ptr<drive::DriveInterface> createDrive();
/**
* Eventual error message if we could not check whether the drive is empty or not
*/
cta::optional<std::string> m_probeErrorMsg;
}; // class EmptyDriveProbe
} // namespace daemon
......
Markdown is supported
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