Commit 51d884d7 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

"Adding log in read / write start and finish session. These logs does not contain the real values

of VO and Density"
parent 8cb9319d
......@@ -68,6 +68,20 @@ std::string cta::ArchiveMount::getPoolName() const {
return m_dbMount->mountInfo.tapePool;
}
//------------------------------------------------------------------------------
// getVo
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getVo() const {
return "Alice";//m_dbMount->mountInfo.vo;
}
//------------------------------------------------------------------------------
// getVo
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getDensity() const{
return "8000GC";//m_dbMount->mountInfo.density;
}
//------------------------------------------------------------------------------
// getNbFiles
//------------------------------------------------------------------------------
......
......@@ -141,6 +141,18 @@ namespace cta {
*/
std::string getPoolName() const;
/**
* Returns the virtual organization of the tape to be mounted
* @return the vo of the tape to be mounted
*/
std::string getVo() const;
/**
* Returns the density (e.g : 8000GC) of the tape to be mounted
* @return the density of the tape to be mounted
*/
std::string getDensity() const;
/**
* Returns the mount transaction id.
*
......
......@@ -66,6 +66,38 @@ std::string cta::RetrieveMount::getMountTransactionId() const{
return id.str();
}
//------------------------------------------------------------------------------
// getMountTapePool()
//------------------------------------------------------------------------------
std::string cta::RetrieveMount::getPoolName() const{
std::stringstream sTapePool;
if (!m_dbMount.get())
throw exception::Exception("In cta::RetrieveMount::getPoolName(): got NULL dbMount");
sTapePool << m_dbMount->mountInfo.tapePool;
return sTapePool.str();
}
//------------------------------------------------------------------------------
// getVo()
//------------------------------------------------------------------------------
std::string cta::RetrieveMount::getVo() const
{
std::stringstream sVo;
if(!m_dbMount.get())
throw exception::Exception("In cta::RetrieveMount::getVo(): got NULL dbMount");
sVo<<"Alice";//m_dbMount->mountInfo.vo;
return sVo.str();
}
std::string cta::RetrieveMount::getDensity() const
{
std::stringstream sDensity;
if(!m_dbMount.get())
throw exception::Exception("In cta::RetrieveMount::getDensity(): got NULL dbMount");
sDensity<<"8000GC";//m_dbMount->mountInfo.density;
return sDensity.str();
}
//------------------------------------------------------------------------------
// getNextJobBatch()
//------------------------------------------------------------------------------
......
......@@ -83,6 +83,25 @@ namespace cta {
*/
uint32_t getNbFiles() const override;
/**
* Returns the tape pool of the tape to be mounted
* @return The tape pool of the tape to be mounted
*/
std::string getPoolName() const;
/**
* Returns the virtual organization in which the tape
* belongs
* @return the vo in which the tape belongs
*/
std::string getVo() const;
/**
* Returns the density (e.g : 8000GC) of the tape
* @return de density of the tape
*/
std::string getDensity() const;
/**
* Report a drive status change
*/
......
......@@ -851,6 +851,7 @@ std::unique_ptr<TapeMount> Scheduler::getNextMount(const std::string &logicalLib
} catch (...) {}
schedulerDbTime = getMountInfoTime + queueTrimingTime + mountCreationTime + driveStatusSetTime;
catalogueTime = getTapeInfoTime + getTapeForWriteTime;
params.add("tapepool", m->tapePool)
.add("vid", t.vid)
.add("mountType", common::dataStructures::toString(m->type))
......
......@@ -144,6 +144,8 @@ public:
std::string vid;
std::string logicalLibrary;
std::string tapePool;
std::string vo;
std::string density;
std::string drive;
std::string host;
uint64_t mountId;
......@@ -298,6 +300,8 @@ public:
std::string vid;
std::string logicalLibrary;
std::string tapePool;
std::string vo;
std::string density;
std::string drive;
std::string host;
uint64_t mountId;
......
......@@ -59,6 +59,10 @@ namespace cta {
* @return The mount transaction id.
*/
virtual uint32_t getNbFiles() const = 0;
virtual std::string getVo() const = 0;
virtual std::string getDensity() const = 0;
/**
* Indicates that the mount was aborted.
......
......@@ -41,6 +41,13 @@ class TapeMountDummy: public TapeMount {
std::string getVid() const override {
throw exception::Exception("In DummyTapeMount::getNbFiles() : not implemented");
}
std::string getVo() const override{
throw exception::Exception("In DummyTapeMount::getVo() : not implemented");
}
std::string getDensity() const override {
throw exception::Exception("In DummyTapeMount::getDensity() : not implemented");
}
void setDriveStatus(cta::common::dataStructures::DriveStatus status) override {}
void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override {};
};
......
......@@ -233,7 +233,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
TapeReadSingleThread trst(*drive, m_mc, tsr, m_volInfo,
m_castorConf.bulkRequestRecallMaxFiles,m_capUtils,rwd,lc,rrp,
m_castorConf.useLbp, m_castorConf.useRAO, m_castorConf.externalEncryptionKeyScript);
m_castorConf.useLbp, m_castorConf.useRAO, m_castorConf.externalEncryptionKeyScript,*retrieveMount);
DiskWriteThreadPool dwtp(m_castorConf.nbDiskThreads,
rrp,
rwd,
......@@ -315,7 +315,6 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
if (!drive.get()) return MARK_DRIVE_AS_UP;
// Once we got hold of the drive, we can run the session
{
//dereferencing configLine is safe, because if configLine were not valid,
//then findDrive would have return NULL and we would have not end up there
TapeServerReporter tsr(m_intialProcess, m_driveConfig, m_hostname,m_volInfo,lc);
......@@ -335,7 +334,9 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
m_castorConf.maxFilesBeforeFlush,
m_castorConf.maxBytesBeforeFlush,
m_castorConf.useLbp,
m_castorConf.externalEncryptionKeyScript);
m_castorConf.externalEncryptionKeyScript,
*archiveMount);
DiskReadThreadPool drtp(m_castorConf.nbDiskThreads,
m_castorConf.bulkRequestMigrationMaxFiles,
m_castorConf.bulkRequestMigrationMaxBytes,
......
......@@ -503,6 +503,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) {
// 10) Check logs
std::string logToCheck = logger.getLog();
logToCheck += "";
std::cout<<"log to check = "<<logToCheck;
ASSERT_NE(std::string::npos, logToCheck.find("firmwareVersion=\"123A\" serialNumber=\"123456\" "
"mountTotalCorrectedReadErrors=\"5\" mountTotalReadBytesProcessed=\"4096\" "
"mountTotalUncorrectedReadErrors=\"1\" mountTotalNonMediumErrorCounts=\"2\""));
......@@ -1686,6 +1687,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) {
// Check logs for drive statistics
std::string logToCheck = logger.getLog();
logToCheck += "";
std::cout<<logToCheck<<std::endl;
ASSERT_NE(std::string::npos, logToCheck.find("firmwareVersion=\"123A\" serialNumber=\"123456\" "
"mountTotalCorrectedWriteErrors=\"5\" mountTotalUncorrectedWriteErrors=\"1\" "
"mountTotalWriteBytesProcessed=\"4096\" mountTotalNonMediumErrorCounts=\"2\""));
......
......@@ -37,14 +37,16 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeReadSingleThread(
RecallReportPacker &rrp,
const bool useLbp,
const bool useRAO,
const std::string & externalEncryptionKeyScript) :
const std::string & externalEncryptionKeyScript,
const cta::RetrieveMount& retrieveMount) :
TapeSingleThreadInterface<TapeReadTask>(drive, mc, initialProcess, volInfo,
capUtils, lc, externalEncryptionKeyScript),
m_maxFilesRequest(maxFilesRequest),
m_watchdog(watchdog),
m_rrp(rrp),
m_useLbp(useLbp),
m_useRAO(useRAO) {}
m_useRAO(useRAO),
m_retrieveMount(retrieveMount){}
//------------------------------------------------------------------------------
//TapeCleaning::~TapeCleaning()
......@@ -175,6 +177,11 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::openReadSession() {
try{
std::unique_ptr<castor::tape::tapeFile::ReadSession> rs(
new castor::tape::tapeFile::ReadSession(m_drive,m_volInfo, m_useLbp));
cta::log::ScopedParamContainer params(m_logContext);
params.add("vo",m_retrieveMount.getVo());
params.add("capacity",m_retrieveMount.getDensity());
params.add("tapePoolName",m_retrieveMount.getPoolName());
params.add("dgn",m_drive.config.logicalLibrary);
m_logContext.log(cta::log::DEBUG, "Created tapeFile::ReadSession with success");
return rs;
......@@ -329,6 +336,10 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
// The session completed successfully, and the cleaner (unmount) executed
// at the end of the previous block. Log the results.
cta::log::ScopedParamContainer params(m_logContext);
params.add("vo",m_retrieveMount.getVo());
params.add("capacity",m_retrieveMount.getDensity());
params.add("tapePoolName",m_retrieveMount.getPoolName());
params.add("dgn",m_drive.config.logicalLibrary);
params.add("status", "success");
m_stats.totalTime = totalTimer.secs();
logWithStat(cta::log::INFO, "Tape thread complete",
......
......@@ -68,7 +68,8 @@ public:
RecallReportPacker &rrp,
const bool useLbp,
const bool useRAO,
const std::string & externalEncryptionKeyScript);
const std::string & externalEncryptionKeyScript,
const cta::RetrieveMount &retrieveMount);
/**
* Set the task injector. Has to be done that way (and not in the constructor)
......@@ -152,11 +153,18 @@ private:
* Access Order
*/
bool m_useRAO;
/**
* The retrieve mount object to get the VO, the tape pool and the density of the tape
* on which we are reading
*/
const cta::RetrieveMount& m_retrieveMount;
/// Helper virtual function to access the watchdog from parent class
virtual void countTapeLogError(const std::string & error) {
m_watchdog.addToErrorCount(error);
}
protected:
/**
* Logs SCSI metrics for read session.
......
......@@ -37,7 +37,8 @@ castor::tape::tapeserver::drive::DriveInterface & drive,
MigrationReportPacker & repPacker,
cta::server::ProcessCap &capUtils,
uint64_t filesBeforeFlush, uint64_t bytesBeforeFlush,
const bool useLbp, const std::string & externalEncryptionKeyScript):
const bool useLbp, const std::string & externalEncryptionKeyScript,
const cta::ArchiveMount & archiveMount):
TapeSingleThreadInterface<TapeWriteTask>(drive, mc, tsr, volInfo,
capUtils, lc, externalEncryptionKeyScript),
m_filesBeforeFlush(filesBeforeFlush),
......@@ -47,7 +48,8 @@ castor::tape::tapeserver::drive::DriveInterface & drive,
m_lastFseq(-1),
m_compress(true),
m_useLbp(useLbp),
m_watchdog(mwd){}
m_watchdog(mwd),
m_archiveMount(archiveMount){}
//------------------------------------------------------------------------------
//TapeCleaning::~TapeCleaning()
......@@ -163,7 +165,7 @@ castor::tape::tapeserver::daemon::TapeWriteSingleThread::openWriteSession() {
ScopedParam sp[]={
ScopedParam(m_logContext, Param("lastFseq", m_lastFseq)),
ScopedParam(m_logContext, Param("compression", m_compress)),
ScopedParam(m_logContext, Param("useLbp", m_useLbp))
ScopedParam(m_logContext, Param("useLbp", m_useLbp)),
};
tape::utils::suppresUnusedVariable(sp);
try {
......@@ -171,6 +173,11 @@ castor::tape::tapeserver::daemon::TapeWriteSingleThread::openWriteSession() {
new castor::tape::tapeFile::WriteSession(m_drive, m_volInfo, m_lastFseq,
m_compress, m_useLbp)
);
cta::log::ScopedParamContainer params(m_logContext);
params.add("vo",m_archiveMount.getVo());
params.add("capacity",m_archiveMount.getDensity());
params.add("tapePoolName",m_archiveMount.getPoolName());
params.add("dgn",m_drive.config.logicalLibrary);
m_logContext.log(cta::log::INFO, "Tape Write session session successfully started");
}
catch (cta::exception::Exception & e) {
......
......@@ -69,7 +69,8 @@ public:
MigrationReportPacker & repPacker,
cta::server::ProcessCap &capUtils,
uint64_t filesBeforeFlush, uint64_t bytesBeforeFlush, const bool useLbp,
const std::string & externalEncryptionKeyScript);
const std::string & externalEncryptionKeyScript,
const cta::ArchiveMount & archiveMount);
/**
*
......@@ -189,6 +190,13 @@ private:
*/
MigrationWatchDog & m_watchdog;
/**
* Reference to the archive mount object that
* stores the virtual organization (vo) of the tape, the tape pool in which the tape is
* and the density of the tape
*/
const cta::ArchiveMount & m_archiveMount;
protected:
/***
* Helper virtual function to access the watchdog from parent class
......
......@@ -1080,7 +1080,6 @@ int DriveHandler::runChild() {
return castor::tape::tapeserver::daemon::Session::MARK_DRIVE_AS_DOWN;
}
}
castor::tape::tapeserver::daemon::DataTransferSession dataTransferSession(
cta::utils::getShortHostname(),
lc.logger(),
......
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