Commit 1879f4a0 authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Changed volume mode into mount type, filling in volInfo with the tape mount object

parent b78cfd78
......@@ -45,6 +45,12 @@ std::string cta::ArchiveMount::getVid() const throw() {
return "UNKNOWN_VID_FOR_ARCHIVE_MOUNT";
}
//------------------------------------------------------------------------------
// getDensity
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getDensity() const throw() {
return "UNKNOWN_DENSITY_FOR_ARCHIVE_MOUNT";
}
//------------------------------------------------------------------------------
// complete
//------------------------------------------------------------------------------
......
......@@ -62,6 +62,13 @@ namespace cta {
* @return The volume identifier of the tape to be mounted.
*/
virtual std::string getVid() const throw();
/**
* Returns the density of the tape to be mounted.
*
* @return The density of the tape to be mounted.
*/
virtual std::string getDensity() const throw();
/**
* Indicates that the mount was successful.
......
......@@ -45,6 +45,13 @@ std::string cta::RetrieveMount::getVid() const throw() {
return "UNKNOWN_VID_FOR_RETRIEVE_MOUNT";
}
//------------------------------------------------------------------------------
// getDensity
//------------------------------------------------------------------------------
std::string cta::RetrieveMount::getDensity() const throw() {
return "UNKNOWN_DENSITY_FOR_RETRIEVE_MOUNT";
}
//------------------------------------------------------------------------------
// complete
//------------------------------------------------------------------------------
......
......@@ -62,6 +62,13 @@ namespace cta {
* @return The volume identifier of the tape to be mounted.
*/
virtual std::string getVid() const throw();
/**
* Returns the density of the tape to be mounted.
*
* @return The density of the tape to be mounted.
*/
virtual std::string getDensity() const throw();
/**
* Indicates that the mount was successful.
......
......@@ -43,6 +43,13 @@ namespace cta {
* @return The volume identifier of the tape to be mounted.
*/
virtual std::string getVid() const throw() = 0;
/**
* Returns the density of the tape to be mounted.
*
* @return The density of the tape to be mounted.
*/
virtual std::string getDensity() const throw() = 0;
/**
* Indicates that the mount was successful.
......
......@@ -38,7 +38,8 @@ namespace castor {
TAPE_GATEWAY = 0,
READ_TP = 1,
WRITE_TP = 2,
DUMP_TP = 3
DUMP_TP = 3,
CTA = 4
}; /* end of enum ClientType */
/**
......
......@@ -37,6 +37,7 @@
#include "castor/tape/tapegateway/FilesToRecallList.hpp"
#include "castor/tape/tapegateway/FileRecallReportList.hpp"
#include "castor/server/Threading.hpp"
#include "scheduler/MountType.hpp"
namespace castor {
namespace tape {
......@@ -74,8 +75,8 @@ public :
std::string density;
/** The label field seems to be in disuse */
std::string labelObsolete;
/** The read/write mode */
tapegateway::VolumeMode volumeMode;
/** The mount type: archive or retrieve */
cta::MountType::Enum mountType;
};
/**
......
......@@ -89,8 +89,13 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// 2a) Get initial information from the client
client::ClientProxy::RequestReport reqReport;
try {
std::unique_ptr<cta::TapeMount> tapeMount(m_scheduler.getNextMount("LLname", "DriveName")); //TODO: put right values of logical library and drive name
m_clientProxy.fetchVolumeId(m_volInfo, reqReport);
std::unique_ptr<cta::TapeMount> tapeMount(m_scheduler.getNextMount(m_driveConfig.getLogicalLibrary(), m_driveConfig.getUnitName()));
m_volInfo.vid=tapeMount->getVid();
m_volInfo.clientType=tapegateway::ClientType::CTA;
m_volInfo.mountType=tapeMount->getMountType();
m_volInfo.density=tapeMount->getDensity();
m_volInfo.labelObsolete="AUL";
//m_clientProxy.fetchVolumeId(m_volInfo, reqReport);
} catch(client::ClientProxy::EndOfSessionWithError & eoswe) {
std::stringstream fullError;
fullError << "Received end of session with error from client when requesting Volume "
......@@ -151,19 +156,16 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
.add("density", m_volInfo.density)
.add("label", m_volInfo.labelObsolete)
.add("clientType", volumeClientTypeToString(m_volInfo.clientType))
.add("mode", volumeModeToString(m_volInfo.volumeMode));
.add("mountType", mountTypeToString(m_volInfo.mountType));
lc.log(LOG_INFO, "Got volume from client");
}
// Depending on the type of session, branch into the right execution
switch(m_volInfo.volumeMode) {
case tapegateway::READ:
switch(m_volInfo.mountType) {
case cta::MountType::RETRIEVE:
return executeRead(lc);
case tapegateway::WRITE:
case cta::MountType::ARCHIVE:
return executeWrite(lc);
case tapegateway::DUMP:
executeDump(lc);
return MARK_DRIVE_AS_UP;
default:
return MARK_DRIVE_AS_UP;
}
......@@ -556,11 +558,10 @@ const char *castor::tape::tapeserver::daemon::DataTransferSession::
// volumeModeToString
//-----------------------------------------------------------------------------
const char *castor::tape::tapeserver::daemon::DataTransferSession::
volumeModeToString(const tapegateway::VolumeMode mode) const throw() {
switch(mode) {
case tapegateway::READ : return "READ";
case tapegateway::WRITE: return "WRITE";
case tapegateway::DUMP : return "DUMP";
default : return "UKNOWN";
mountTypeToString(const cta::MountType::Enum mountType) const throw() {
switch(mountType) {
case cta::MountType::RETRIEVE: return "RETRIEVE";
case cta::MountType::ARCHIVE : return "ARCHIVE";
default : return "UNKNOWN";
}
}
......@@ -146,10 +146,9 @@ namespace daemon {
const throw();
/**
* Returns the string representation of the specified volume mode from a
* tapegateay::Volume message (READ, WRITE or DUMP).
* Returns the string representation of the specified mount type
*/
const char *volumeModeToString(const tapegateway::VolumeMode mode) const
const char *mountTypeToString(const cta::MountType::Enum mountType) const
throw();
};
}
......
......@@ -104,7 +104,7 @@ TEST(castor_tape_tapeserver_daemon, RecallTaskInjectorNominal) {
volume.density="8000GC";
volume.labelObsolete="AUL";
volume.vid="V12345";
volume.volumeMode=castor::tape::tapegateway::READ;
volume.mountType=cta::MountType::RETRIEVE;
castor::tape::tapeserver::daemon::TapeServerReporter gsr(initialProcess,
DriveConfig(),"0.0.0.0",volume,lc);
castor::server::ProcessCapDummy cap;
......@@ -162,7 +162,7 @@ TEST(castor_tape_tapeserver_daemon, RecallTaskInjectorNoFiles) {
volume.density="8000GC";
volume.labelObsolete="AUL";
volume.vid="V12345";
volume.volumeMode=castor::tape::tapegateway::READ;
volume.mountType=cta::MountType::RETRIEVE;
castor::server::ProcessCapDummy cap;
castor::tape::tapeserver::daemon::TapeServerReporter tsr(initialProcess,
DriveConfig(),"0.0.0.0",volume,lc);
......
......@@ -155,6 +155,18 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::openReadSession() {
}
}
//-----------------------------------------------------------------------------
// volumeModeToString
//-----------------------------------------------------------------------------
const char *castor::tape::tapeserver::daemon::TapeReadSingleThread::
mountTypeToString(const cta::MountType::Enum mountType) const throw() {
switch(mountType) {
case cta::MountType::RETRIEVE: return "RETRIEVE";
case cta::MountType::ARCHIVE : return "ARCHIVE";
default : return "UNKNOWN";
}
}
//------------------------------------------------------------------------------
//TapeReadSingleThread::run()
//------------------------------------------------------------------------------
......@@ -171,7 +183,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
typedef castor::log::Param Param;
m_watchdog.addParameter(Param("clientType", castor::tape::tapegateway::ClientTypeStrings[m_volInfo.clientType]));
m_watchdog.addParameter(Param("TPVID", m_volInfo.vid));
m_watchdog.addParameter(Param("volumeMode",tapegateway::VolumeModeStrings[m_volInfo.volumeMode]));
m_watchdog.addParameter(Param("mountType", mountTypeToString(m_volInfo.mountType)));
m_watchdog.addParameter(Param("density", m_volInfo.density));
// Set the tape thread time in the watchdog for total time estimation in case
......
......@@ -74,7 +74,14 @@ public:
m_taskInjector = ti;
}
private:
private:
/**
* Returns the string representation of the specified mount type
*/
const char *mountTypeToString(const cta::MountType::Enum mountType) const
throw();
//RAII class for cleaning tape stuff
class TapeCleaning{
TapeReadSingleThread& m_this;
......
......@@ -115,6 +115,19 @@ isTapeWritable() const {
throw ex;
}
}
//-----------------------------------------------------------------------------
// volumeModeToString
//-----------------------------------------------------------------------------
const char *castor::tape::tapeserver::daemon::TapeWriteSingleThread::
mountTypeToString(const cta::MountType::Enum mountType) const throw() {
switch(mountType) {
case cta::MountType::RETRIEVE: return "RETRIEVE";
case cta::MountType::ARCHIVE : return "ARCHIVE";
default : return "UNKNOWN";
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//run
......@@ -138,7 +151,7 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
typedef castor::log::Param Param;
m_watchdog.addParameter(Param("clientType", castor::tape::tapegateway::ClientTypeStrings[m_volInfo.clientType]));
m_watchdog.addParameter(Param("TPVID", m_volInfo.vid));
m_watchdog.addParameter(Param("volumeMode",tapegateway::VolumeModeStrings[m_volInfo.volumeMode]));
m_watchdog.addParameter(Param("mountType", mountTypeToString(m_volInfo.mountType)));
m_watchdog.addParameter(Param("density", m_volInfo.density));
// Set the tape thread time in the watchdog for total time estimation in case
......
......@@ -87,7 +87,14 @@ public:
void setTaskInjector(MigrationTaskInjector* injector){
m_injector = injector;
}
private:
private:
/**
* Returns the string representation of the specified mount type
*/
const char *mountTypeToString(const cta::MountType::Enum mountType) const
throw();
class TapeCleaning{
TapeWriteSingleThread& m_this;
// As we are living in the single thread of tape, we can borrow the timer
......
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