Skip to content
Snippets Groups Projects
Commit 08d57839 authored by Steven Murray's avatar Steven Murray
Browse files

tapeserverd now logs explicit DOWNing of drive in vdqm

parent 862c8113
No related branches found
No related tags found
No related merge requests found
......@@ -389,6 +389,13 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::configureDown() {
break;
case DRIVE_STATE_UP:
changeState(DRIVE_STATE_DOWN);
{
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because drive configured"
" DOWN in tape server", params);
}
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
break;
case DRIVE_STATE_RUNNING:
......@@ -555,12 +562,37 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
case DRIVE_STATE_WAITDOWN:
changeState(DRIVE_STATE_DOWN);
session->sessionSucceeded();
{
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because session succeeded"
" and was in the WAITDOWN state", params);
}
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
break;
case DRIVE_STATE_WAITSHUTDOWNKILL:
changeState(DRIVE_STATE_SHUTDOWN);
session->sessionSucceeded();
{
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because session succeeded"
" and tape server is shutting down", params);
}
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
break;
case DRIVE_STATE_WAITSHUTDOWNCLEANER:
changeState(DRIVE_STATE_SHUTDOWN);
session->sessionSucceeded();
{
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because cleaner succeeded"
" and tape server is shutting down", params);
}
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
break;
default:
......@@ -576,14 +608,15 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
}
//-----------------------------------------------------------------------------
// sessionFailed
// sessionFailedAndRequestedDriveDown
//-----------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::CatalogueDrive::sessionFailed() {
void castor::tape::tapeserver::daemon::CatalogueDrive::
sessionFailedAndRequestedDriveDown() {
switch(m_state) {
case DRIVE_STATE_RUNNING:
case DRIVE_STATE_WAITDOWN:
case DRIVE_STATE_WAITSHUTDOWNKILL:
return runningSessionFailed();
return runningSessionFailedAndRequestedDriveDown();
case DRIVE_STATE_WAITSHUTDOWNCLEANER:
return cleanerOfShutdownFailed();
default:
......@@ -628,13 +661,19 @@ sessionKilled(uint32_t signal) {
}
//------------------------------------------------------------------------------
// runningSessionFailed
// runningSessionFailedAndRequestedDriveDown
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::CatalogueDrive::runningSessionFailed() {
void castor::tape::tapeserver::daemon::CatalogueDrive::
runningSessionFailedAndRequestedDriveDown() {
std::auto_ptr<CatalogueSession> session(m_session);
m_session = NULL;
session->sessionFailed();
changeState(DRIVE_STATE_DOWN);
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because running session failed "
"and requested drive DOWN", params);
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
}
......@@ -653,6 +692,10 @@ runningSessionKilled(uint32_t signal) {
driveReadyDelayInSeconds);
} else {
changeState(DRIVE_STATE_DOWN);
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because cleaner was killed",
params);
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
}
}
......@@ -687,10 +730,10 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
}
//------------------------------------------------------------------------------
// sessionFailedAndRequestsCleaner
// sessionFailedAndRequestedCleaner
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::CatalogueDrive::
sessionFailedAndRequestsCleaner() {
sessionFailedAndRequestedCleaner() {
switch(m_state) {
case DRIVE_STATE_RUNNING:
case DRIVE_STATE_WAITDOWN:
......@@ -738,6 +781,11 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
driveReadyDelayInSeconds);
} else {
changeState(DRIVE_STATE_DOWN);
std::list<log::Param> params;
params.push_back(log::Param("unitName", m_config.getUnitName()));
m_log(LOG_INFO, "Putting drive DOWN in vdqm because cleaner failed",
params);
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
}
}
......@@ -985,6 +1033,9 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::killSession() {
delete m_session;
m_session = NULL;
changeState(DRIVE_STATE_DOWN);
m_log(LOG_INFO, "Putting drive DOWN in vdqm because session was killed",
params);
m_vdqm.setDriveDown(m_hostName, m_config.getUnitName(), m_config.getDgn());
}
......
......@@ -205,7 +205,7 @@ public:
* Informs catalogue drive that the current tape session completed in a failed
* state (tape not unloaded, usually) and the drive should be marked as down.
*/
void sessionFailed();
void sessionFailedAndRequestedDriveDown();
/**
* Informs catalogue drive that the current tape session was killed (either
......@@ -217,7 +217,7 @@ public:
* Informs catalogue drive that the current tape session has failed and that
* it has requested a CleanerSession.
*/
void sessionFailedAndRequestsCleaner();
void sessionFailedAndRequestedCleaner();
/**
* Gets the tpstat representation of the tape drive.
......@@ -511,9 +511,10 @@ private:
/**
* Called when a running session (DRIVE_STATE_RUNNING or DRIVE_STATE_WAITDOWN)
* has competed with an error return value.
* has competed with an error return value and the drive should be marked as
* down.
*/
void runningSessionFailed();
void runningSessionFailedAndRequestedDriveDown();
/**
* Called when a running session (DRIVE_STATE_RUNNING or DRIVE_STATE_WAITDOWN)
......
......@@ -235,9 +235,9 @@ void castor::tape::tapeserver::daemon::ProcessForkerConnectionHandler::
case Session::MARK_DRIVE_AS_UP:
return drive.sessionSucceeded();
case Session::MARK_DRIVE_AS_DOWN:
return drive.sessionFailed();
return drive.sessionFailedAndRequestedDriveDown();
case Session::CLEAN_DRIVE:
return drive.sessionFailedAndRequestsCleaner();
return drive.sessionFailedAndRequestedCleaner();
default:
// Should never happen
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment