Commit a6540da7 authored by Eric Cano's avatar Eric Cano
Browse files

Added passing of reference to TapeMount in TaskWatchDog.

This object (with thread) already reports data movement to the main process, and will
also store it in the object store (interface will be added to TapeMount.
parent 00c7ff0a
......@@ -191,7 +191,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// to refer them to each other)
RecallReportPacker rrp(retrieveMount, lc);
rrp.disableBulk(); //no bulk needed anymore
RecallWatchDog rwd(15,60*10,m_intialProcess,m_driveConfig.unitName,lc);
RecallWatchDog rwd(15,60*10,m_intialProcess,*retrieveMount,m_driveConfig.unitName,lc);
RecallMemoryManager mm(m_castorConf.nbBufs, m_castorConf.bufsz,lc);
TapeServerReporter tsr(m_intialProcess, m_driveConfig,
......@@ -293,7 +293,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
MigrationMemoryManager mm(m_castorConf.nbBufs,
m_castorConf.bufsz,lc);
MigrationReportPacker mrp(archiveMount, lc);
MigrationWatchDog mwd(15,60*10,m_intialProcess,m_driveConfig.unitName,lc);
MigrationWatchDog mwd(15,60*10,m_intialProcess,*archiveMount,m_driveConfig.unitName,lc);
TapeWriteSingleThread twst(*drive,
m_mc,
tsr,
......
......@@ -30,6 +30,7 @@
#include "common/log/StringLogger.hpp"
#include "castor/messages/TapeserverProxyDummy.hpp"
#include "scheduler/ArchiveMount.hpp"
#include "scheduler/TapeMountDummy.hpp"
#include <gtest/gtest.h>
#include <fstream>
......@@ -92,10 +93,10 @@ namespace unitTests{
class MockMigrationWatchDog: public MigrationWatchDog {
public:
MockMigrationWatchDog(double periodToReport,double stuckPeriod,
cta::tape::daemon::TapedProxy& initialProcess,
cta::tape::daemon::TapedProxy& initialProcess, cta::TapeMount & tapeMount,
const std::string & driveUnitName,
cta::log::LogContext lc, double pollPeriod = 0.1):
MigrationWatchDog(periodToReport, stuckPeriod, initialProcess,
MigrationWatchDog(periodToReport, stuckPeriod, initialProcess, tapeMount,
driveUnitName, lc, pollPeriod) {}
private:
......@@ -137,7 +138,8 @@ namespace unitTests{
DiskFileFactory fileFactory("", 0, striperPool);
castor::messages::TapeserverProxyDummy tspd;
MockMigrationWatchDog mmwd(1.0, 1.0, tspd, "", lc);
cta::TapeMountDummy tmd;
MockMigrationWatchDog mmwd(1.0, 1.0, tspd, tmd, "", lc);
drt.execute(lc,fileFactory,mmwd, 0);
ASSERT_EQ(original_checksum,ftwt.getChecksum());
......
......@@ -30,6 +30,7 @@
#include "castor/tape/tapeserver/daemon/MigrationMemoryManager.hpp"
#include "castor/tape/tapeserver/daemon/MemBlock.hpp"
#include "castor/messages/TapeserverProxyDummy.hpp"
#include "scheduler/TapeMountDummy.hpp"
#include "scheduler/Scheduler.hpp"
#include "scheduler/testingMocks/MockRetrieveMount.hpp"
......@@ -123,7 +124,8 @@ namespace unitTests{
t.pushDataBlock(mb);
t.pushDataBlock(NULL);
castor::messages::TapeserverProxyDummy tspd;
RecallWatchDog rwd(1,1,tspd,"", lc);
cta::TapeMountDummy tmd;
RecallWatchDog rwd(1,1,tspd,tmd,"", lc);
t.execute(report,lc,fileFactory,rwd, 0);
ASSERT_EQ(1, report.failedJobs);
}
......
......@@ -29,6 +29,7 @@
#include "castor/tape/tapeserver/daemon/MigrationMemoryManager.hpp"
#include "castor/tape/tapeserver/daemon/MemBlock.hpp"
#include "castor/messages/TapeserverProxyDummy.hpp"
#include "scheduler/TapeMountDummy.hpp"
#include <gtest/gtest.h>
namespace unitTests{
......@@ -103,7 +104,8 @@ namespace unitTests{
RecallMemoryManager mm(10,100,lc);
castor::messages::TapeserverProxyDummy tspd;
RecallWatchDog rwd(1,1,tspd,"", lc);
cta::TapeMountDummy tmd;
RecallWatchDog rwd(1,1,tspd,tmd,"", lc);
DiskWriteThreadPool dwtp(2,report,rwd,lc,"/dev/null", 0);
dwtp.startThreads();
......
......@@ -34,6 +34,7 @@
#include "mediachanger/MediaChangerFacade.hpp"
#include "scheduler/SchedulerDatabase.hpp"
#include "scheduler/testingMocks/MockRetrieveMount.hpp"
#include "scheduler/TapeMountDummy.hpp"
#include <gtest/gtest.h>
......@@ -148,7 +149,8 @@ namespace unitTests
//EXPECT_CALL(trm, internalGetNextJob()).Times(nbJobs+1);
castor::messages::TapeserverProxyDummy tspd;
RecallWatchDog rwd(1,1,tspd,"",lc);
cta::TapeMountDummy tmd;
RecallWatchDog rwd(1,1,tspd,tmd,"",lc);
std::unique_ptr<cta::SchedulerDatabase::RetrieveMount> dbrm(new TestingDatabaseRetrieveMount());
MockRecallReportPacker mrrp(&trm,lc);
FakeDiskWriteThreadPool diskWrite(mrrp,rwd,lc);
......@@ -208,7 +210,8 @@ namespace unitTests
//EXPECT_CALL(trm, internalGetNextJob()).Times(1); //no work: single call to getnextjob
castor::messages::TapeserverProxyDummy tspd;
RecallWatchDog rwd(1,1,tspd,"",lc);
cta::TapeMountDummy tmd;
RecallWatchDog rwd(1,1,tspd,tmd,"",lc);
std::unique_ptr<cta::SchedulerDatabase::RetrieveMount> dbrm(new TestingDatabaseRetrieveMount());
MockRecallReportPacker mrrp(&trm,lc);
FakeDiskWriteThreadPool diskWrite(mrrp,rwd,lc);
......
......@@ -31,6 +31,7 @@
#include "castor/tape/tapeserver/daemon/ReportPackerInterface.hpp"
#include "common/Timer.hpp"
#include "castor/tape/tapeserver/daemon/TapeSessionStats.hpp"
#include "scheduler/TapeMount.hpp"
#include <map>
#include <unistd.h>
......@@ -111,6 +112,12 @@ protected:
*/
cta::tape::daemon::TapedProxy& m_initialProcess;
/**
* Reference to the current mount. Used to report performance statistics to object
* store.
*/
cta::TapeMount & m_mount;
/**
* The drive unit name to report
*/
......@@ -301,11 +308,12 @@ protected:
*/
TaskWatchDog(double reportPeriod,double stuckPeriod,
cta::tape::daemon::TapedProxy& initialProcess,
const std::string & driveUnitName,
cta::TapeMount & mount,
const std::string & driveUnitName,
cta::log::LogContext& lc, double pollPeriod = 0.1):
m_TapeBytesMovedMoved(0), m_statsSet(false), m_pollPeriod(pollPeriod),
m_reportPeriod(reportPeriod), m_stuckPeriod(stuckPeriod),
m_initialProcess(initialProcess), m_driveUnitName(driveUnitName),
m_initialProcess(initialProcess), m_mount(mount), m_driveUnitName(driveUnitName),
m_fileBeingMoved(false), m_lc(lc) {
m_lc.pushOrReplace(cta::log::Param("thread","Watchdog"));
}
......@@ -457,9 +465,10 @@ public:
/** Pass through constructor */
RecallWatchDog(double periodToReport,double stuckPeriod,
cta::tape::daemon::TapedProxy& initialProcess,
cta::TapeMount & mount,
const std::string & driveUnitName,
cta::log::LogContext& lc, double pollPeriod = 0.1):
TaskWatchDog(periodToReport, stuckPeriod, initialProcess, driveUnitName, lc,
TaskWatchDog(periodToReport, stuckPeriod, initialProcess, mount, driveUnitName, lc,
pollPeriod) {}
/**
......@@ -508,9 +517,10 @@ public:
/** Pass through constructor */
MigrationWatchDog(double periodToReport,double stuckPeriod,
cta::tape::daemon::TapedProxy& initialProcess,
cta::TapeMount & mount,
const std::string & driveUnitName,
cta::log::LogContext lc, double pollPeriod = 0.1):
TaskWatchDog(periodToReport, stuckPeriod, initialProcess, driveUnitName, lc,
TaskWatchDog(periodToReport, stuckPeriod, initialProcess, mount, driveUnitName, lc,
pollPeriod) {}
/**
......
......@@ -25,6 +25,7 @@
#include "castor/tape/tapeserver/daemon/ReportPackerInterface.hpp"
#include "castor/messages/TapeserverProxyDummy.hpp"
#include "common/log/StringLogger.hpp"
#include "scheduler/TapeMountDummy.hpp"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
......@@ -43,9 +44,10 @@ TEST(castor_tape_tapeserver_daemon, WatchdogTestStuckWithNothing) {
cta::log::LogContext lc(log);
castor::messages::TapeserverProxyDummy dummyInitialProcess;
cta::TapeMountDummy dummyTapeMount;
tapeserver::daemon::RecallWatchDog watchdog(periodToReport,
stuckPeriod,dummyInitialProcess,"testTapeDrive",lc,pollPeriod);
stuckPeriod,dummyInitialProcess,dummyTapeMount,"testTapeDrive",lc,pollPeriod);
watchdog.startThread();
usleep(100000);
......@@ -64,10 +66,11 @@ TEST(castor_tape_tapeserver_daemon, MigrationWatchdogTestStuck) {
cta::log::LogContext lc(log);
castor::messages::TapeserverProxyDummy dummyInitialProcess;
cta::TapeMountDummy dummyTapeMount;
// We will poll for a
tapeserver::daemon::MigrationWatchDog watchdog(reportPeriod,stuckPeriod,
dummyInitialProcess,"testTapeDrive", lc, pollPeriod);
dummyInitialProcess, dummyTapeMount, "testTapeDrive", lc, pollPeriod);
watchdog.startThread();
watchdog.notifyBeginNewJob(64, 64);
......
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