Commit ab418303 authored by David COME's avatar David COME
Browse files

MountSession renamed in DataTransferSession

parent 6ad8bfad
......@@ -46,7 +46,7 @@ namespace legacymsg {
* |<--------------------------------| |
* | | |
* | fork | |
* |----------->MountSession | |
* |----------->DataTransferSession | |
* | | | |
* | | assignDrive | |
* | |-------------->| |
......
......@@ -425,7 +425,7 @@ void castor::tape::rmc::RmcDaemon::forkChildProcess() throw() {
// Else if this is the parent process
} else if(0 < childPid) {
m_driveCatalogue.forkedMountSession(unitName, childPid);
m_driveCatalogue.forkedDataTransferSession(unitName, childPid);
// Else this is the child process
} else {
......@@ -433,11 +433,11 @@ void castor::tape::rmc::RmcDaemon::forkChildProcess() throw() {
// file-descriptors owned by the event handlers
m_reactor.clear();
runMountSession(unitName);
runDataTransferSession(unitName);
// The runMountSession() should call exit() and should therefore never
// The runDataTransferSession() should call exit() and should therefore never
// return
m_log(LOG_ERR, "runMountSession() returned unexpectedly");
m_log(LOG_ERR, "runDataTransferSession() returned unexpectedly");
}
*/
}
......@@ -101,7 +101,7 @@ tapegateway::GatewayMessage *
std::stringstream mess;
if (ret->mountTransactionId() != m_request.volReqId) {
mess << "In castor::tape::server::clientInterface::requestResponseSession, "
"expected a information about mountSessionId=" << m_request.volReqId
"expected a information about DataTransferSessionId=" << m_request.volReqId
<< " and received: " << ret->mountTransactionId();
} else {
mess << "In castor::tape::server::clientInterface::requestResponseSession, "
......
......@@ -28,7 +28,7 @@
#include "ClientProxy.hpp"
#include "../threading/Threading.hpp"
#include "castor/log/StringLogger.hpp"
#include "castor/tape/tapeserver/daemon/MountSession.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
#include "../system/Wrapper.hpp"
#include "Ctape.h"
#include "castor/tape/tapegateway/Volume.hpp"
......
......@@ -23,7 +23,7 @@ add_library(castorTapeServerDaemon
MigrationMemoryManager.cpp
MigrationReportPacker.cpp
MigrationTaskInjector.cpp
MountSession.cpp
DataTransferSession.cpp
RecallMemoryManager.cpp
RecallTaskInjector.cpp
RecallReportPacker.cpp
......
/******************************************************************************
* MountSession.cpp
* DataTransferSession.cpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -24,7 +24,7 @@
#include <memory>
#include "castor/tape/tapeserver/daemon/MountSession.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
#include "castor/log/LogContext.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/tape/tapeserver/client/ClientProxy.hpp"
......@@ -44,14 +44,14 @@
#include "castor/tape/tapeserver/daemon/GlobalStatusReporter.hpp"
#include "castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp"
#include "castor/tape/tapeserver/daemon/CapabilityUtils.hpp"
#include "castor/tape/tapeserver/daemon/MountSession.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
using namespace castor::tape;
using namespace castor::log;
//------------------------------------------------------------------------------
//Constructor
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::MountSession::MountSession(
castor::tape::tapeserver::daemon::DataTransferSession::DataTransferSession(
int argc,
char ** argv,
const std::string & hostname,
......@@ -77,7 +77,7 @@ castor::tape::tapeserver::daemon::MountSession::MountSession(
}
//------------------------------------------------------------------------------
//MountSession::execute
//DataTransferSession::execute
//------------------------------------------------------------------------------
/**
* Function's synopsis
......@@ -87,7 +87,7 @@ castor::tape::tapeserver::daemon::MountSession::MountSession(
* 2b) Log The result
* Then branch to the right execution
*/
int castor::tape::tapeserver::daemon::MountSession::execute()
int castor::tape::tapeserver::daemon::DataTransferSession::execute()
{
// 1) Prepare the logging environment
LogContext lc(m_logger);
......@@ -171,9 +171,9 @@ int castor::tape::tapeserver::daemon::MountSession::execute()
}
}
//------------------------------------------------------------------------------
//MountSession::executeRead
//DataTransferSession::executeRead
//------------------------------------------------------------------------------
int castor::tape::tapeserver::daemon::MountSession::executeRead(LogContext & lc) {
int castor::tape::tapeserver::daemon::DataTransferSession::executeRead(LogContext & lc) {
// We are ready to start the session. We need to create the whole machinery
// in order to get the task injector ready to check if we actually have a
// file to recall.
......@@ -250,9 +250,9 @@ int castor::tape::tapeserver::daemon::MountSession::executeRead(LogContext & lc)
}
}
//------------------------------------------------------------------------------
//MountSession::executeWrite
//DataTransferSession::executeWrite
//------------------------------------------------------------------------------
int castor::tape::tapeserver::daemon::MountSession::executeWrite(LogContext & lc) {
int castor::tape::tapeserver::daemon::DataTransferSession::executeWrite(LogContext & lc) {
// We are ready to start the session. We need to create the whole machinery
// in order to get the task injector ready to check if we actually have a
// file to migrate.
......@@ -341,9 +341,9 @@ int castor::tape::tapeserver::daemon::MountSession::executeWrite(LogContext & lc
}
}
//------------------------------------------------------------------------------
//MountSession::executeDump
//DataTransferSession::executeDump
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::MountSession::executeDump(LogContext & lc) {
void castor::tape::tapeserver::daemon::DataTransferSession::executeDump(LogContext & lc) {
// We are ready to start the session. In case of read there is no interest in
// creating the machinery before getting the tape mounted, so do it now.
// 1) Get hold of the drive and check it.
......@@ -351,7 +351,7 @@ void castor::tape::tapeserver::daemon::MountSession::executeDump(LogContext & lc
}
//------------------------------------------------------------------------------
//MountSession::findDrive
//DataTransferSession::findDrive
//------------------------------------------------------------------------------
/*
* Function synopsis :
......@@ -367,7 +367,7 @@ void castor::tape::tapeserver::daemon::MountSession::executeDump(LogContext & lc
* @return the drive if found, NULL otherwise
*/
castor::tape::drives::DriveInterface *
castor::tape::tapeserver::daemon::MountSession::findDrive(const utils::DriveConfig
castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const utils::DriveConfig
&driveConfig, LogContext& lc) {
// Find the drive in the system's SCSI devices
castor::tape::SCSI::DeviceVector dv(m_sysWrapper);
......@@ -471,16 +471,16 @@ castor::tape::tapeserver::daemon::MountSession::findDrive(const utils::DriveConf
}
//------------------------------------------------------------------------------
//MountSession::ctx
//DataTransferSession::ctx
//------------------------------------------------------------------------------
zmq::context_t& castor::tape::tapeserver::daemon::MountSession::ctx(){
zmq::context_t& castor::tape::tapeserver::daemon::DataTransferSession::ctx(){
static zmq::context_t m_ctx;
return m_ctx;
}
//------------------------------------------------------------------------------
//destructor
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::MountSession::~MountSession(){
castor::tape::tapeserver::daemon::DataTransferSession::~DataTransferSession(){
ctx().close();
}
/******************************************************************************
* MountSession.hpp
* DataTransferSession.hpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -52,7 +52,7 @@ namespace daemon {
* by the master process. It will drive a separate process. Only the sub
* process interface is not included here to allow testability.
*/
class MountSession {
class DataTransferSession {
public:
/** Subclass holding all the contents from castor.conf file. The pre-
* extraction of the contents by the caller instead of direct getconfent
......@@ -98,7 +98,7 @@ namespace daemon {
uint32_t tapeserverdDiskThreads;
};
/** Constructor */
MountSession(
DataTransferSession(
int argc,
char ** argv,
const std::string & hostname,
......@@ -122,7 +122,7 @@ namespace daemon {
*/
static zmq::context_t& ctx();
~MountSession();
~DataTransferSession();
private:
legacymsg::RtcpJobRqstMsgBody m_request;
castor::log::Logger & m_logger;
......
......@@ -33,7 +33,7 @@
#include "castor/tape/tapeserver/daemon/CapabilityUtilsDummy.hpp"
#include "../threading/Threading.hpp"
#include "castor/log/StringLogger.hpp"
#include "MountSession.hpp"
#include "DataTransferSession.hpp"
#include "../system/Wrapper.hpp"
#include "Ctape.h"
#include "castor/tape/tapegateway/Volume.hpp"
......@@ -71,7 +71,7 @@ private:
TEST(tapeServer, MountSessionGooddayRecall) {
TEST(tapeServer, DataTransferSessionGooddayRecall) {
// TpcpClients only supports 32 bits session number
// This number has to be less than 2^31 as in addition there is a mix
// of signed and unsigned numbers
......@@ -157,7 +157,7 @@ TEST(tapeServer, MountSessionGooddayRecall) {
driveConfig.densities.push_back("5000GC");
driveConfig.librarySlot = "manual";
driveConfig.devType = "T10000";
MountSession::CastorConf castorConf;
DataTransferSession::CastorConf castorConf;
castorConf.rtcopydBufsz = 1024*1024; // 1 MB memory buffers
castorConf.rtcopydNbBufs = 10;
castorConf.tapebridgeBulkRequestRecallMaxBytes = UINT64_C(100)*1000*1000*1000;
......@@ -177,7 +177,7 @@ TEST(tapeServer, MountSessionGooddayRecall) {
argv_ctn_str.find_first_of("\0",pos);
}
}
MountSession sess(argc, argv, "tapeHost", VDQMjob, logger, mockSys,
DataTransferSession sess(argc, argv, "tapeHost", VDQMjob, logger, mockSys,
driveConfig, rmc, initialProcess, capUtils, castorConf);
sess.execute();
simRun.wait();
......@@ -187,7 +187,7 @@ TEST(tapeServer, MountSessionGooddayRecall) {
}
TEST(tapeServer, MountSessionNoSuchDrive) {
TEST(tapeServer, DataTransferSessionNoSuchDrive) {
// TpcpClients only supports 32 bits session number
// This number has to be less than 2^31 as in addition there is a mix
// of signed and unsigned numbers
......@@ -226,7 +226,7 @@ TEST(tapeServer, MountSessionNoSuchDrive) {
driveConfig.densities.push_back("5000GC");
driveConfig.librarySlot = "manual";
driveConfig.devType = "T10000";
MountSession::CastorConf castorConf;
DataTransferSession::CastorConf castorConf;
castorConf.rtcopydBufsz = 1024;
castorConf.rtcopydNbBufs = 10;
castor::legacymsg::VmgrProxyDummy vmgr;
......@@ -245,7 +245,7 @@ TEST(tapeServer, MountSessionNoSuchDrive) {
argv_ctn_str.find_first_of("\0",pos);
}
}
MountSession sess(argc, argv, "tapeHost", VDQMjob, logger, mockSys,
DataTransferSession sess(argc, argv, "tapeHost", VDQMjob, logger, mockSys,
driveConfig, rmc, initialProcess, capUtils, castorConf);
sess.execute();
simRun.wait();
......@@ -310,7 +310,7 @@ struct expectedResult {
uint32_t checksum;
};
TEST(tapeServer, MountSessionGooddayMigration) {
TEST(tapeServer, DataTransferSessionGooddayMigration) {
// TpcpClients only supports 32 bits session number
// This number has to be less than 2^31 as in addition there is a mix
// of signed and unsigned numbers
......@@ -378,7 +378,7 @@ TEST(tapeServer, MountSessionGooddayMigration) {
driveConfig.densities.push_back("5000GC");
driveConfig.librarySlot = "manual";
driveConfig.devType = "T10000";
MountSession::CastorConf castorConf;
DataTransferSession::CastorConf castorConf;
castorConf.rtcopydBufsz = 1024*1024; // 1 MB memory buffers
castorConf.rtcopydNbBufs = 10;
castorConf.tapebridgeBulkRequestMigrationMaxBytes = UINT64_C(100)*1000*1000*1000;
......@@ -400,7 +400,7 @@ TEST(tapeServer, MountSessionGooddayMigration) {
argv_ctn_str.find_first_of("\0",pos);
}
}
MountSession sess(argc, argv, "tapeHost", VDQMjob, logger, mockSys,
DataTransferSession sess(argc, argv, "tapeHost", VDQMjob, logger, mockSys,
driveConfig, rmc, initialProcess, capUtils, castorConf);
sess.execute();
simRun.wait();
......
......@@ -483,9 +483,9 @@ void castor::tape::tapeserver::daemon::DriveCatalogueEntry::receivedLabelJob(
}
//-----------------------------------------------------------------------------
// forkedMountSession
// forkedDataTransferSession
//-----------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::DriveCatalogueEntry::forkedMountSession(
void castor::tape::tapeserver::daemon::DriveCatalogueEntry::forkedDataTransferSession(
const pid_t sessionPid) {
std::ostringstream task;
task << "handle fork of mount session for tape drive " << m_config.unitName;
......
......@@ -328,7 +328,7 @@ public:
* @param sessionPid The process ID of the child process responsible for
* running the mount session.
*/
void forkedMountSession(const pid_t sessionPid);
void forkedDataTransferSession(const pid_t sessionPid);
/**
* Moves the state of the tape drive to DRIVE_STATE_RUNNING.
......
......@@ -193,7 +193,7 @@ TEST_F(castor_tape_tapeserver_daemon_DriveCatalogueTest, completeFSTN) {
// Fork the mount session
const pid_t sessionPid = 1234;
ASSERT_NO_THROW(unit->forkedMountSession(sessionPid));
ASSERT_NO_THROW(unit->forkedDataTransferSession(sessionPid));
ASSERT_EQ(castor::tape::tapeserver::daemon::DriveCatalogueSession::SESSION_STATE_RUNNING, unit->getSessionState());
ASSERT_EQ(sessionPid, unit->getSessionPid());
......
......@@ -202,7 +202,7 @@ private:
* IT is computed by subtracting 1 to fSeg of the first file to migrate we
* receive. That part is done by the
* MigrationTaskInjector.::synchronousInjection. Thus, we compute it into
* that function and retrieve/set it within MountSession executeWrite
* that function and retrieve/set it within DataTransferSession executeWrite
* after we make sure synchronousInjection returned true. To do so, we
* need to store it
*/
......
......@@ -33,7 +33,7 @@
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/LabelCmdAcceptHandler.hpp"
#include "castor/tape/tapeserver/daemon/LabelSession.hpp"
#include "castor/tape/tapeserver/daemon/MountSession.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
#include "castor/tape/tapeserver/daemon/TapeDaemon.hpp"
#include "castor/tape/tapeserver/daemon/TapeMessageHandler.hpp"
#include "castor/tape/tapeserver/daemon/VdqmAcceptHandler.hpp"
......@@ -443,7 +443,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeDaemon::mainEventLoop() {
while(handleEvents()) {
forkMountSessions();
forkDataTransferSessions();
forkLabelSessions();
}
}
......@@ -745,23 +745,23 @@ void castor::tape::tapeserver::daemon::TapeDaemon::postProcessReapedLabelSession
}
//------------------------------------------------------------------------------
// forkMountSessions
// forkDataTransferSessions
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeDaemon::forkMountSessions() throw() {
void castor::tape::tapeserver::daemon::TapeDaemon::forkDataTransferSessions() throw() {
const std::list<std::string> unitNames = m_driveCatalogue.getUnitNamesWaitingForTransferFork();
for(std::list<std::string>::const_iterator itor = unitNames.begin();
itor != unitNames.end(); itor++) {
const std::string unitName = *itor;
DriveCatalogueEntry *drive = m_driveCatalogue.findDrive(unitName);
forkMountSession(drive);
forkDataTransferSession(drive);
}
}
//------------------------------------------------------------------------------
// forkMountSession
// forkDataTransferSession
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeDaemon::forkMountSession(
void castor::tape::tapeserver::daemon::TapeDaemon::forkDataTransferSession(
DriveCatalogueEntry *drive) throw() {
const utils::DriveConfig &driveConfig = drive->getConfig();
......@@ -783,7 +783,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::forkMountSession(
// Else if this is the parent process
} else if(0 < forkRc) {
drive->forkedMountSession(forkRc);
drive->forkedDataTransferSession(forkRc);
return;
// Else this is the child process
......@@ -805,14 +805,14 @@ void castor::tape::tapeserver::daemon::TapeDaemon::forkMountSession(
params);
}
runMountSession(drive);
runDataTransferSession(drive);
}
}
//------------------------------------------------------------------------------
// runMountSession
// runDataTransferSession
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeDaemon::runMountSession(
void castor::tape::tapeserver::daemon::TapeDaemon::runDataTransferSession(
const DriveCatalogueEntry *drive) throw() {
const utils::DriveConfig &driveConfig = drive->getConfig();
const pid_t sessionPid = getpid();
......@@ -824,10 +824,10 @@ void castor::tape::tapeserver::daemon::TapeDaemon::runMountSession(
m_log(LOG_INFO, "Mount-session child-process started", params);
try {
MountSession::CastorConf castorConf;
DataTransferSession::CastorConf castorConf;
// This try bloc will allow us to send a failure notification to the client
// if we fail before the MountSession has an opportunity to do so.
std::auto_ptr<MountSession> mountSession;
// if we fail before the DataTransferSession has an opportunity to do so.
std::auto_ptr<DataTransferSession> dataTransferSession;
castor::tape::System::realWrapper sysWrapper;
std::auto_ptr<legacymsg::RmcProxy> rmc;
std::auto_ptr<messages::TapeserverProxy> tapeserver;
......@@ -863,12 +863,12 @@ void castor::tape::tapeserver::daemon::TapeDaemon::runMountSession(
rmc.reset(m_rmcFactory.create());
try{
tapeserver.reset(m_tapeserverFactory.create(MountSession::ctx()));
tapeserver.reset(m_tapeserverFactory.create(DataTransferSession::ctx()));
}
catch(const std::exception& e){
m_log(LOG_ERR, "Failed to connect ZMQ/REQ socket in MountSession");
m_log(LOG_ERR, "Failed to connect ZMQ/REQ socket in DataTransferSession");
}
mountSession.reset(new MountSession (
dataTransferSession.reset(new DataTransferSession (
m_argc,
m_argv,
m_hostName,
......@@ -911,8 +911,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::runMountSession(
throw;
}
m_log(LOG_INFO, "Going to execute Mount Session");
int result = mountSession->execute();
// MountSession::ctx().close();
int result = dataTransferSession->execute();
exit(result);
} catch(castor::exception::Exception & ex) {
params.push_back(log::Param("message", ex.getMessageValue()));
......
......@@ -304,14 +304,14 @@ protected:
* call to m_reactor.handleEvents() handled requests to start a mount
* session on more than one of the connected tape drives.
*/
void forkMountSessions() throw();
void forkDataTransferSessions() throw();
/**
* Forks a mount-session child-process for the specified tape drive.
*
* @param drive The tape-drive entry in the tape-drive catalogue.
*/
void forkMountSession(DriveCatalogueEntry *drive) throw();
void forkDataTransferSession(DriveCatalogueEntry *drive) throw();
/**
* Runs the mount session. This method is to be called within the child
......@@ -320,7 +320,7 @@ protected:
* @param drive The catalogue entry of the tape drive to be used during the
* session.
*/
void runMountSession(const DriveCatalogueEntry *drive) throw();
void runDataTransferSession(const DriveCatalogueEntry *drive) throw();
/**
* Forks a label-session child-process for every tape drive entry in the
......
......@@ -32,7 +32,7 @@
#include "castor/tape/reactor/ZMQReactor.hpp"
#include "castor/tape/tapeserver/daemon/CapabilityUtilsImpl.hpp"
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/MountSession.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
#include "castor/tape/tapeserver/daemon/TapeDaemon.hpp"
#include "castor/utils/utils.hpp"
#include "h/rmc_constants.h"
......
......@@ -261,7 +261,7 @@ private:
* of our session. The last Fseq is computed by subtracting 1 to fSeg
* of the first file to migrate we receive. That part is done by the
* MigrationTaskInjector.::synchronousInjection. Thus, we compute it into
* that function and retrieve/set it within MountSession executeWrite
* that function and retrieve/set it within DataTransferSession executeWrite
* after we make sure synchronousInjection returned true.
*
* It should be const, but it cant
......
......@@ -29,7 +29,7 @@
#include "castor/messages/messages.hpp"
#include "castor/utils/utils.hpp"
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/MountSession.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
namespace castor {
......@@ -71,7 +71,7 @@ void TaskWatchDog::report(zmq::socket_t& m_socket){
}
void TaskWatchDog::run(){
zmq::socket_t m_socket(MountSession::ctx(),ZMQ_REQ);
zmq::socket_t m_socket(DataTransferSession::ctx(),ZMQ_REQ);
castor::messages::connectToLocalhost(m_socket);
using castor::utils::timevalToDouble;
......
......@@ -305,7 +305,7 @@ TEST_F(castor_tape_utils_DriveCatalogueTest, completeFSTN) {
// Fork the mount session
const pid_t sessionPid = 1234;
ASSERT_NO_THROW(catalogue.forkedMountSession("UNIT", sessionPid));
ASSERT_NO_THROW(catalogue.forkedDataTransferSession("UNIT", sessionPid));
ASSERT_EQ(DriveCatalogue::DRIVE_STATE_RUNNING, catalogue.getState("UNIT"));
ASSERT_EQ(sessionPid, catalogue.getSessionPid("UNIT"));
......
......@@ -214,7 +214,7 @@ target_link_libraries(castorUnitTests
add_executable(castorThreadedUnitTests
castorUnitTests.cpp
../castor/tape/tapeserver/threading/ThreadingMTTests.cpp
../castor/tape/tapeserver/daemon/MountSessionTest.cpp
../castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
../castor/tape/tapeserver/threading/ThreadingBlockingQTests.cpp
../castor/tape/tapeserver/daemon/CapabilityUtilsDummy.cpp
../castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp
......
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