Skip to content
Snippets Groups Projects
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
Branches
Tags
No related merge requests found
......@@ -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);
}
......@@ -94,6 +94,11 @@ namespace cta {
* Report a drive status change
*/
virtual void setDriveStatus(cta::common::DriveStatus status);
/**
* Report that the tape is full.
*/
virtual void setTapeFull();
CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
/**
......
......@@ -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
//------------------------------------------------------------------------------
......
......@@ -70,7 +70,12 @@ public:
* @param compressStats
*
*/
virtual void reportFlush(drive::compressionStats compressStats);
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
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment