Commit af3658cb authored by Daniele Kruse's avatar Daniele Kruse
Browse files

More work was needed to finalize status reporting

parent b15aa7f1
......@@ -135,7 +135,10 @@ void MigrationReportPacker::reportDriveStatus(cta::DriveStatus status) {
//------------------------------------------------------------------------------
void MigrationReportPacker::ReportDriveStatus::execute(MigrationReportPacker& parent){
parent.m_archiveMount->setDriveStatus(m_status);
if(m_status==cta::DriveStatus::Unmounting) parent.m_continue=false;
if(m_status==cta::DriveStatus::Unmounting) {
parent.m_continue=false;
parent.m_archiveMount->complete();
}
}
//------------------------------------------------------------------------------
......@@ -181,7 +184,6 @@ void MigrationReportPacker::ReportFlush::execute(MigrationReportPacker& reportPa
//------------------------------------------------------------------------------
void MigrationReportPacker::ReportEndofSession::execute(MigrationReportPacker& reportPacker){
if(!reportPacker.m_errorHappened){
reportPacker.m_archiveMount->complete();
log::ScopedParamContainer sp(reportPacker.m_lc);
reportPacker.m_lc.log(LOG_INFO,"Reported end of session to client");
if(reportPacker.m_watchdog) {
......@@ -194,7 +196,6 @@ void MigrationReportPacker::ReportEndofSession::execute(MigrationReportPacker& r
}
else {
// We have some errors
reportPacker.m_archiveMount->complete();
log::ScopedParamContainer sp(reportPacker.m_lc);
sp.add("errorMessage", "Previous file errors")
.add("errorCode", SEINTERNAL);
......@@ -214,7 +215,6 @@ void MigrationReportPacker::ReportEndofSession::execute(MigrationReportPacker& r
//------------------------------------------------------------------------------
void MigrationReportPacker::ReportEndofSessionWithErrors::execute(MigrationReportPacker& reportPacker){
if(reportPacker.m_errorHappened) {
reportPacker.m_archiveMount->complete();
log::ScopedParamContainer sp(reportPacker.m_lc);
sp.add("errorMessage", m_message)
.add("errorCode", m_errorCode);
......@@ -226,7 +226,6 @@ void MigrationReportPacker::ReportEndofSessionWithErrors::execute(MigrationRepor
if (ENOSPC != m_errorCode) {
m_errorCode = SEINTERNAL;
}
reportPacker.m_archiveMount->complete();
reportPacker.m_lc.log(LOG_INFO,msg);
}
if(reportPacker.m_watchdog) {
......@@ -267,7 +266,6 @@ void MigrationReportPacker::WorkerThread::run(){
catch(const failedMigrationRecallResult& e){
//here we catch a failed report MigrationResult. We try to close and if that fails too
//we end up in the catch below
m_parent.m_archiveMount->complete();
m_parent.m_lc.log(LOG_INFO,"Successfully closed client's session after the failed report MigrationResult");
if (m_parent.m_watchdog) {
m_parent.m_watchdog->addToErrorCount("Error_clientCommunication");
......
......@@ -125,7 +125,7 @@ private:
class ReportTestGoingToEnd : public Report {
public:
ReportTestGoingToEnd() {}
virtual void execute(MigrationReportPacker& reportPacker) {reportPacker.m_continue=false;}
virtual void execute(MigrationReportPacker& reportPacker) {reportPacker.m_continue=false;reportPacker.m_archiveMount->complete();}
};
class ReportDriveStatus : public Report {
......
......@@ -121,8 +121,6 @@ void RecallReportPacker::ReportSuccessful::execute(RecallReportPacker& parent){
//------------------------------------------------------------------------------
void RecallReportPacker::ReportEndofSession::execute(RecallReportPacker& parent){
if(!parent.errorHappened()){
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
parent.m_lc.log(LOG_INFO,"Nominal RecallReportPacker::EndofSession has been reported");
if (parent.m_watchdog) {
parent.m_watchdog->addParameter(log::Param("status","success"));
......@@ -135,8 +133,6 @@ void RecallReportPacker::ReportEndofSession::execute(RecallReportPacker& parent)
else {
const std::string& msg ="RecallReportPacker::EndofSession has been reported but an error happened somewhere in the process";
parent.m_lc.log(LOG_ERR,msg);
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
if (parent.m_watchdog) {
parent.m_watchdog->addParameter(log::Param("status","failure"));
// We have a race condition here between the processing of this message by
......@@ -159,6 +155,10 @@ bool RecallReportPacker::ReportEndofSession::goingToEnd(RecallReportPacker& pack
//------------------------------------------------------------------------------
void RecallReportPacker::ReportDriveStatus::execute(RecallReportPacker& parent){
parent.m_retrieveMount->setDriveStatus(m_status);
if(m_status==cta::DriveStatus::Unmounting) {
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
}
}
//------------------------------------------------------------------------------
......@@ -174,16 +174,12 @@ bool RecallReportPacker::ReportDriveStatus::goingToEnd(RecallReportPacker& packe
//------------------------------------------------------------------------------
void RecallReportPacker::ReportEndofSessionWithErrors::execute(RecallReportPacker& parent){
if(parent.m_errorHappened) {
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
LogContext::ScopedParam(parent.m_lc,Param("errorCode",m_error_code));
parent.m_lc.log(LOG_ERR,m_message);
}
else{
const std::string& msg ="RecallReportPacker::EndofSessionWithErrors has been reported but NO error was detected during the process";
parent.m_lc.log(LOG_ERR,msg);
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
parent.m_lc.log(LOG_ERR,msg);
}
if (parent.m_watchdog) {
parent.m_watchdog->addParameter(log::Param("status","failure"));
......
......@@ -130,7 +130,9 @@ private:
class ReportTestGoingToEnd : public Report {
public:
ReportTestGoingToEnd() {}
virtual void execute(RecallReportPacker& reportPacker) {}
virtual void execute(RecallReportPacker& reportPacker) {
reportPacker.m_retrieveMount->diskComplete();
reportPacker.m_retrieveMount->tapeComplete();}
virtual bool goingToEnd(RecallReportPacker& packer) {return true;}
};
class ReportSuccessful : public Report {
......
......@@ -88,6 +88,7 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeCleaning::~TapeClean
currentErrorToCount = "Error_tapeDismount";
m_this.m_rrp.reportDriveStatus(cta::DriveStatus::Unmounting);
m_this.m_mc.dismountTape(m_this.m_volInfo.vid, m_this.m_drive.config.getLibrarySlot());
m_this.m_rrp.reportDriveStatus(cta::DriveStatus::Up);
m_this.m_stats.unmountTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_logContext.log(LOG_INFO, mediachanger::TAPE_LIBRARY_TYPE_MANUAL != m_this.m_drive.config.getLibrarySlot().getLibraryType() ?
"TapeReadSingleThread : tape unmounted":"TapeReadSingleThread : tape NOT unmounted (manual mode)");
......
......@@ -140,6 +140,7 @@ private:
currentErrorToCount = "Error_tapeDismount";
m_this.m_reportPacker.reportDriveStatus(cta::DriveStatus::Unmounting);
m_this.m_mc.dismountTape(m_this.m_volInfo.vid, m_this.m_drive.config.getLibrarySlot());
m_this.m_reportPacker.reportDriveStatus(cta::DriveStatus::Up);
m_this.m_stats.unmountTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_logContext.log(LOG_INFO, mediachanger::TAPE_LIBRARY_TYPE_MANUAL != m_this.m_drive.config.getLibrarySlot().getLibraryType() ?
"TapeWriteSingleThread : tape unmounted":"TapeWriteSingleThread : tape NOT unmounted (manual mode)");
......
......@@ -304,4 +304,16 @@
fun:_ZN6castor6server6Thread14pthread_runnerEPv
fun:start_thread
fun:clone
}
{
recall_packer_4
Memcheck:Leak
fun:_Znwm
fun:_ZN6castor4tape10tapeserver6daemon18RecallReportPacker17reportDriveStatusEN3cta11DriveStatusE
fun:_ZN6castor4tape10tapeserver6daemon20TapeReadSingleThread12TapeCleaningD1Ev
fun:_ZN6castor4tape10tapeserver6daemon20TapeReadSingleThread3runEv
fun:_ZN6castor6server6Thread14pthread_runnerEPv
fun:start_thread
fun:clone
}
\ No newline at end of file
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