Commit 7e6da1d1 authored by Steven Murray's avatar Steven Murray
Browse files

tapeserverd now sets drive UP at end of a successful session

Setting a drive UP in the vdqm as opposed to trying to release and
then unmount avoids the need to remember the state of the drive.
parent f6bcb421
......@@ -344,11 +344,9 @@ void castor::tape::tapeserver::daemon::ProcessForkerConnectionHandler::
try {
if(0 == msg.exitcode()) {
const std::string vid = drive.getTransferSession().getVid();
drive.sessionSucceeded();
m_log(LOG_INFO, "Data-transfer session succeeded", params);
requestVdqmToReleaseDrive(drive.getConfig(), msg.pid());
notifyVdqmTapeUnmounted(drive.getConfig(), vid, msg.pid());
setDriveUpInVdqm(msg.pid(), drive.getConfig());
} else {
drive.sessionFailed();
m_log(LOG_WARNING, "Data-transfer session failed", params);
......@@ -374,11 +372,9 @@ void castor::tape::tapeserver::daemon::ProcessForkerConnectionHandler::
try {
if(0 == msg.exitcode()) {
const std::string &vid = drive.getCleanerSession().getVid();
drive.sessionSucceeded();
m_log(LOG_INFO, "Cleaner session succeeded", params);
requestVdqmToReleaseDrive(drive.getConfig(), msg.pid());
notifyVdqmTapeUnmounted(drive.getConfig(), vid, msg.pid());
setDriveUpInVdqm(msg.pid(), drive.getConfig());
} else {
drive.sessionFailed();
m_log(LOG_WARNING, "Cleaner session failed", params);
......@@ -495,3 +491,25 @@ void castor::tape::tapeserver::daemon::ProcessForkerConnectionHandler::
throw ex;
}
}
//------------------------------------------------------------------------------
// setDriveUpInVdqm
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::ProcessForkerConnectionHandler::
setDriveUpInVdqm(const pid_t pid, const utils::DriveConfig &driveConfig) {
std::list<log::Param> params;
params.push_back(log::Param("pid", pid));
try {
params.push_back(log::Param("unitName", driveConfig.unitName));
params.push_back(log::Param("dgn", driveConfig.dgn));
m_vdqm.setDriveUp(m_hostName, driveConfig.unitName, driveConfig.dgn);
m_log(LOG_INFO, "Set tape-drive up in vdqm", params);
} catch(castor::exception::Exception &ne) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to set tape-drive up in vdqm: " <<
ne.getMessage().str();
throw ex;
}
}
......@@ -259,6 +259,16 @@ private:
void setDriveDownInVdqm(const pid_t pid,
const utils::DriveConfig &driveConfig);
/**
* Sets the state of the tape drive asscoiated with the specified
* child process to up within the vdqmd daemon.
*
* @param pid The process ID of the child process.
* @param driveConfig The configuration of the tape drive.
*/
void setDriveUpInVdqm(const pid_t pid,
const utils::DriveConfig &driveConfig);
/**
* Notifies the vdqm that the tape associated with the session child-process
* with the specified process ID has been unmounted.
......
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