i_RedundantCopyJob_i Class Reference
[Partition Manager]

#include <i_redundantcopyjob_impl.h>

Inheritance diagram for i_RedundantCopyJob_i:

Inheritance graph
[legend]
Collaboration diagram for i_RedundantCopyJob_i:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 25 of file i_redundantcopyjob_impl.h.


Public Member Functions

 i_RedundantCopyJob_i (pm_JobMgr &a_jobMgr, i_PartitionManager_i &a_iPM, string a_barcode, const i_VolNumList_t &a_volumes,::CORBA::Boolean a_best_effort, i_UIMessageServer_ptr a_uims)
virtual ~i_RedundantCopyJob_i ()
void MediumOperationComplete (i_Index_t a_beaNum, i_CompletionStatus_e a_status)
i_FileLocationDataList_tGetNextRecallSet ()
void CompleteJob (i_CompletionStatus_e a_status)
void GetNewResources (i_Index_t a_resNum)

Public Attributes

 log_CLASSID_m

Protected Member Functions

void ReadSourceData ()
void Execute ()
virtual i_FSC_ptr GetFSC ()
virtual i_JobRequestList_tGetFiles ()

Protected Attributes

i_PartitionManager_im_iPM
string m_barcode
i_Medium_t m_medium
i_MediumVolSeq_t m_mv
i_MediaPool_t m_pool
bool m_best_effort
UInt32_t m_currentMedium
bool m_ccAllVol
vector< UInt32_tm_ccVol
vector< pm_VolStatusm_medStatus_v
vector< UInt32_tm_unavailFilesPerVol
ui_MsgWriter m_ui

Private Member Functions

bool Prepare ()
bool RecallFiles (pm_VolStatus &vol, UInt64_t a_dBuffSize)
void MigrateFiles (pm_VolStatus &vol)
void SetResourceBusyStatus (i_Index_t a_resNum, i_ResourceBusy_e a_resStatus)

Constructor & Destructor Documentation

i_RedundantCopyJob_i::i_RedundantCopyJob_i ( pm_JobMgr a_jobMgr,
i_PartitionManager_i a_iPM,
string  a_barcode,
const i_VolNumList_t a_volumes,
::CORBA::Boolean  a_best_effort,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 42 of file i_redundantcopyjob_impl.cpp.

References i_Medium_t::barcode, i_Medium_t::blockSize, i_Resource_t::blockSize, i_JobParams::bufId, rm_String::cvalue_p, dbg_LOW, dbg_NORM, ui_MsgWriter::DisplayMessage(), ui_MsgWriter::DisplayWarning(), i_Job_i::GetResources(), ie_FATAL_ERROR, i_Job_i::InitBeaStatus(), ipc_EXEC_m, ivd_Error, i_JobParams::jobID, i_JobParams::jobPriority, i_JobParams::jobType, jt_MAINT, log_DBG_m, log_FUNC_m, ipc_Log::LogResources(), i_Job_i::m_activeBeas, m_barcode, m_ccAllVol, m_ccVol, i_PartitionManager_i::m_config, i_Job_i::m_iJobParams, m_iPM, i_PartitionManager_i::m_iRM, m_medium, m_mv, m_pool, i_Job_i::m_rm, i_PartitionManager_i::m_rmPart, m_ui, i_MediaPool_t::mediaFamily, i_MediaPool_t::mediaPoolKey, i_MediaPool_t::mediaPoolName, i_Medium_t::mediaPoolName, i_MediaPool_t::mediaPoolType, i_Resource_t::mediumFamily, i_Medium_t::mediumKey, cfg_PMCfg::migrationPriority, cfg_PMCfg::name, rm_Partition::partitionUUIDString, i_JobParams::partName, i_JobParams::partUUID, i_Resource_t::poolKey, i_Resource_t::poolName, i_Resource_t::poolType, i_Resource_t::poolUUID, i_MediaPool_t::poolUUIDString, i_Resource_t::resNum, ipc_Init::ResourceInit(), i_Job_i::SetResources(), and vt_SYSTEM_VOLUME.

00048     : i_Job_i(a_jobMgr, true),
00049       m_iPM(a_iPM),
00050       m_barcode(a_barcode),
00051       m_currentMedium(0),
00052       m_ccAllVol(a_volumes.length() == 0),
00053       m_best_effort(a_best_effort),
00054       m_ui(a_uims)
00055 {
00056     log_FUNC_m(i_RedundantCopyJob_i);
00057     m_iJobParams.jobPriority = m_iPM.m_config.migrationPriority;
00058     m_iJobParams.partName = CORBA::string_dup(m_iPM.m_config.name.c_str());
00059     m_iJobParams.partUUID =
00060         CORBA::string_dup(m_iPM.m_rmPart.partitionUUIDString.cvalue_p);
00061     m_iJobParams.jobType  = jt_MAINT;
00062     m_iJobParams.bufId    = m_iJobParams.jobID;
00063 
00064 
00065     //select medium
00066     ipc_EXEC_m(
00067         i_Medium_t_var med = m_iPM.m_iRM->SelectMedium(m_barcode.c_str());
00068         m_medium = med;
00069     );
00070 
00071 
00072     ipc_EXEC_m(
00073         //select all volumes
00074         i_MediumVolSeq_t_var mv = m_rm->SelectAllMediumVolByBarcode(m_medium.barcode);
00075 
00076         log_DBG_m(dbg_LOW, "mv->length(): " << mv->length());
00077 
00078         if (m_ccAllVol) {
00079             for (UInt32_t i(0); i < mv->length(); i++){
00080                 log_DBG_m(dbg_LOW, "Volume: " << mv[i].medVolNr);
00081 
00082                 if (mv[i].volType != vt_SYSTEM_VOLUME){
00083                     m_ccVol.push_back(mv[i].medVolNr);
00084                     m_mv.length(m_mv.length()+1);
00085                     m_mv[m_mv.length()-1] = mv[i];
00086                 }
00087             }
00088         } else {
00089             for (UInt32_t i(0); i < a_volumes.length(); i++){
00090                 log_DBG_m(dbg_LOW,  "i: " << i <<
00091                                     " a_volumes.length(): " << a_volumes.length());
00092                 log_DBG_m(dbg_LOW, "Volume: " << a_volumes[i]);
00093 
00094                 UInt32_t j(0);
00095                 bool found(false);
00096                 for (; j < mv->length(); j++){
00097                     log_DBG_m(dbg_LOW, "j: " << j);
00098                     if ((Int32_t)a_volumes[i] == mv[j].medVolNr) {
00099                         found = true;
00100                         break;
00101                     }
00102                 }
00103                 if (found){
00104                     if (mv[j].volType != vt_SYSTEM_VOLUME){
00105                         log_DBG_m(dbg_LOW, "Not sysVol");
00106                         m_ccVol.push_back(a_volumes[i]);
00107                         m_mv.length(m_mv.length()+1);
00108                         m_mv[m_mv.length()-1] = mv[j];
00109                         log_DBG_m(dbg_LOW, "m_mv.length()" << m_mv.length());
00110                         log_DBG_m(dbg_LOW, "m_ccVol.size()" << m_ccVol.size());
00111 
00112                     } else {
00113                         ostringstream msg;
00114                         msg << "Volume " << a_volumes[i] << " is a system volume. Skipping...";
00115                         m_ui.DisplayWarning(msg.str());
00116                     }
00117                 } else {
00118                     ostringstream msg;
00119                     msg << "Volume " << a_volumes[i] << " does not exist.";
00120                     m_ui.DisplayWarning(msg.str());
00121                 }
00122             }
00123         }
00124     );
00125 
00126     sort(m_ccVol.begin(), m_ccVol.end());
00127 
00128     //check
00129     if (m_ccVol.size() != m_mv.length())
00130         throw ivd_Error(ie_FATAL_ERROR, "Volume list sizes do not mach");
00131 
00132 
00133     //select pool
00134     ipc_EXEC_m(
00135         i_MediaPool_t_var pool =
00136             m_iPM.m_iRM->SelectMediaPool(m_medium.mediaPoolName);
00137         m_pool = pool;
00138     );
00139 
00140     //set resources
00141     i_ResourceList_t resources;
00142     ipc_EXEC_m(
00143         resources.length(2);
00144         //2 because for redundant one source resource and one
00145         // target resource we be used at one point in time
00146     );
00147     m_activeBeas.resize(2);
00148     InitBeaStatus(2);
00149 
00150     // for each resource prepare row
00151     for (UInt32_t i(0); i < 2; i++){
00152         i_Resource_t &allocRow = resources[i];
00153         //ResourceInit sets all members to 0 or to ipc_nilStr
00154         ipc_Init::ResourceInit(allocRow);
00155         allocRow.resNum = i;
00156         allocRow.poolKey        = m_pool.mediaPoolKey;
00157         allocRow.poolUUID       = m_pool.poolUUIDString;
00158         allocRow.poolName       = m_pool.mediaPoolName;
00159         allocRow.blockSize      = m_medium.blockSize;
00160         allocRow.mediumFamily   = m_pool.mediaFamily;
00161         allocRow.poolType       = m_pool.mediaPoolType;
00162     };
00163     resources[0].mediumKey = m_medium.mediumKey;
00164     resources[0].barcode = m_medium.barcode;
00165 
00166     SetResources(resources);
00167 
00168     log_DBG_m(dbg_NORM,"[" << m_iJobParams.jobID <<
00169                         "] resources: " << endl <<
00170                         ipc_Log::LogResources(GetResources()));
00171 
00172     ostringstream msg;
00173     msg << "Redundant copy job started (JobID: " << m_iJobParams.jobID << ").";
00174     m_ui.DisplayMessage(msg.str());
00175 
00176 }

Here is the call graph for this function:

i_RedundantCopyJob_i::~i_RedundantCopyJob_i (  )  [virtual]

Definition at line 178 of file i_redundantcopyjob_impl.cpp.

References i_Medium_t::barcode, dbg_NORM, i_FSC_i::DeleteEntries(), cmn_File::DeleteF(), cmn_Global::dirs, ui_MsgWriter::DisplayMessage(), evt_ERROR, evt_MAINTJOB, evt_WARNING, ivd_Directories::fri, g_cmn, i_Job_i::GetJobTypeText(), i_SUCCEDED, ipc_EXEC_m, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), i_Job_i::m_aborted, m_best_effort, m_ccVol, m_currentMedium, i_PartitionManager_i::m_iFSCi, i_Job_i::m_iJobParams, m_iPM, m_medium, m_medStatus_v, m_mv, i_Job_i::m_rm, i_Job_i::m_status, m_ui, m_unavailFilesPerVol, i_Medium_t::mediumKey, i_Job_i::ReleaseDiskBuffer(), and rmdb_MEDVOL_REORG_RECYCLED.

00178                                            {
00179     log_FUNC_m(~i_RedundantCopyJob_i);
00180 
00181     try {
00182 
00183         if (m_currentMedium < m_medStatus_v.size()){
00184             ReleaseDiskBuffer();
00185         };
00186 
00187         bool allSucceded(true);
00188         for (UInt32_t i(0); i < m_medStatus_v.size(); i++){
00189             if (!m_medStatus_v[i].Succeded()) {
00190                 //some volume did not succede in read or write
00191                 allSucceded = false;
00192             }
00193         }
00194 
00195         ostringstream msg;
00196 
00197         if (allSucceded && (m_status == i_SUCCEDED)){
00198 
00199             vector<UInt32_t> volList;
00200             //check if file could not be found
00201             for (UInt32_t i(0); i < m_ccVol.size(); i++){
00202                 log_DBG_m(dbg_NORM, "m_ccVol[i]: " << m_ccVol[i]);
00203                 if ( !m_best_effort && (m_unavailFilesPerVol.size() >= m_ccVol[i])){
00204                     if (m_unavailFilesPerVol[m_ccVol[i]-1] == 0) {
00205                         volList.push_back(m_ccVol[i]);
00206                     } else {
00207                         msg.str("");
00208                         msg << "Will not delete entries from FSC for volume: " << m_ccVol[i];
00209                         ipc_EXEC_m( m_ui.DisplayMessage(msg.str()); );
00210                         log_WriteEvent(msg.str(), evt_MAINTJOB, m_iJobParams.jobID, string(m_medium.barcode));
00211                     }
00212                 } else {
00213                     volList.push_back(m_ccVol[i]);
00214                 }
00215             }
00216 
00217             //Remove entries for that medium
00218             msg.str("");
00219             msg << "Deleting entries from FSC ...";
00220             ipc_EXEC_m( m_ui.DisplayMessage(msg.str()); );
00221             log_WriteEvent(msg.str(), evt_MAINTJOB, m_iJobParams.jobID, string(m_medium.barcode));
00222 
00223             //delete entries from FSC
00224             log_DBG_m(dbg_NORM, "[" << m_iJobParams.jobID <<
00225                 "] " << "Deleting entries from FSC." <<
00226                 "Medium BC: " << m_medium.barcode);
00227 
00228             m_iPM.m_iFSCi->DeleteEntries(m_medium.mediumKey, volList);
00229 
00230             log_DBG_m(dbg_NORM,
00231                 "[" << m_iJobParams.jobID << "] " << "Deleting entries from FSC.");
00232 
00233             for (UInt32_t i(0); i < volList.size(); i++){
00234                 msg.str("");
00235                 msg << "Entries for volume " << volList[i] << " deleted from FSC.";
00236 
00237                 ipc_EXEC_m( m_ui.DisplayMessage(msg.str()); );
00238                 log_WriteEvent( msg.str(), evt_MAINTJOB,
00239                                 m_iJobParams.jobID, string(m_medium.barcode));
00240             }
00241 
00242             for (UInt32_t i(0); i < m_mv.length(); i++){
00243 
00244                 bool found(false);
00245                 for (UInt32_t j(0); j < volList.size(); j++){
00246                     if (m_mv[i].medVolNr == (Int32_t)volList[j]){
00247                         found = true;
00248                         break;
00249                     }
00250                 }
00251 
00252                 if (found){
00253                     // set status to recycled
00254                     try {
00255                         ipc_EXEC_m (
00256                             m_rm->MedVolStatusSet(  m_mv[i].medVolId,
00257                                                     rmdb_MEDVOL_REORG_RECYCLED);
00258                         )
00259                     } catch (...) {
00260                         //ignore
00261                     }
00262 
00263                     cmn_Path friPath = g_cmn.dirs.fri + m_mv[i].medVolId;
00264                     try {
00265                         cmn_File friFile(friPath);
00266                         friFile.DeleteF();
00267                         log_DBG_m(dbg_NORM,
00268                             "[" << m_iJobParams.jobID << "] " << "FRI file deleted. " << friPath);
00269                     }
00270                     catch (...) {
00271                         //ignore
00272                         //clean up as much as possible
00273                     }
00274                 }
00275             }
00276         }
00277         msg.str("");
00278 
00279         if (m_status == i_SUCCEDED) {
00280             log_WriteEvent("Finished.", GetJobTypeText(), m_iJobParams.jobID);
00281             msg << "[" << m_iJobParams.jobID <<
00282                     "] Finished.";
00283             ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00284         }
00285         else if (m_aborted) {
00286             log_WriteEvent(evt_WARNING, "Aborted.",
00287                 GetJobTypeText(), m_iJobParams.jobID);
00288             msg << "[" << m_iJobParams.jobID <<
00289                 "] Aborted.";
00290                 ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00291         }
00292         else {
00293             log_WriteEvent(evt_ERROR, "Failed.",
00294                 GetJobTypeText(), m_iJobParams.jobID);
00295             msg << "[" << m_iJobParams.jobID <<
00296                 "] Failed.";
00297                 ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00298         }
00299     } catch (ivd_Exception& e) {
00300         log_ERR_m(e);
00301     } catch (...) {
00302         log_ERR_m("Caught unknown" );
00303     }
00304 }

Here is the call graph for this function:


Member Function Documentation

void i_RedundantCopyJob_i::MediumOperationComplete ( i_Index_t  a_beaNum,
i_CompletionStatus_e  a_status 
) [virtual]

Implements i_Job_i.

Definition at line 307 of file i_redundantcopyjob_impl.cpp.

References cmn_Condition::Broadcast(), bs_NOT_RUNNING, i_Job_i::ClearResStatus(), dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_MAINTJOB, i_Job_i::GetResources(), i_SUCCEDED, ie_FATAL_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, i_Job_i::IsAborted(), ivd_USleep, i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogStatus(), i_Job_i::m_activate_c, i_Job_i::m_activate_x, i_Job_i::m_beasStatus_x, m_currentMedium, i_Job_i::m_iJobParams, m_medStatus_v, m_ui, i_Job_i::ReleaseDiskBuffer(), i_Job_i::ReleaseResource(), i_Job_i::SetBeaStatus(), and i_Job_i::SetResMedOpComplete().

00308                                                                           {
00309 
00310     log_FUNC_m(MediumOperationComplete);
00311     try {
00312 
00313         log_DBG_m(dbg_NORM,"[" << m_iJobParams.jobID <<
00314             "] " << "MediumOperationComplete called by Bea: " <<
00315             a_beaNum << "  status: [" << a_status << "]" <<
00316             ipc_Log::LogStatus(a_status) << endl <<
00317             m_iJobParams.jobID);
00318 
00319         if (IsAborted()){
00320             return;
00321         }
00322 
00323         SetResMedOpComplete(a_beaNum);
00324         {
00325             cmn_MutexLock l(m_beasStatus_x);
00326             SetBeaStatus(a_beaNum, bs_NOT_RUNNING);
00327         }
00328 
00329         try {
00330             if (a_beaNum > static_cast<i_Index_t>(GetResources().length() ) ) {
00331                 throw ivd_InternalError(
00332                     ie_FATAL_ERROR, "Non existing Bea wants to Complete Job??");
00333             };
00334         } ipc_CATCH_IVD_THROW_CORBA_m;
00335 
00336 
00337 
00338         if (a_beaNum == 0) { // reading of source volume finished
00339 
00340             m_medStatus_v[m_currentMedium].ReadFinished(a_status);
00341 
00342             //check completion status
00343             ostringstream msg;
00344             msg << "Reading finished, releasing resources.";
00345             ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00346             log_WriteEvent(msg.str(), evt_MAINTJOB,
00347                 m_iJobParams.jobID, string(GetResources()[a_beaNum].barcode));
00348 
00349             if (a_status == i_SUCCEDED){
00350                 {
00351                     cmn_MutexLock l(m_activate_x);
00352                     m_activate_c.Broadcast();
00353                 }//unlock l
00354 
00355                 log_DBG_m(dbg_NORM, "Let other thread request resource first");
00356                 ivd_USleep(100);
00357                 ReleaseResource(a_beaNum);
00358             } else {
00359                 //bug 3859
00360                 // release resource first
00361                 // target will anyhow not be allocated
00362                 ReleaseResource(a_beaNum);
00363                 cmn_MutexLock l(m_activate_x);
00364                 m_activate_c.Broadcast();
00365             }
00366 
00367         } else if (a_beaNum == 1){    //writing finished
00368             //free up resources
00369             m_medStatus_v[m_currentMedium].WriteFinished(a_status);
00370 
00371             //delete disk buffer
00372             ReleaseDiskBuffer();
00373 
00374             {
00375                 cmn_MutexLock l(m_activate_x);
00376                 m_activate_c.Broadcast();
00377             }//unlock l
00378 
00379             log_DBG_m(dbg_NORM, "Let other thread request resource first");
00380             ivd_USleep(100);
00381             ReleaseResource(a_beaNum);
00382             ClearResStatus(1);
00383         }
00384     } ipc_CATCH_IVD_THROW_CORBA_m;
00385 }

Here is the call graph for this function:

i_FileLocationDataList_t * i_RedundantCopyJob_i::GetNextRecallSet (  )  [virtual]

Reimplemented from i_Job_i.

Definition at line 387 of file i_redundantcopyjob_impl.cpp.

References log_FUNC_m, m_currentMedium, and m_medStatus_v.

00387                                                                 {
00388     log_FUNC_m(GetNextRecallSet);
00389     return m_medStatus_v[m_currentMedium].m_recallSetReader.GetNextRecallSet();
00390 }

void i_RedundantCopyJob_i::CompleteJob ( i_CompletionStatus_e  a_status  )  [virtual]

Implements i_Job_i.

Definition at line 392 of file i_redundantcopyjob_impl.cpp.

References log_ERR_m, log_FUNC_m, i_Job_i::m_status, and i_Job_i::Remove().

00392                                                                     {
00393     log_FUNC_m(CompleteJob);
00394 
00395     m_status = a_status;
00396 
00397     try {
00398         Remove();
00399 
00400     } catch (ivd_Exception& e) {
00401         log_ERR_m(e);
00402     } catch (...) {
00403         log_ERR_m("Caught unknown" );
00404     }
00405 }

