Commit 8f8a17a0 authored by Eric Cano's avatar Eric Cano
Browse files

Ported DataTransferSessionTest unit test...

Ported DataTransferSessionTest unit test DataTransferSessionMissingFilesMigration and DataTransferSessionTapeFullMigration.

Also fixed tapes not being set to full when reaching end of tape.
parent ff064228
......@@ -132,3 +132,11 @@ cta::ArchiveMount::~ArchiveMount() throw() {
void cta::ArchiveMount::setDriveStatus(cta::common::DriveStatus status) {
m_dbMount->setDriveStatus(status, time(NULL));
}
//------------------------------------------------------------------------------
// setTapeFull()
//------------------------------------------------------------------------------
void cta::ArchiveMount::setTapeFull() {
m_catalogue.noSpaceLeftOnTape(m_dbMount->getMountInfo().vid);
}
......@@ -95,6 +95,11 @@ namespace cta {
*/
virtual void setDriveStatus(cta::common::DriveStatus status);
/**
* Report that the tape is full.
*/
virtual void setTapeFull();
CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
/**
* Job factory
......
......@@ -82,6 +82,13 @@ void MigrationReportPacker::reportFlush(drive::compressionStats compressStats){
m_fifo.push(new ReportFlush(compressStats));
}
//------------------------------------------------------------------------------
//reportTapeFull
//------------------------------------------------------------------------------
void MigrationReportPacker::reportTapeFull(){
castor::server::MutexLocker ml(&m_producterProtection);
m_fifo.push(new ReportTapeFull());
}
//------------------------------------------------------------------------------
//reportEndOfSession
//------------------------------------------------------------------------------
void MigrationReportPacker::reportEndOfSession() {
......@@ -185,6 +192,13 @@ void MigrationReportPacker::ReportFlush::execute(MigrationReportPacker& reportPa
}
}
//------------------------------------------------------------------------------
//reportTapeFull()::execute
//------------------------------------------------------------------------------
void MigrationReportPacker::ReportTapeFull::execute(MigrationReportPacker& reportPacker){
reportPacker.m_archiveMount->setTapeFull();
}
//------------------------------------------------------------------------------
//ReportEndofSession::execute
//------------------------------------------------------------------------------
......
......@@ -72,6 +72,11 @@ public:
*/
virtual void reportFlush(drive::compressionStats compressStats);
/**
* Create into the MigrationReportPacker a report of reaching the end of the tape.
*/
virtual void reportTapeFull();
/**
* Report the drive state and set it in the central drive register. This
* function is to be used by the tape thread when running.
......@@ -148,6 +153,11 @@ private:
void execute(MigrationReportPacker& reportPacker);
};
class ReportTapeFull: public Report {
public:
ReportTapeFull() {}
void execute(MigrationReportPacker& reportPacker);
};
class ReportError : public Report {
const castor::exception::Exception m_ex;
......
......@@ -173,6 +173,7 @@ namespace daemon {
}
// This is indeed the end of the tape. Not an error.
watchdog.setErrorCount("Info_tapeFilledUp",1);
reportPacker.reportTapeFull();
} catch (...) {
// The error is not an ENOSPC, so it is, indeed, an error.
// If we got here with a new error, currentErrorToCount will be non-empty,
......
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