diff --git a/scheduler/ArchiveMount.cpp b/scheduler/ArchiveMount.cpp index 8653b35c48a91636376ed347c361b1f245b94a1f..15062002ca7123db2a8f8b0c14c2349da3ae6c94 100644 --- a/scheduler/ArchiveMount.cpp +++ b/scheduler/ArchiveMount.cpp @@ -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 //------------------------------------------------------------------------------ diff --git a/scheduler/ArchiveMount.hpp b/scheduler/ArchiveMount.hpp index a74d1a62e6cdc9f673bba9427c5beec24fbb46a0..8d7c29c1ef9dc1775b9c919a25c77a9932fef828 100644 --- a/scheduler/ArchiveMount.hpp +++ b/scheduler/ArchiveMount.hpp @@ -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. * diff --git a/scheduler/RetrieveMount.cpp b/scheduler/RetrieveMount.cpp index 42f852a69dfe0c132ddb1347d3e0dd483618de07..fa0393eb7d039ca5604637bac756f41f9330e84e 100644 --- a/scheduler/RetrieveMount.cpp +++ b/scheduler/RetrieveMount.cpp @@ -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() //------------------------------------------------------------------------------ diff --git a/scheduler/RetrieveMount.hpp b/scheduler/RetrieveMount.hpp index 3505542bf09cc0b1d109ba3f899a5eaf8a0a30aa..c90efa65ff4ff74fd502764cee4590fbf9300c48 100644 --- a/scheduler/RetrieveMount.hpp +++ b/scheduler/RetrieveMount.hpp @@ -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 */ diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index 851a72538d0e78966185e96b679672b26215391e..751d8de11bd622f9e92efd85d5c528e36a65af31 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -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)) diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp index 5bbc23ee71cbc0d0e0c753e3b1803c25e78dc7f4..d804d9079f03bbc9a5fa4342b9348d2ecad723a7 100644 --- a/scheduler/SchedulerDatabase.hpp +++ b/scheduler/SchedulerDatabase.hpp @@ -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; diff --git a/scheduler/TapeMount.hpp b/scheduler/TapeMount.hpp index 61a0eda6c8b8ad1d43af840632372009e9119a8a..b00a0d86e9375b4959258f9ee253b965e838fd95 100644 --- a/scheduler/TapeMount.hpp +++ b/scheduler/TapeMount.hpp @@ -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. diff --git a/scheduler/TapeMountDummy.hpp b/scheduler/TapeMountDummy.hpp index c2b6b38e251303e3233b186fd95bb71b343506ce..925ee3e824d04ac3d613f5648abd4d8613f5f807 100644 --- a/scheduler/TapeMountDummy.hpp +++ b/scheduler/TapeMountDummy.hpp @@ -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 {}; }; diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp index bf4b996c19b1a3a0c3ace6a8c8821df7db30aa12..1df1baa44739e804246ba5e178686c478f6e567f 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp @@ -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, diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp index 099b201fdf1d5411124f6765b7fe949fee9966e3..71e3cd00617ba075509a4440e8ff645d9d52e3c9 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp @@ -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\"")); diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp b/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp index 0de8c39fb2a1662790336f6980249f6471d73b77..7025bce15d1b8b4d9c7422cce024f49d805a42a1 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp @@ -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", diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp b/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp index f686faa39c849380e6c3a2c97f937255717d94f3..71bc25db508ecca6d0626f3246a27cf88f653d69 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp @@ -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. diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp index cf7a9e12c0facf38bb6faf75a4423fe9db2a04ba..3f21154796c930b610d68996d2c3b84f8c588083 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp @@ -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) { diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp index 9cdcc841e0283db3e4ae7ae0f9ac4a02279d7d8d..b92622b979adfc0ffa699b8a4bba4f2bdeb245ef 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp @@ -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 diff --git a/tapeserver/daemon/DriveHandler.cpp b/tapeserver/daemon/DriveHandler.cpp index b81e37be3719616c88b87beb2b2188ec50cfc662..2e32f5e205ea1655689add464e0a5622089a4563 100644 --- a/tapeserver/daemon/DriveHandler.cpp +++ b/tapeserver/daemon/DriveHandler.cpp @@ -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(),