Here is the call graph for this function:

void i_RedundantCopyJob_i::GetNewResources ( i_Index_t  a_resNum  )  [virtual]

Implements i_Job_i.

Definition at line 408 of file i_redundantcopyjob_impl.cpp.

References cmn_Condition::Broadcast(), bs_RUNNING, i_Job_i::ClearResStatus(), i_Job_i::GetResources(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, i_Job_i::IsAborted(), i_JobParams::jobID, log_FUNC_A_m, i_Job_i::m_activate_c, i_Job_i::m_activate_x, i_Job_i::m_beasStatus_x, i_Job_i::m_iJob, i_Job_i::m_iJobParams, i_Job_i::m_rm, i_JobParams::phase, i_Job_i::SetBeaStatus(), i_Job_i::SetResBeaStarted(), and i_Job_i::SetResRequested().

00408                                                             {
00409     log_FUNC_A_m(GetNewResources, "[" << m_iJobParams.jobID <<
00410         "] " << "a_resNum= " << a_resNum);
00411 
00412     {
00413         cmn_MutexLock l(m_beasStatus_x);
00414         SetBeaStatus(a_resNum, bs_RUNNING);
00415     }
00416 
00417     if (IsAborted()){
00418         cmn_MutexLock l(m_activate_x);
00419         m_activate_c.Broadcast();
00420         return;
00421     }
00422     try {
00423         m_iJobParams.phase++;
00424         ClearResStatus(a_resNum);
00425         SetResBeaStarted(a_resNum);
00426         SetResRequested(a_resNum);
00427         i_ResourceList_t resources;
00428         resources.length(1);
00429         resources[0] = (GetResources())[a_resNum];
00430         ipc_EXEC_m(
00431             m_rm->ExchangeResources(m_iJob, m_iJobParams, resources);
00432         );
00433     } ipc_CATCH_IVD_THROW_CORBA_m;
00434 }

Here is the call graph for this function:

void i_RedundantCopyJob_i::ReadSourceData (  )  [protected]

Definition at line 436 of file i_redundantcopyjob_impl.cpp.

References i_Job_i::ActivateBea(), bs_PROCESSING, bs_RUNNING, ipc_EXEC_m, i_Job_i::IsAborted(), i_JobParams::jobID, i_Job_i::LoadUnload(), log_ERR_m, log_FUNC_m, i_Job_i::m_activeBeas, i_Job_i::m_beasStatus_x, i_Job_i::m_iJobParams, i_Job_i::SetBeaStatus(), i_Job_i::SetDiskBufferWritten(), and i_Job_i::SetResProcessed().

Referenced by RecallFiles().

00436                                          {
00437     log_FUNC_m(ReadSourceData);
00438 
00439     LoadUnload(0);
00440     try {
00441         ipc_EXEC_m(
00442             cmn_MutexLock l(m_beasStatus_x);
00443             i_Job_i::ActivateBea(0);
00444             SetBeaStatus(0, bs_RUNNING);
00445 
00446             if (IsAborted()){
00447                 return;
00448             }
00449             SetResProcessed(0);
00450             SetDiskBufferWritten();
00451             m_activeBeas[0]->Recall();
00452             SetBeaStatus(0, bs_PROCESSING);
00453         );
00454     } catch (ivd_Exception& e){
00455         log_ERR_m("[" << m_iJobParams.jobID <<
00456             "] Catched Exception when calling Bea->Recall " << e);
00457         throw;
00458     }
00459 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_RedundantCopyJob_i::Execute (  )  [protected, virtual]

Implements i_Job_i.

Definition at line 462 of file i_redundantcopyjob_impl.cpp.

References i_Job_i::AllocateDiskBuffer(), dbg_LOW, dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_MAINTJOB, pm_RecallSetReader::GetCurrentSplitSize(), ivd_BaseException::GetError(), pm_RecallSetReader::GetRemainingBytesToCopy(), i_FAILED, i_SUCCEDED, ie_FATAL_ERROR, ie_VOL_NOT_FOUND, i_Job_i::IsAborted(), pm_VolStatus::IsRead(), i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogMediumVol(), ipc_Log::LogStatus(), m_best_effort, pm_VolStatus::m_blockSize, m_currentMedium, i_Job_i::m_iJobParams, m_iPM, i_PartitionManager_i::m_maxDiskBuff, m_medStatus_v, pm_VolStatus::m_medVol, pm_VolStatus::m_recallSetReader, i_Job_i::m_status, m_ui, i_MediumVol_t::mediumBarcode, i_MediumVol_t::medVolId, MigrateFiles(), Prepare(), and RecallFiles().

00462                                    {
00463     log_FUNC_m(Execute);
00464 
00465     ostringstream msgBase;
00466     msgBase << "[" << m_iJobParams.jobID << "] ";
00467 
00468     ostringstream msg;
00469 
00470     if (!Prepare()) {
00471         return;
00472     }
00473 
00474     try {
00475         while(true) {
00476             log_DBG_m(dbg_NORM, "Entering while. m_currentMedium:" <<
00477                                 m_currentMedium);
00478             if (m_currentMedium >= m_medStatus_v.size()){
00479                 if(m_best_effort){
00480                     log_DBG_m(dbg_NORM, "We may not have a single source medium " 
00481                               <<  "on best effort. "
00482                               <<  "Job finished.");
00483                     m_status = i_SUCCEDED;
00484                     return;
00485                 }
00486                 msg.str("");
00487                 msg << "Accessing beyond vector size " << m_currentMedium;
00488                 throw ivd_InternalError(ie_FATAL_ERROR, msg.str() );
00489             }
00490             pm_VolStatus &vol = m_medStatus_v[m_currentMedium];
00491 
00492 
00493             log_DBG_m(dbg_NORM, "Processing volume:" << endl <<
00494                                 ipc_Log::LogMediumVol(vol.m_medVol) );
00495 
00496             msg.str("");
00497             msg << "Will copy content from volume: " <<
00498                     vol.m_medVol.medVolId;
00499 
00500             log_WriteEvent(msg.str(), evt_MAINTJOB,
00501                 m_iJobParams.jobID, string(vol.m_medVol.mediumBarcode));
00502 
00503             m_ui.DisplayMessage(msg.str());
00504 
00505             // If disk buffer is small do copy content in several iterations
00506             while (!vol.IsRead()) {
00507 
00508                 msg.str("");
00509 
00510                 UInt64_t dBuffSize = AllocateDiskBuffer(
00511                                 vol.m_recallSetReader.GetCurrentSplitSize(),
00512                                 vol.m_recallSetReader.GetRemainingBytesToCopy(),
00513                                 m_iPM.m_maxDiskBuff,
00514                                 vol.m_blockSize,
00515                                 m_iPM.m_maxDiskBuff);
00516 
00517                 if (!RecallFiles(vol, dBuffSize)) {
00518                     if (IsAborted()) {
00519                         return;
00520                     }
00521                     continue;
00522                 }
00523 
00524                 if (IsAborted()) {
00525                     return;
00526                 }
00527 
00528                 MigrateFiles(vol);
00529 
00530                 if (IsAborted()) {
00531                     return;
00532                 }
00533 
00534             } //while ( !vol.IsRead() )
00535 
00536             if (m_currentMedium < m_medStatus_v.size() - 1) {
00537                 //processing next volume
00538                 m_currentMedium++;
00539             }
00540             else {
00541                 //job finished
00542                 m_status = i_SUCCEDED;
00543                 for (UInt32_t i(0); i < m_medStatus_v.size(); i++){
00544                     if (m_medStatus_v[i].m_writeStatus != i_SUCCEDED){
00545                         log_DBG_m(dbg_LOW, "Writing of volume " <<
00546                             m_medStatus_v[i].m_medVol.medVolId <<
00547                             "failed with status:" <<
00548                             ipc_Log::LogStatus(m_medStatus_v[i].m_writeStatus));
00549                         m_status = i_FAILED;
00550                     }
00551                 }
00552                 return;
00553             }
00554         } //while(true)
00555     } catch (ivd_Error& e) {
00556         if (e.GetError() == ie_VOL_NOT_FOUND){
00557             log_DBG_m(dbg_LOW, "copy content read/write finished.");
00558             //continue
00559         } else
00560             throw;
00561     }
00562 }

Here is the call graph for this function:

i_FSC_ptr i_RedundantCopyJob_i::GetFSC (  )  [protected, virtual]

Implements i_Job_i.

Definition at line 566 of file i_redundantcopyjob_impl.cpp.

References i_PartitionManager_i::GetFSC(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_FUNC_m, and m_iPM.

00566                                        {
00567     log_FUNC_m(GetFSC);
00568     try {
00569         ipc_EXEC_m(
00570             i_FSC_ptr tmpFSC = i_FSC::_duplicate(m_iPM.GetFSC());
00571         return tmpFSC;
00572         );
00573     } ipc_CATCH_IVD_THROW_CORBA_m;
00574 
00575 }

Here is the call graph for this function:

i_JobRequestList_t * i_RedundantCopyJob_i::GetFiles (  )  [protected, virtual]

Implements i_Job_i.

Definition at line 578 of file i_redundantcopyjob_impl.cpp.

References ie_IMPOSSIBLE, ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and NULL.

00578                                                    {
00579     log_FUNC_m(GetFiles);
00580 
00581     try {
00582         throw ivd_InternalError(ie_IMPOSSIBLE);
00583     } ipc_CATCH_IVD_THROW_CORBA_m;
00584     return NULL;
00585 } // i_RecallJob_i::GetFiles()

bool i_RedundantCopyJob_i::Prepare (  )  [private]

Definition at line 588 of file i_redundantcopyjob_impl.cpp.

References i_Medium_t::barcode, i_Medium_t::blockSize, fsc_RedunCopyResult_t::buffSize, dbg_DETAIL, dbg_IsActive(), dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_ERROR, evt_MAINTJOB, i_FAILED, ie_FATAL_ERROR, ipc_EXEC_m, job_MED_PROC, i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_best_effort, m_ccVol, i_PartitionManager_i::m_config, cfg_PM::m_globalTree, i_PartitionManager_i::m_iFSCi, i_Job_i::m_iJobParams, m_iPM, m_medium, m_medStatus_v, i_Job_i::m_rm, i_Job_i::m_status, m_ui, m_unavailFilesPerVol, i_MediaPool_t::mediaPoolKey, i_Medium_t::mediaPoolName, i_MediaPool_t::mediaPoolName, fsc_RedunCopyResult_t::mediumKey, i_Medium_t::mediumKey, i_Medium_t::mediumType, fsc_RedunCopyResult_t::medVolNum, mt_DISK, cfg_Tree::pools, i_FSC_i::RedundantCopy(), i_Job_i::SetStatus(), and i_Medium_t::status.

Referenced by Execute().

00588                                     {
00589     log_FUNC_m(Prepare);
00590 
00591     ostringstream msgBase;
00592     msgBase << "[" << m_iJobParams.jobID << "] ";
00593     ostringstream msg;
00594     //invoke scan (scan will fill up vector<fsc_MediumStatus_t>
00595 
00596     msg << "Preparing list of source media. ";
00597     ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00598     log_WriteEvent(msg.str(), evt_MAINTJOB,
00599         m_iJobParams.jobID, string(m_medium.barcode));
00600 
00601     log_DBG_m(dbg_NORM, "" << msgBase << msg.str());
00602 
00603     i_MediumSeq_t_var medSeq;
00604     ipc_EXEC_m(
00605         medSeq = m_rm->SelectAllMedia();
00606     );
00607     vector<i_MediaPool_t> &pools = m_iPM.m_config.m_globalTree.pools;
00608 
00609     fsc_MediumStatus_v ms;
00610 
00611     UInt32_t maxMedKey(0);
00612     if (medSeq->length() == 0){
00613         ostringstream sstr;
00614         sstr << "No media found at all ???. ";
00615         throw ivd_InternalError(ie_FATAL_ERROR, sstr.str());
00616     } else {
00617         maxMedKey = medSeq[0].mediumKey;
00618     }
00619 
00620     for (UInt32_t i(1); i < medSeq->length(); ++i){
00621         if (medSeq[i].mediumKey > maxMedKey){
00622             maxMedKey = medSeq[i].mediumKey;
00623         }
00624     }
00625 
00626     //index is mediumKey
00627     // index 0 is redundant
00628 
00629     ms.resize(maxMedKey + 1);
00630     log_DBG_m(dbg_NORM, "" << msgBase << "ms resized to " << ms.size());
00631 
00632     log_DBG_m(dbg_DETAIL, "Num of pools " << pools.size());
00633     if (dbg_IsActive()) {
00634         for(UInt32_t j(0); j < pools.size(); ++j){
00635             i_MediaPool_t &pool = pools[j];
00636             log_DBG_m(dbg_DETAIL, j
00637                         << ". pool key " << pool.mediaPoolKey
00638                         << " mediaPoolName " << pool.mediaPoolName );
00639         }
00640     }
00641 
00642     for (UInt32_t i(0); i < medSeq->length(); ++i){
00643 
00644         i_Medium_t& med = medSeq[i];
00645         //get pool key
00646         UInt32_t poolKey(0);
00647         for(UInt32_t j(0); j < pools.size(); ++j) {
00648             i_MediaPool_t &pool = pools[j];
00649             if (string(pool.mediaPoolName).compare(med.mediaPoolName) == 0){
00650                 poolKey = pool.mediaPoolKey;
00651             }
00652         }
00653         log_DBG_m(dbg_DETAIL, " medKey " << setw(4) << med.mediumKey
00654                             << ". poolKey " << poolKey
00655                             << ", med.status " << med.status
00656                             << ", med.mediumType " << med.mediumType
00657                             << ", med.mediaPoolName " << med.mediaPoolName );
00658 
00659         if (med.mediumKey == 0) {
00660             ostringstream sstr;
00661             sstr << "mediumKey is zero. " << med.mediumKey;
00662             throw ivd_InternalError(ie_FATAL_ERROR, sstr.str());
00663         }
00664         if (med.mediumKey >= ms.size()) {
00665             ostringstream sstr;
00666             sstr << "mediumKey is bigger than vector size. "
00667                  << med.mediumKey << " > " << ms.size();
00668             throw ivd_InternalError(ie_FATAL_ERROR, sstr.str());
00669         }
00670         log_DBG_m(dbg_DETAIL, "inserting  mediaKey:" << med.mediumKey);
00671         ms[med.mediumKey] = fsc_MediumStatus_t( poolKey,
00672                                                 med.status,
00673                                                 med.mediumType == mt_DISK ? 2:1);
00674         // Higher number better medium
00675     }
00676 
00677     fsc_RedunCopyResult_v result;
00678     try {
00679         m_iPM.m_iFSCi->RedundantCopy(result, m_unavailFilesPerVol, ms, m_medium.mediumKey, m_ccVol, m_best_effort);
00680     }
00681     catch (const ivd_Error& e){
00682         msg.str("");
00683         msg << "Redundant copy scan failed. " << e ;
00684         ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00685         log_WriteEvent(evt_ERROR, msg.str(), evt_MAINTJOB,
00686             m_iJobParams.jobID, string(m_medium.barcode));
00687         throw;
00688     }
00689 
00690     //fill up medium Status vector
00691     for (UInt32_t i(0); i < result.size(); i++) {
00692         fsc_RedunCopyResult_t res = result[i];
00693         log_DBG_m(dbg_DETAIL, "res [mediumKey, medVolNum, buffSize]: " <<
00694                                res.mediumKey << ", " <<
00695                                res.medVolNum << ", " <<
00696                                res.buffSize << "]");
00697 
00698         //Insert new mediumVol into MediumStatus
00699         i_MediumVol_t_var mv = m_rm->SelectMediumVolByKey( result[i].mediumKey,
00700                                                            result[i].medVolNum);
00701 
00702         m_medStatus_v.push_back(    pm_VolStatus(   mv,
00703                                                     result[i].mediumKey,
00704                                                     m_medium.blockSize,
00705                                                     res.buffSize,
00706                                                     m_medium.mediumKey) );
00707     }
00708     if (m_medStatus_v.size() == 0){
00709         msg.str("");
00710         msg << "No media found for redundant copy.";
00711         ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00712         log_WriteEvent(msg.str(), evt_MAINTJOB,
00713             m_iJobParams.jobID, string(m_medium.barcode));
00714         if(m_best_effort) {
00715             return true; // continue on best effort;
00716         }
00717         else {
00718             m_status = i_FAILED;
00719             return false;
00720        }
00721     }
00722 
00723     UInt32_t prevMed(0);
00724     vector<string> medBarcodes;
00725 
00726     for (UInt32_t i(0); i < m_medStatus_v.size(); i++){
00727         if (m_medStatus_v[i].m_mediaKey != prevMed){
00728             prevMed = m_medStatus_v[i].m_mediaKey;
00729             medBarcodes.push_back(string(m_medStatus_v[i].m_medVol.mediumBarcode));
00730         }
00731     }
00732     msg.str("");
00733     msg << medBarcodes.size() << " media needed for recall (bc: ";
00734     for (UInt32_t i(0); i < medBarcodes.size(); i++){
00735         msg << medBarcodes[i];
00736         if (i == (medBarcodes.size() - 1) ){
00737             msg << ")";
00738         }
00739         else {
00740             msg << ", ";
00741         }
00742     }
00743 
00744     ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00745     log_WriteEvent(msg.str(), evt_MAINTJOB,
00746         m_iJobParams.jobID, string(m_medium.barcode));
00747 
00748     SetStatus(job_MED_PROC);
00749     return true;
00750 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool i_RedundantCopyJob_i::RecallFiles ( pm_VolStatus vol,
UInt64_t  a_dBuffSize 
) [private]

Definition at line 753 of file i_redundantcopyjob_impl.cpp.

References i_Resource_t::barcode, dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_MAINTJOB, i_Job_i::GetResources(), i_RESOURCE_ERROR, i_SUCCEDED, ipc_EXEC_m, i_Job_i::IsAborted(), i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), i_Job_i::m_activate_c, i_Job_i::m_activate_x, m_currentMedium, i_Job_i::m_iJob, i_Job_i::m_iJobParams, pm_VolStatus::m_mediaKey, pm_VolStatus::m_medVol, m_pool, pm_VolStatus::m_readStatus, pm_VolStatus::m_recallSetReader, i_Job_i::m_rm, i_Job_i::m_status, m_ui, i_MediumVol_t::mediumBarcode, i_Resource_t::mediumKey, i_MediumVol_t::medVolId, i_Resource_t::medVolId, i_MediumVol_t::medVolNr, i_Resource_t::medVolNr, i_Resource_t::poolUUID, i_MediaPool_t::poolUUIDString, ReadSourceData(), i_Resource_t::resAllocated, i_Resource_t::resAssigned, i_Resource_t::resBeaStarted, i_Resource_t::resMedOpComplete, ipc_Init::ResourceInit(), i_Resource_t::resProcessed, i_Resource_t::resReleased, i_Resource_t::resRequested, pm_RecallSetReader::SetCurrentBuffSize(), i_Job_i::SetResources(), i_Job_i::SetResRequested(), cmn_Condition::Wait(), and i_Job_i::WaitBeasToFinish().

Referenced by Execute().

00753                                                                               {
00754     log_FUNC_m(RecallFiles);
00755 
00756     ostringstream msg;
00757 
00758     ostringstream msgBase;
00759     msgBase << "[" << m_iJobParams.jobID << "] ";
00760 
00761     //allocate source medium for reading
00762     i_Resource_t tmpRes;
00763     tmpRes = GetResources()[0]; //0 - source resource
00764     try {
00765         if (m_currentMedium > 0) {
00766             ipc_Init::ResourceInit(tmpRes);
00767         }
00768         ipc_EXEC_m(
00769             tmpRes.mediumKey    = vol.m_mediaKey;
00770             tmpRes.medVolNr     = vol.m_medVol.medVolNr;
00771             tmpRes.medVolId     = vol.m_medVol.medVolId;
00772             tmpRes.poolUUID     = m_pool.poolUUIDString;
00773             tmpRes.resRequested = false;
00774             tmpRes.resAllocated = false;
00775             tmpRes.resAssigned  = false;
00776             tmpRes.resReleased  = false;
00777             tmpRes.resBeaStarted = false;
00778             tmpRes.resProcessed = false;
00779             tmpRes.resMedOpComplete = false;
00780             SetResources(tmpRes);
00781 
00782             cmn_MutexLock l(m_activate_x);
00783 
00784             msg.str("");
00785             msg << "Requesting source resources...";
00786 
00787             log_WriteEvent(msg.str(), evt_MAINTJOB,
00788                 m_iJobParams.jobID, string(vol.m_medVol.mediumBarcode));
00789             m_ui.DisplayMessage(msg.str());
00790 
00791             m_rm->GetRecallResources(   m_iJob,
00792                                         m_iJobParams,
00793                                         tmpRes);
00794             SetResRequested(0);
00795             //wait for medium to be assigned
00796             log_DBG_m(dbg_NORM, "Waiting for source medium.");
00797 
00798             m_activate_c.Wait();
00799             msg.str("");
00800             msg << "Resources allocated.";
00801             tmpRes = GetResources()[0];
00802 
00803             log_WriteEvent(msg.str(), evt_MAINTJOB,
00804                 m_iJobParams.jobID, string(tmpRes.barcode));
00805             m_ui.DisplayMessage(msg.str());
00806         );
00807     }
00808     catch (const ivd_Exception&) {
00809         log_DBG_m(dbg_NORM, "" << msgBase.str() <<
00810                             "RM->GetResources failed.");
00811         m_status = i_RESOURCE_ERROR;
00812         throw;
00813     }
00814 
00815     if (IsAborted()) {
00816         return false;
00817     }
00818 
00819     i_MediumVol_t mv = vol.m_medVol;
00820 
00821     msg.str("");
00822     msg << "Medium " << tmpRes.barcode << ", volume " <<
00823         tmpRes.medVolNr << " Reading valid files ...";
00824 
00825     log_WriteEvent(msg.str(), evt_MAINTJOB,
00826         m_iJobParams.jobID, string(tmpRes.barcode));
00827     m_ui.DisplayMessage(msg.str());
00828 
00829     /* a_dBuffSize is not visible outside this function
00830     so vol.m_recallSetReader.GetNextRecallSet(dBuffSize)
00831     cannot be called. Instead, first do:
00832     vol.m_recallSetReader.SetCurrentBuffSize(dBuffSize);
00833     and then call
00834     vol.m_recallSetReader.GetNextRecallSet(),
00835     it has same effect */
00836     vol.m_recallSetReader.SetCurrentBuffSize(a_dBuffSize);
00837 
00838     {
00839         cmn_MutexLock l(m_activate_x);
00840         ReadSourceData();
00841 
00842         if (IsAborted()) {
00843             return false;
00844         }
00845 
00846         WaitBeasToFinish(5);
00847     }
00848 
00849     if (IsAborted()) {
00850         return false;
00851     }
00852 
00853     if (vol.m_readStatus == i_SUCCEDED) {
00854         msg.str("");
00855         msg << "Medium " << tmpRes.barcode << ", volume " <<
00856             tmpRes.medVolNr << " Files written to disk buffer.";
00857 
00858         log_WriteEvent(msg.str(), evt_MAINTJOB,
00859             m_iJobParams.jobID, string(tmpRes.barcode));
00860         m_ui.DisplayMessage(msg.str());
00861         return true;
00862     }
00863     else {
00864         msg.str("");
00865         msg << "Medium " << tmpRes.barcode << ", volume " <<
00866             tmpRes.medVolNr <<
00867             " Error. Reading from medium or writing to diskbuffer failed.";
00868 
00869         log_WriteEvent(msg.str(), evt_MAINTJOB,
00870             m_iJobParams.jobID, string(tmpRes.barcode));
00871         m_ui.DisplayMessage(msg.str());
00872         return false;
00873     }
00874 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_RedundantCopyJob_i::MigrateFiles ( pm_VolStatus vol  )  [private]

Definition at line 877 of file i_redundantcopyjob_impl.cpp.

References i_Job_i::ActivateBea(), i_Resource_t::barcode, bs_PROCESSING, bs_RUNNING, dbg_NORM, ui_MsgWriter::DisplayMessage(), i_Resource_t::driveKey, evt_MAINTJOB, i_Job_i::GetResources(), i_RESOURCE_ERROR, ipc_EXEC_m, i_Job_i::IsAborted(), pm_RecallSetReader::IsWriteFinished(), i_JobParams::jobID, i_Resource_t::load, i_Job_i::LoadUnload(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogResources(), i_Job_i::m_activate_c, i_Job_i::m_activate_x, i_Job_i::m_activeBeas, i_Job_i::m_beasStatus_x, i_Job_i::m_iJob, i_Job_i::m_iJobParams, pm_VolStatus::m_recallSetReader, i_Job_i::m_rm, i_Job_i::m_status, m_ui, i_Resource_t::mediumFamily, i_Resource_t::medVolNr, mf_DISK, i_Job_i::NeedsProcess(), i_Resource_t::resAllocated, i_Resource_t::resAssigned, i_Resource_t::resBeaStarted, i_Resource_t::resMedOpComplete, i_Resource_t::resProcessed, i_Resource_t::resReleased, i_Resource_t::resRequested, i_Job_i::SetBeaStatus(), i_Job_i::SetResBeaStarted(), i_Job_i::SetResources(), i_Job_i::SetResProcessed(), cmn_Condition::Wait(), and i_Job_i::WaitBeasToFinish().

Referenced by Execute().

00877                                                          {
00878     log_FUNC_m(MigrateFiles);
00879 
00880     ostringstream msg;
00881 
00882     try {
00883 
00884         i_Resource_t res = GetResources()[1];
00885         res.resAllocated = false;
00886         res.resAssigned = false;
00887         res.resReleased = false;
00888         res.resBeaStarted = false;
00889         res.resProcessed = false;
00890         res.resMedOpComplete = false;
00891         res.resRequested = true;
00892         i_ResourceList_t tmpRes;
00893         tmpRes.length(1);
00894         tmpRes[0] = res; //0 - source resource
00895         SetResources(res);
00896 
00897         ipc_EXEC_m (
00898             cmn_MutexLock l(m_activate_x);
00899             msg.str("");
00900             msg << "Requesting target resources...";
00901 
00902             log_WriteEvent(msg.str(), evt_MAINTJOB,
00903                 m_iJobParams.jobID);
00904             m_ui.DisplayMessage(msg.str());
00905 
00906             m_rm->GetResources( m_iJob,
00907                                 m_iJobParams,
00908                                 tmpRes);
00909 
00910 
00911             //wait for medium to be assigned
00912             log_DBG_m(dbg_NORM, "Waiting for target medium.");
00913             m_activate_c.Wait();
00914             log_DBG_m(dbg_NORM, "Got target medium.");
00915             msg.str("");
00916             msg << "Resources allocated.";
00917 
00918             log_WriteEvent(msg.str(), evt_MAINTJOB,
00919                 m_iJobParams.jobID, string(res.barcode));
00920             m_ui.DisplayMessage(msg.str());
00921         );
00922     }
00923     catch (const ivd_Exception&) {
00924         log_DBG_m(dbg_NORM, "[" << m_iJobParams.jobID <<
00925                             "] " << "RM->GetResources failed.");
00926         m_status = i_RESOURCE_ERROR;
00927         throw;
00928     }
00929     if (IsAborted()) {
00930         return;
00931     }
00932 
00933     bool first(true);
00934 
00935 
00936     while (!vol.m_recallSetReader.IsWriteFinished()) {
00937 
00938     i_Resource_t res = GetResources()[1];
00939 
00940 
00941         log_DBG_m(dbg_NORM, "Write not completed yet.");
00942         if ( NeedsProcess(1)) {
00943             log_DBG_m(dbg_NORM, "Write needs process.");
00944             cmn_MutexLock l(m_activate_x);
00945             log_DBG_m(dbg_NORM, "m_activate_x locked.");
00946 
00947             if (res.mediumFamily != mf_DISK){
00948                 string driveName;
00949                 ipc_EXEC_m(
00950                     i_Drive_t_var drive;
00951                     drive = m_rm->SelectDriveByKey(res.driveKey);
00952                     driveName = drive->driveName;
00953                 )
00954 
00955                 if (res.load) {
00956                     msg.str("");
00957                     msg << "Loading medium " << res.barcode <<
00958                         " to drive " << driveName << ".";
00959                     ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00960                     log_WriteEvent(msg.str(), evt_MAINTJOB,
00961                         m_iJobParams.jobID, string(res.barcode));
00962                     ipc_EXEC_m(LoadUnload(1));
00963                 }
00964                 else {
00965                     msg.str("");
00966                     msg << "Medium " << res.barcode <<
00967                         " is already present in drive " << driveName << ".";
00968                     ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00969                     log_WriteEvent(msg.str(), evt_MAINTJOB,
00970                         m_iJobParams.jobID, string(res.barcode));
00971                 }
00972             }
00973 
00974             ipc_EXEC_m(
00975                 if (first){
00976 
00977                     msg.str("");
00978                     msg << "Starting Back End Agent.";
00979                     ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00980                     log_WriteEvent(msg.str(), evt_MAINTJOB,
00981                         m_iJobParams.jobID, string(res.barcode));
00982                 }
00983 
00984                 cmn_MutexLock l(m_beasStatus_x);
00985 
00986                 i_Job_i::ActivateBea(1);
00987                 SetBeaStatus(1, bs_RUNNING);
00988                 SetResBeaStarted(1);
00989                 SetResProcessed(1);
00990 
00991                 msg.str("");
00992                 msg << "Medium " << res.barcode << ", volume " <<
00993                     res.medVolNr << ": Writing...";
00994                 ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
00995                 log_WriteEvent(msg.str(), evt_MAINTJOB,
00996                     m_iJobParams.jobID, string(res.barcode));
00997                 if (first) {
00998                     m_activeBeas[1]->Migrate();
00999                     first = false;
01000                 }
01001                 SetBeaStatus(1, bs_PROCESSING);
01002             );
01003 
01004             WaitBeasToFinish(5);
01005 
01006             msg.str("");
01007             msg << "Medium " << res.barcode << ", volume "
01008                 << res.medVolNr << ": Data written to media volume.";
01009 
01010             ipc_EXEC_m(m_ui.DisplayMessage(msg.str()););
01011             log_WriteEvent(msg.str(), evt_MAINTJOB,
01012                 m_iJobParams.jobID, string(res.barcode));
01013 
01014         } else {
01015             log_ERR_m("Redundant copy Job should need processing" <<
01016                 ipc_Log::LogResources(res));
01017             return;
01018         }
01019         //wait for writer to finish
01020         log_DBG_m(dbg_NORM, "Writing BEA finished.");
01021 
01022         if (IsAborted()) {
01023             return;
01024         }
01025     } //while (!vol.IsWrite())
01026 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_RedundantCopyJob_i::SetResourceBusyStatus ( i_Index_t  a_resNum,
i_ResourceBusy_e  a_resStatus 
) [private]

Reimplemented from i_Job_i.

Definition at line 1028 of file i_redundantcopyjob_impl.cpp.

References i_Resource_t::barcode, evt_INFO, i_Job_i::GetResources(), i_MEDIUM_BUSY, i_MEDIUM_NOT_AVAILABLE, ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), i_Resource_t::poolName, ipc_Log::ResourceBusy(), i_Resource_t::resourceBusyStatus, and i_Job_i::SetResources().

01029                                                                               {
01030     log_FUNC_m(SetResourceBusyStatus);
01031 
01032     try {
01033         i_Resource_t tmpRes;
01034         tmpRes = GetResources()[a_resNum];
01035         tmpRes.resourceBusyStatus = a_resStatus;
01036         SetResources(tmpRes);
01037 
01038         ostringstream msg;
01039         if (a_resNum == 0) {
01040             msg << "Source resources not ready: ";
01041         } else {
01042             msg << "Target resources not ready: ";
01043         }
01044 
01045         msg << ipc_Log::ResourceBusy(a_resStatus);
01046 
01047         if (a_resStatus == i_MEDIUM_BUSY ||
01048             a_resStatus == i_MEDIUM_NOT_AVAILABLE){
01049 
01050             msg << " <";
01051 
01052             if (a_resStatus == i_MEDIUM_BUSY ||
01053             a_resStatus == i_MEDIUM_NOT_AVAILABLE){
01054 
01055                 msg << " <";
01056 
01057                 if (a_resNum == 0) {
01058                     //waiting for medium <bc: 000123>
01059                     msg << "bc: " <<
01060                     tmpRes.barcode << ">";
01061                 } else {
01062                     //waiting for medium <pool: pool1>
01063                     msg << "pool: " <<
01064                     tmpRes.poolName << ">";
01065                 }
01066             }
01067         }
01068         log_WriteEvent(evt_INFO, msg.str());
01069         // Workaround for bug 8652 GUI deadlock
01070         // m_ui.DisplayMessage(msg.str());
01071     } ipc_CATCH_IVD_THROW_CORBA_m;
01072 }

Here is the call graph for this function:


Member Data Documentation

Reimplemented from i_Job_i.

Definition at line 37 of file i_redundantcopyjob_impl.h.

string i_RedundantCopyJob_i::m_barcode [protected]

Definition at line 54 of file i_redundantcopyjob_impl.h.

Referenced by i_RedundantCopyJob_i().

Definition at line 55 of file i_redundantcopyjob_impl.h.

Referenced by i_RedundantCopyJob_i(), Prepare(), and ~i_RedundantCopyJob_i().

Definition at line 56 of file i_redundantcopyjob_impl.h.

Referenced by i_RedundantCopyJob_i(), and ~i_RedundantCopyJob_i().

Definition at line 57 of file i_redundantcopyjob_impl.h.

Referenced by i_RedundantCopyJob_i(), and RecallFiles().

Definition at line 58 of file i_redundantcopyjob_impl.h.

Referenced by Execute(), Prepare(), and ~i_RedundantCopyJob_i().

Definition at line 61 of file i_redundantcopyjob_impl.h.

Referenced by i_RedundantCopyJob_i().

Definition at line 62 of file i_redundantcopyjob_impl.h.

Referenced by i_RedundantCopyJob_i(), Prepare(), and ~i_RedundantCopyJob_i().

Definition at line 64 of file i_redundantcopyjob_impl.h.

Referenced by Prepare(), and ~i_RedundantCopyJob_i().


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:38:42 2012 for OPENARCHIVE by  doxygen 1.5.6