#include <i_mediumdupl_impl.h>


Definition at line 69 of file i_mediumdupl_impl.h.
| i_MediumDupl_i::i_MediumDupl_i | ( | mif_JobManager & | a_jobManager, | |
| string & | a_sourceMedBC, | |||
| string & | a_targetMedBC, | |||
| bool | a_forced, | |||
| i_UIMessageServer_ptr & | a_UIMS_p | |||
| ) |
Definition at line 38 of file i_mediumdupl_impl.cpp.
References i_JobParams::bufType, dbg_DETAIL, dbg_LOW, dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, ivd_BaseException::GetError(), i_Job_i::GetResources(), i_DISK_BUF, ie_PRECONDITION, i_Job_i::InitBeaStatus(), ipc_EXEC_m, ivd_Error, i_JobParams::jobID, i_JobParams::jobType, jt_ADMIN, log_DBG_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogJobParams(), ipc_Log::LogMediumVol(), ipc_Log::LogResources(), i_Job_i::m_activeBeas, i_Job_i::m_iJobParams, m_medVolInRmdb, i_Job_i::m_rm, m_sourceMedium, m_targetMedium, m_ui, m_volStatus, mt_DISK, pt_Backup, ipc_Init::ResourceInit(), rmdb_MEDIUM_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, mif_VolStatus::SetNumOfVol(), and i_Job_i::SetResources().
00044 : i_Job_i(a_jobManager), 00045 m_sourceMedSize(0), 00046 m_sourceDataSize(0), 00047 m_srcMediumFull(false), 00048 m_forced(a_forced), 00049 m_sourceBeaRunning(false), 00050 m_targetBeaRunning(false), 00051 m_ui(a_UIMS_p) 00052 { 00053 log_FUNC_m(i_MediumDupl_i); 00054 m_iJobParams.jobType = jt_ADMIN; 00055 m_iJobParams.bufType = i_DISK_BUF; 00056 00057 ostringstream msg; 00058 msg << "Started."; 00059 00060 log_WriteEvent(msg.str(), evt_ADMINJOB, 00061 m_iJobParams.jobID, a_sourceMedBC); 00062 m_ui.DisplayMessage(msg.str()); 00063 00064 log_DBG_m(dbg_NORM,"[" << m_iJobParams.jobID << 00065 "] " << "ADMIN JOB: Started."); 00066 00067 00068 // select source medium info 00069 try { 00070 ipc_EXEC_m( 00071 m_sourceMedium = m_rm->SelectMedium(a_sourceMedBC.c_str()); 00072 log_DBG_m(dbg_NORM, "Source medium: " << m_sourceMedium->barcode << " selected."); 00073 ); 00074 } catch (ivd_Exception) { 00075 throw ivd_Error(ie_PRECONDITION, "Source medium does not exist.", true); 00076 } 00077 00078 if (m_sourceMedium->mediumType == mt_DISK){ 00079 throw ivd_Error(ie_PRECONDITION, "Medium duplication of Disk Media is not allowed.", true); 00080 } 00081 00082 if (m_sourceMedium->status & rmdb_MEDIUM_UNUSABLE) { 00083 throw ivd_Error(ie_PRECONDITION, 00084 "Medium " + string(m_sourceMedium->barcode) + " is marked unusable.", true); 00085 } 00086 00087 ipc_EXEC_m( 00088 i_MediumVolSeq_t_var tmpMedVolInRmdb = 00089 m_rm->SelectAllMediumVolByBarcode(a_sourceMedBC.c_str()); 00090 m_medVolInRmdb = tmpMedVolInRmdb; 00091 log_DBG_m(dbg_NORM, "Source medium contains: " << m_medVolInRmdb.length() << " volumes" ); 00092 m_volStatus.SetNumOfVol(m_medVolInRmdb.length()); 00093 ); 00094 00095 if ( m_medVolInRmdb.length() == 0){ 00096 throw ivd_Error(ie_PRECONDITION, "Source medium not initialized.", true); 00097 } 00098 00099 for (UInt32_t i(0); i < m_medVolInRmdb.length(); i++){ 00100 log_DBG_m(dbg_DETAIL, "" << ipc_Log::LogMediumVol(m_medVolInRmdb[i]) ); 00101 } 00102 00103 // select media pool for source medium 00104 i_MediaPool_t_var mpool; 00105 try { 00106 ipc_EXEC_m( 00107 mpool = m_rm->SelectMediaPool(m_sourceMedium->mediaPoolName); 00108 log_DBG_m(dbg_NORM, "Pool: " << mpool->mediaPoolName << " selected."); 00109 ); 00110 } catch (ivd_Exception) { 00111 throw ivd_Error(ie_PRECONDITION, "Source medium not in pool."); 00112 } 00113 00114 // check if the source media belongs to backup pool 00115 if (mpool->mediaPoolType == pt_Backup) { 00116 throw ivd_Error(ie_PRECONDITION, "Media duplication is not allowed for backup medium.", true); 00117 } 00118 00119 // 00120 // Verify that the target medium doesn't belong to any pool, 00121 // which is assigned to a partition. 00122 // 00123 try { 00124 ipc_EXEC_m( 00125 m_targetMedium = m_rm->SelectMedium(a_targetMedBC.c_str()); 00126 log_DBG_m(dbg_NORM, "Target medium: " << m_targetMedium->barcode << " selected."); 00127 ); 00128 } catch (ivd_Exception) { 00129 throw ivd_Error(ie_PRECONDITION, "Target medium does not exist."); 00130 } 00131 00132 if (m_targetMedium->status & rmdb_MEDIUM_UNUSABLE) { 00133 throw ivd_Error(ie_PRECONDITION, 00134 "Medium " + string(m_targetMedium->barcode) + " is marked unusable.", true); 00135 } 00136 00137 if (m_targetMedium->status & rmdb_MEDIUM_UNRELIABLE) { 00138 throw ivd_Error(ie_PRECONDITION, 00139 "Medium " + string(m_targetMedium->barcode) + " is marked unusable.", true); 00140 } 00141 00142 if (strlen(m_targetMedium->mediaPoolName) == 0) { 00143 log_DBG_m(dbg_NORM, "OK. Target medium does not belong to any pool."); 00144 } 00145 else { 00146 try { 00147 i_MediaPool_t_var tgtPool; 00148 ipc_EXEC_m( 00149 tgtPool = m_rm->SelectMediaPool(m_targetMedium->mediaPoolName); 00150 ); 00151 if(strlen(tgtPool->partitionUUIDString) == 0) { 00152 log_DBG_m(dbg_NORM, 00153 "OK. Pool \'" << m_targetMedium->mediaPoolName << 00154 "\' does not belong to any partition."); 00155 } 00156 else { 00157 i_Partition_t_var tgtPart; 00158 ipc_EXEC_m( 00159 tgtPart = m_rm->SelectPartitionByUUID(tgtPool->partitionUUIDString); 00160 ); 00161 ostringstream sstr; 00162 sstr 00163 << "Target medium " << m_targetMedium->barcode 00164 << " already belongs to partition \'" << tgtPart->partitionName 00165 << "\'."; 00166 throw ivd_Error(ie_PRECONDITION, sstr.str()); 00167 } 00168 } catch (ivd_Exception &e) { 00169 if (e.GetError() == ie_PRECONDITION) 00170 throw; 00171 00172 ostringstream sstr; 00173 sstr 00174 << "Can't get RMDB record for pool \'" 00175 << m_targetMedium->mediaPoolName 00176 << "\'. Call support: possible database corruption."; 00177 throw ivd_Error(ie_PRECONDITION, sstr.str(), true); 00178 } 00179 } 00180 00181 if( strlen( m_targetMedium->libraryName ) == 0 ) 00182 { 00183 ostringstream sstr; 00184 sstr 00185 << "Target medium " << m_targetMedium->barcode 00186 << " is either a diskmedium or not located in a library."; 00187 throw ivd_Error(ie_PRECONDITION, sstr.str()); 00188 } 00189 00190 // 00191 // Check if some there are some volumes configured for target medium. 00192 // 00193 // Low probability, because the above check filters most of such cases out. 00194 // Overridable with --force 00195 // 00196 { 00197 i_MediumVolSeq_t_var targetVol; 00198 ipc_EXEC_m( 00199 targetVol = m_rm->SelectAllMediumVolByBarcode(a_targetMedBC.c_str()); 00200 ); 00201 if (targetVol->length() != 0 && !a_forced) { 00202 throw ivd_Error(ie_PRECONDITION, 00203 "Target medium already initialized. Use force option.", true); 00204 } 00205 } 00206 00207 // OK, checks passed. 00208 00209 i_ResourceList_t resources; 00210 resources.length(2); 00211 ipc_Init::ResourceInit(resources[0]); 00212 resources[0].resNum = 0; 00213 resources[0].mediumKey = m_sourceMedium->mediumKey; 00214 resources[0].barcode = CORBA::string_dup(string(m_sourceMedium->barcode).c_str()); 00215 resources[0].blockSize = m_sourceMedium->blockSize; 00216 resources[0].poolKey = mpool->mediaPoolKey; 00217 resources[0].poolType = mpool->mediaPoolType; 00218 resources[0].mediumFamily = mpool->mediaFamily; 00219 00220 ipc_Init::ResourceInit(resources[1]); 00221 resources[1].resNum = 1; 00222 resources[1].mediumKey = m_targetMedium->mediumKey; 00223 resources[1].barcode = CORBA::string_dup(string(m_targetMedium->barcode).c_str()); 00224 resources[1].blockSize = m_sourceMedium->blockSize; 00225 resources[1].poolKey = 0; 00226 resources[1].medVolNr = 0; 00227 resources[1].mediumFamily = mpool->mediaFamily; 00228 00229 SetResources(resources); 00230 m_activeBeas.resize(2); 00231 InitBeaStatus(2); 00232 log_DBG_m(dbg_LOW, "" << endl << 00233 "Duplication Job Created:" << endl << 00234 ipc_Log::LogJobParams(m_iJobParams) << endl << 00235 ipc_Log::LogResources(GetResources()) << endl); 00236 }

| i_MediumDupl_i::~i_MediumDupl_i | ( | ) | [virtual] |
Definition at line 238 of file i_mediumdupl_impl.cpp.
References dbg_NORM, cmn_File::DeleteF(), cmn_Global::dirs, ivd_Directories::diskbuf, i_JobParams::diskBufferFS, g_cmn, cmn_FastDirLst::GetNextName(), ift_FILE, log_DBG_m, log_FUNC_m, i_Job_i::m_iJobParams, m_medVolInRmdb, and i_Job_i::ReleaseDiskBuffer().
00238 { 00239 log_FUNC_m(~i_MediumDupl_i); 00240 // Delete all diskbuffer files. 00241 00242 cmn_FastDirLst volFiles(g_cmn.dirs.diskbuf + m_iJobParams.diskBufferFS); 00243 00244 string fileName; 00245 ivd_GenInode_t inode; 00246 ivd_FileType_e type; 00247 00248 while ( !(fileName = volFiles.GetNextName(inode, type)).empty() ) { 00249 if ((fileName.compare(".") == 0) || (fileName.compare("..") == 0) ) { 00250 continue; 00251 } 00252 00253 if (type == ift_FILE) { 00254 for (UInt32_t i(0); i < m_medVolInRmdb.length(); i++){ 00255 if ( fileName.compare( 0, 00256 fileName.size()-2, 00257 m_medVolInRmdb[i].medVolId ) == 0 ){ 00258 try { 00259 log_DBG_m(dbg_NORM, "Deleting file " << fileName); 00260 cmn_File deleteMe(g_cmn.dirs.diskbuf + m_iJobParams.diskBufferFS + fileName); 00261 deleteMe.DeleteF(); 00262 } catch (...) { 00263 // ignore this error 00264 } 00265 } 00266 } 00267 } 00268 } 00269 00270 ReleaseDiskBuffer(); 00271 }

| void i_MediumDupl_i::MediumOperationComplete | ( | i_Index_t | beaNumber, | |
| i_CompletionStatus_e | a_status | |||
| ) | [virtual] |
Implements i_Job_i.
Definition at line 274 of file i_mediumdupl_impl.cpp.
References mif_VolStatus::AllSuccess(), cmn_Condition::Broadcast(), bs_NOT_RUNNING, bs_RUNNING, CompleteJob(), dbg_LOW, dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, i_Job_i::Finished(), mif_VolStatus::GetCurrentSourceVol(), mif_VolStatus::GetCurrentTargetVol(), i_Job_i::GetResources(), i_FAILED, i_SUCCEDED, ipc_EXEC_m, i_Job_i::IsAborted(), job_POST_MED_PROC, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), 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, m_medVolInRmdb, i_Job_i::m_rm, m_sourceMedium, i_Job_i::m_status, m_targetMedium, m_ui, m_volStatus, i_Resource_t::medVolNr, i_Job_i::ReleaseResource(), i_Job_i::Remove(), i_Resource_t::resProcessed, i_Job_i::SetBeaStatus(), i_Job_i::SetResMedOpComplete(), i_Job_i::SetResources(), i_Job_i::SetResProcessed(), i_Job_i::SetResRequested(), i_Job_i::SetStatus(), mif_VolStatus::SourceFinished(), mif_VolStatus::SourceVolRead(), mif_VolStatus::TargetFinished(), and mif_VolStatus::TargetVolWrite().
00277 { 00278 log_FUNC_m(MediumOperationComplete); 00279 log_DBG_m(dbg_NORM, "a_beaNumber" << a_beaNumber); 00280 00281 if (IsAborted()){ 00282 return; 00283 } 00284 00285 { 00286 cmn_MutexLock l(m_beasStatus_x); 00287 SetBeaStatus(a_beaNumber, bs_RUNNING); 00288 } 00289 00290 if (a_beaNumber == 0){ // Source Bea 00291 UInt32_t currVol = m_volStatus.GetCurrentSourceVol(); 00292 00293 if (a_status == i_SUCCEDED) { 00294 ostringstream msg; 00295 msg << "Medium " << m_sourceMedium->barcode << ", " 00296 << "volume " << currVol << ": Volume read and written to disk buffer."; 00297 00298 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00299 log_WriteEvent(msg.str(), evt_ADMINJOB, 00300 m_iJobParams.jobID, string(m_sourceMedium->barcode)); 00301 00302 msg << m_medVolInRmdb[currVol - 1].medVolId << "."; 00303 log_DBG_m(dbg_NORM, msg.str()); 00304 00305 m_volStatus.SourceVolRead(true); 00306 // if this is first source volume call GetResources for target volume 00307 if ((currVol == 1) && 00308 !(GetResources()[1].resRequested)) { 00309 ipc_EXEC_m ( 00310 SetResRequested(1); 00311 i_ResourceList_t tmpRes; 00312 tmpRes.length(1); 00313 tmpRes[0] = GetResources()[1]; 00314 00315 m_rm->GetResources( m_iJob, 00316 m_iJobParams, 00317 tmpRes); 00318 ); 00319 } 00320 } else { // NOT success 00321 m_volStatus.SourceVolRead(false); 00322 ostringstream msg; 00323 msg << "Could not read medium volume: " 00324 << m_medVolInRmdb[currVol - 1].medVolId << "."; 00325 00326 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());) 00327 log_WriteEvent(msg.str(), evt_ADMINJOB, 00328 m_iJobParams.jobID, string(m_sourceMedium->barcode)); 00329 log_ERR_m(msg.str()); 00330 } 00331 if (m_volStatus.SourceFinished()){ 00332 SetResMedOpComplete(a_beaNumber); 00333 // release resource 00334 log_DBG_m(dbg_NORM, "ReleaseResource(a_beaNumber):" << a_beaNumber); 00335 00336 ostringstream msg; 00337 msg << "Releasing source medium resources."; 00338 00339 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00340 log_WriteEvent(msg.str(), evt_ADMINJOB, 00341 m_iJobParams.jobID, string(m_sourceMedium->barcode)); 00342 00343 ReleaseResource(a_beaNumber); 00344 SetResProcessed(a_beaNumber); 00345 cmn_MutexLock l(m_beasStatus_x); 00346 ipc_EXEC_m(m_activeBeas[a_beaNumber]->Remove();); 00347 SetBeaStatus(a_beaNumber, bs_NOT_RUNNING); 00348 } else { 00349 i_Resource_t tmpRes; 00350 tmpRes = GetResources()[a_beaNumber]; 00351 tmpRes.resProcessed = false; 00352 SetResources(tmpRes); 00353 } 00354 cmn_MutexLock l(m_activate_x); 00355 m_activate_c.Broadcast(); 00356 } 00357 00358 if (a_beaNumber == 1){ // Target Bea 00359 00360 UInt32_t currVol = m_volStatus.GetCurrentTargetVol(); 00361 if (a_status == i_SUCCEDED) { 00362 ostringstream msg; 00363 msg << "Medium " << m_targetMedium->barcode << ", " 00364 << "volume " << currVol << ": Volume read and written to medium."; 00365 00366 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00367 log_WriteEvent(msg.str(), evt_ADMINJOB, 00368 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00369 00370 msg << m_medVolInRmdb[currVol - 1].medVolId << "."; 00371 log_DBG_m(dbg_NORM, msg.str()); 00372 00373 m_volStatus.TargetVolWrite(true); 00374 } else { // NOT success 00375 ostringstream msg; 00376 msg << "Could not write medium volume: " 00377 << m_medVolInRmdb[currVol - 1].medVolId << "."; 00378 00379 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00380 log_WriteEvent(msg.str(), evt_ADMINJOB, 00381 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00382 log_ERR_m(msg.str()); 00383 00384 m_volStatus.TargetVolWrite(false); 00385 Finished(); 00386 m_status = i_FAILED; 00387 } 00388 if (m_volStatus.TargetFinished()){ 00389 SetResMedOpComplete(a_beaNumber); 00390 // release resource 00391 i_Resource_t tmpRes = GetResources()[1]; 00392 tmpRes.medVolNr = 0; 00393 tmpRes.resProcessed = true; 00394 SetResources(tmpRes); 00395 00396 ostringstream msg; 00397 msg << "Releasing target medium resources."; 00398 00399 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00400 log_WriteEvent(msg.str(), evt_ADMINJOB, 00401 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00402 00403 ReleaseResource(a_beaNumber); 00404 SetStatus(job_POST_MED_PROC); 00405 } else { 00406 i_Resource_t tmpRes; 00407 tmpRes = GetResources()[a_beaNumber]; 00408 tmpRes.resProcessed = false; 00409 SetResources(tmpRes); 00410 } 00411 cmn_MutexLock l(m_activate_x); 00412 m_activate_c.Broadcast(); 00413 } 00414 00415 if (m_volStatus.SourceFinished() && 00416 m_volStatus.TargetFinished()){ 00417 log_DBG_m(dbg_LOW, "job finished"); 00418 if (m_volStatus.AllSuccess()){ 00419 m_status = i_SUCCEDED; 00420 CompleteJob(i_SUCCEDED); 00421 } 00422 } 00423 }

| void i_MediumDupl_i::CompleteJob | ( | i_CompletionStatus_e | status | ) | [virtual] |
Implements i_Job_i.
Definition at line 427 of file i_mediumdupl_impl.cpp.
References ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, i_Job_i::GetResources(), i_SUCCEDED, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, i_JobParams::jobID, log_FUNC_m, log_WriteEvent(), i_Job_i::m_iJobParams, m_ui, i_Resource_t::medVolNr, i_Job_i::Remove(), and i_Job_i::SetResources().
Referenced by MediumOperationComplete().
00427 { 00428 log_FUNC_m(CompleteJob); 00429 try { 00430 ostringstream msg; 00431 msg << "[" << m_iJobParams.jobID << 00432 "] "; 00433 00434 if (a_status == i_SUCCEDED) 00435 msg << "Finished."; 00436 else 00437 msg << "Failed."; 00438 00439 log_WriteEvent(msg.str(), evt_ADMINJOB, 00440 m_iJobParams.jobID); 00441 m_ui.DisplayMessage(msg.str()); 00442 00443 // bug 1511 Set currentVolume of target resource to 0 00444 i_Resource_t tmpRes = GetResources()[1]; 00445 tmpRes.medVolNr = 0; 00446 SetResources(tmpRes); 00447 00448 ipc_EXEC_m(Remove()); 00449 } 00450 ipc_CATCH_IVD_THROW_CORBA_m 00451 }


| void i_MediumDupl_i::AssignResources | ( | const i_ResourceList_t & | a_resources | ) | [virtual] |
Reimplemented from i_Job_i.
Definition at line 453 of file i_mediumdupl_impl.cpp.
References i_Job_i::AssignResources(), dbg_LOW, ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, i_Job_i::GetResources(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogJobParams(), ipc_Log::LogResources(), i_Job_i::m_iJobParams, and m_ui.
00453 { 00454 log_FUNC_m(AssignResources); 00455 00456 log_DBG_m(dbg_LOW,"Job: " << m_iJobParams.jobID << 00457 " got Resources:" << endl << 00458 ipc_Log::LogResources(a_resources) ); 00459 00460 try { 00461 00462 ostringstream msg; 00463 if (a_resources[0].resNum == 0){ 00464 msg << "Source"; 00465 } 00466 else { 00467 msg << "Target"; 00468 } 00469 msg << " resources allocated."; 00470 00471 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00472 log_WriteEvent(msg.str(), evt_ADMINJOB, 00473 m_iJobParams.jobID); 00474 00475 i_Job_i::AssignResources(a_resources); 00476 00477 log_DBG_m(dbg_LOW, "" << endl << 00478 "Medium Duplicate Job:" << endl << 00479 ipc_Log::LogJobParams(m_iJobParams) << endl << 00480 ipc_Log::LogResources(GetResources()) << endl); 00481 00482 } ipc_CATCH_IVD_THROW_CORBA_m; 00483 } // AssignResources

| void i_MediumDupl_i::GetNewResources | ( | i_Index_t | resourceNumber | ) | [virtual] |
Implements i_Job_i.
Definition at line 485 of file i_mediumdupl_impl.cpp.
References ie_IMPOSSIBLE, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, and log_FUNC_m.
00485 { 00486 log_FUNC_m(GetNewResources); 00487 // Not Implemented for MediumDupl 00488 try { 00489 throw ivd_Error(ie_IMPOSSIBLE); 00490 } 00491 ipc_CATCH_IVD_THROW_CORBA_m 00492 }
| bool i_MediumDupl_i::Process | ( | UInt32_t | a_beaNum | ) |
Definition at line 514 of file i_mediumdupl_impl.cpp.
References i_Job_i::ActivateBea(), bs_PROCESSING, bs_RUNNING, dbg_LOW, dbg_NORM, ui_MsgWriter::DisplayError(), ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, evt_ERROR, mif_VolStatus::GetCurrentSourceVol(), mif_VolStatus::GetCurrentTargetVol(), i_Job_i::GetJobTypeText(), mif_VolStatus::GetNumOfVol(), i_Job_i::GetResources(), ie_IMPOSSIBLE, ie_JOB_FAILED, ie_PRECONDITION, ipc_EXEC_m, i_Job_i::IsAborted(), ivd_Error, i_JobParams::jobID, i_Job_i::LoadUnload(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, i_Job_i::m_activeBeas, i_Job_i::m_beasStatus_x, i_Job_i::m_iJobParams, m_medVolInRmdb, m_sourceBeaRunning, m_sourceMedium, m_sourceMedSize, m_srcMediumFull, m_targetBeaRunning, m_targetMedium, m_ui, m_volStatus, i_Resource_t::medVolId, i_Resource_t::medVolNr, i_Resource_t::medVolType, PreFormat(), rmdb_MEDVOL_FULL, rmdb_SYSTEM_VOLUME, i_Job_i::SetBeaStatus(), i_Job_i::SetResources(), i_Job_i::SetResProcessed(), and mif_VolStatus::SourceVolRead().
Referenced by Execute().
00514 { 00515 log_FUNC_m(Process); 00516 00517 if (a_beaNum == 0 ){ 00518 UInt32_t volNum = m_volStatus.GetCurrentSourceVol(); 00519 log_DBG_m(dbg_NORM, "Processing SourceVolume: " << volNum); 00520 00521 i_Resource_t tmpRes = GetResources()[a_beaNum]; 00522 tmpRes.medVolId = m_medVolInRmdb[volNum - 1].medVolId; 00523 00524 log_DBG_m(dbg_NORM, "SourceVolume medVolID: " << tmpRes.medVolId); 00525 tmpRes.medVolNr = m_medVolInRmdb[volNum - 1].medVolNr; 00526 00527 SetResources(tmpRes); 00528 00529 // if ( !m_sourceBeaRunning ){ 00530 LoadUnload(a_beaNum); 00531 ostringstream msg2; 00532 msg2 << "Starting Back End Agent for medium: "; 00533 msg2 << m_sourceMedium->barcode; 00534 00535 ipc_EXEC_m(m_ui.DisplayMessage(msg2.str());); 00536 00537 log_WriteEvent(msg2.str(), evt_ADMINJOB, 00538 m_iJobParams.jobID); 00539 00540 { 00541 cmn_MutexLock l(m_beasStatus_x); 00542 ActivateBea(a_beaNum); 00543 SetBeaStatus(a_beaNum, bs_RUNNING); 00544 } 00545 m_sourceBeaRunning = true; 00546 // } 00547 00548 00549 ostringstream msg; 00550 msg << "Medium " << m_sourceMedium->barcode << ", " 00551 << "volume " << volNum << ": Reading volume identification..."; 00552 00553 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00554 log_WriteEvent(msg.str(), evt_ADMINJOB, 00555 m_iJobParams.jobID, string(m_sourceMedium->barcode)); 00556 00557 ipc_EXEC_m(m_sourceMedSize = m_activeBeas[a_beaNum]->GetMediumSize();); 00558 00559 if (volNum == 1) { 00560 ipc_EXEC_m( 00561 i_VolSizes_t_var volumeSizes = 00562 m_activeBeas[a_beaNum]->GetVolumeSizes(); 00563 log_DBG_m(dbg_NORM, "Volumes on source medium:" << volumeSizes->length()); 00564 if (volumeSizes->length() != m_volStatus.GetNumOfVol()){ 00565 ostringstream os; 00566 os << "Source medium contains empty or non-HSM volumes."; 00567 log_WriteEvent(evt_ERROR, os.str(), 00568 GetJobTypeText(), m_iJobParams.jobID); 00569 00570 log_ERR_m( "[" << m_iJobParams.jobID << "] " << os.str()); 00571 ipc_EXEC_m(m_ui.DisplayMessage(os.str());); 00572 throw ivd_Error(ie_JOB_FAILED, os.str()); 00573 } 00574 ); 00575 } 00576 00577 ostringstream msg1; 00578 msg1 << "Medium " << m_sourceMedium->barcode << ", " 00579 << "volume " << volNum << ": Reading data."; 00580 00581 ipc_EXEC_m(m_ui.DisplayMessage(msg1.str());); 00582 log_WriteEvent(msg1.str(), evt_ADMINJOB, 00583 m_iJobParams.jobID, string(m_sourceMedium->barcode)); 00584 00585 00586 if ( (m_medVolInRmdb[volNum - 1].volType != rmdb_SYSTEM_VOLUME) && 00587 ((m_medVolInRmdb[volNum - 1].status & rmdb_MEDVOL_FULL) == 0) ) 00588 { 00589 // VolDupWrite for open volume 00590 ostringstream msgO; 00591 msgO << "Duplication of open Volume. Barcode:" << 00592 m_sourceMedium->barcode << 00593 " volNum: " << volNum; 00594 log_WriteEvent(msgO.str(), evt_ADMINJOB, m_iJobParams.jobID); 00595 log_WRN_m(msgO.str()); 00596 ipc_EXEC_m(m_ui.DisplayMessage(msgO.str());); 00597 } 00598 SetResProcessed(0); 00599 // read volume 00600 ipc_EXEC_m( 00601 cmn_MutexLock l(m_beasStatus_x); 00602 m_activeBeas[a_beaNum]->VolDupRead(); 00603 SetBeaStatus(a_beaNum, bs_PROCESSING); 00604 ); 00605 } 00606 else if (a_beaNum == 1) { 00607 UInt32_t volNum = m_volStatus.GetCurrentTargetVol(); 00608 log_DBG_m(dbg_NORM, "Processing TargetVolume: " << volNum); 00609 if (!m_volStatus.SourceVolRead(volNum)) { 00610 log_DBG_m(dbg_NORM, "Volume: " << volNum << " Not yet ready for processing"); 00611 return false; 00612 } 00613 00614 i_Resource_t tmpRes = GetResources()[1]; 00615 tmpRes.medVolId = m_medVolInRmdb[volNum - 1 ].medVolId; 00616 tmpRes.medVolNr = m_medVolInRmdb[volNum - 1 ].medVolNr; 00617 tmpRes.medVolType = m_medVolInRmdb[volNum - 1 ].volType; 00618 SetResources(tmpRes); 00619 00620 // if ( !m_targetBeaRunning ){ 00621 LoadUnload(a_beaNum); 00622 ostringstream msg2; 00623 msg2 << "Starting Back End Agent for medium: "; 00624 msg2 << m_targetMedium->barcode; 00625 00626 ipc_EXEC_m(m_ui.DisplayMessage(msg2.str());); 00627 00628 log_WriteEvent(msg2.str(), evt_ADMINJOB, 00629 m_iJobParams.jobID); 00630 00631 { 00632 cmn_MutexLock l(m_beasStatus_x); 00633 ActivateBea(a_beaNum); 00634 SetBeaStatus(a_beaNum, bs_RUNNING); 00635 } 00636 m_targetBeaRunning = true; 00637 SetResProcessed(1); 00638 // } 00639 00640 if (volNum == 1) { 00641 // Get Volume Sizes 00642 00643 ostringstream msg2; 00644 msg2 << "Checking medium format."; 00645 00646 ipc_EXEC_m(m_ui.DisplayMessage(msg2.str());); 00647 log_WriteEvent(msg2.str(), evt_ADMINJOB, 00648 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00649 00650 00651 UInt32_t targetMedSize; 00652 ipc_EXEC_m( 00653 targetMedSize = m_activeBeas[a_beaNum]->GetMediumSize(); 00654 ); 00655 00656 log_DBG_m(dbg_LOW, "m_sourceMedSize=" << m_sourceMedSize << 00657 ", targetMedSize=" << targetMedSize); 00658 00659 if (targetMedSize < m_sourceMedSize){ 00660 ostringstream msg3; 00661 msg3 << "Target medium is of smaller size than source medium."; 00662 00663 ipc_EXEC_m(m_ui.DisplayError(msg3.str());); 00664 log_WriteEvent(msg3.str(), evt_ADMINJOB, 00665 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00666 00667 throw ivd_Error(ie_PRECONDITION, msg3.str()); 00668 } 00669 00670 ostringstream msg; 00671 msg << "Medium " << m_sourceMedium->barcode 00672 << ": Will format medium ..."; 00673 ipc_EXEC_m( 00674 m_ui.DisplayMessage(msg.str()); 00675 ); 00676 log_WriteEvent("Will format medium ...", evt_ADMINJOB, 00677 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00678 PreFormat(); 00679 00680 if (IsAborted()) return false; 00681 00682 }// if (volNum == 1) 00683 00684 bool appendVolume(true); 00685 log_DBG_m(dbg_NORM, "[" << m_iJobParams.jobID << 00686 "] " <<"volNum:" << volNum << 00687 " m_medVolInRmdb.length():" << m_medVolInRmdb.length()); 00688 if (volNum == m_medVolInRmdb.length() ) {// is it the last volume? 00689 appendVolume = false; 00690 } 00691 00692 ostringstream msg; 00693 msg << "Medium " << m_targetMedium->barcode; 00694 msg << ", " << "volume " << volNum << ": Writing Data..."; 00695 00696 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00697 log_WriteEvent(msg.str(), evt_ADMINJOB, 00698 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00699 00700 log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID << 00701 "] " << "Calling VolDupWrite appendVolume:" << 00702 boolalpha << appendVolume << 00703 " Size:" << m_medVolInRmdb[volNum - 1].volSize); 00704 00705 ipc_EXEC_m( 00706 cmn_MutexLock l(m_beasStatus_x); 00707 m_activeBeas[a_beaNum]->VolDupWrite( 00708 m_medVolInRmdb[volNum - 1].volSize, 00709 appendVolume, 00710 m_srcMediumFull 00711 ); 00712 SetBeaStatus(a_beaNum, bs_PROCESSING); 00713 ); 00714 } else { // bea number is not 0 and not 1 00715 throw ivd_Error(ie_IMPOSSIBLE); 00716 }; 00717 return true; 00718 }


| void i_MediumDupl_i::SetResourceBusyStatus | ( | i_Index_t | a_resNum, | |
| i_ResourceBusy_e | a_resStatus | |||
| ) |
Reimplemented from i_Job_i.
Definition at line 869 of file i_mediumdupl_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(), ipc_Log::ResourceBusy(), i_Resource_t::resourceBusyStatus, and i_Job_i::SetResources().
00870 { 00871 log_FUNC_m(SetResourceBusyStatus); 00872 00873 try { 00874 i_Resource_t tmpRes; 00875 tmpRes = GetResources()[a_resNum]; 00876 tmpRes.resourceBusyStatus = a_resStatus; 00877 SetResources(tmpRes); 00878 00879 ostringstream msg; 00880 00881 msg << ipc_Log::ResourceBusy(a_resStatus); 00882 00883 if (a_resStatus == i_MEDIUM_BUSY || 00884 a_resStatus == i_MEDIUM_NOT_AVAILABLE){ 00885 00886 msg << " <"; 00887 //waiting for medium <bc: 000123> 00888 msg << "bc: " << 00889 tmpRes.barcode << ">"; 00890 } 00891 00892 log_WriteEvent(evt_INFO, msg.str()); 00893 // Workaround for bug 8652 GUI deadlock 00894 // m_ui.DisplayMessage(msg.str()); 00895 00896 } ipc_CATCH_IVD_THROW_CORBA_m; 00897 }

| i_JobRequestList_t * i_MediumDupl_i::GetFiles | ( | ) | [virtual] |
Implements i_Job_i.
Definition at line 495 of file i_mediumdupl_impl.cpp.
References ie_IMPOSSIBLE, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, and log_FUNC_m.
00495 { 00496 log_FUNC_m(GetFiles); 00497 try { 00498 throw ivd_Error(ie_IMPOSSIBLE); 00499 } 00500 ipc_CATCH_IVD_THROW_CORBA_m 00501 }
| i_FSC_ptr i_MediumDupl_i::GetFSC | ( | ) | [virtual] |
Implements i_Job_i.
Definition at line 503 of file i_mediumdupl_impl.cpp.
References ie_IMPOSSIBLE, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, and log_FUNC_m.
00503 { 00504 log_FUNC_m(GetFSC); 00505 try { 00506 i_FSC_ptr dummy; 00507 throw ivd_Error(ie_IMPOSSIBLE); 00508 return dummy; 00509 } 00510 ipc_CATCH_IVD_THROW_CORBA_m 00511 }
| void i_MediumDupl_i::CheckTargetMedium | ( | ) | [private] |
Definition at line 899 of file i_mediumdupl_impl.cpp.
References i_Job_i::ActivateBea(), bs_RUNNING, dbg_DETAIL, dbg_NORM, ui_MsgWriter::DisplayError(), ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, evt_DUPLJOB, evt_ERROR, ivd_BaseException::GetFriendly(), i_Job_i::GetResources(), i_RESOURCE_ERROR, i_VOL_BLANK, i_VOL_ECMA, i_VOL_IVD, i_VOL_IVD_NT, i_VOL_OTHER, i_VOL_TAR, ie_MED_VOL_HDR_EXISTS, ie_MEDIUM_PARTITIONED, ie_PRECONDITION, ipc_EXEC_m, ivd_Error, ivd_MediaTypeToFamily(), job_MED_PROC, i_JobParams::jobID, i_Job_i::LoadUnload(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), ipc_Log::LogVolInfo(), i_Job_i::m_activate_c, i_Job_i::m_activate_x, i_Job_i::m_activeBeas, i_Job_i::m_beasStatus_x, m_forced, i_Job_i::m_iJob, i_Job_i::m_iJobParams, i_Job_i::m_rm, m_sourceMedium, i_Job_i::m_status, m_targetBeaRunning, m_targetMedium, m_ui, i_Job_i::NeedsProcess(), PreFormat(), i_Job_i::ReleaseResource(), i_Job_i::SetBeaStatus(), i_Job_i::SetResProcessed(), i_Job_i::SetResRequested(), i_Job_i::SetStatus(), and cmn_Condition::Wait().
Referenced by Execute().
00899 { 00900 log_FUNC_m(CheckTargetMedium); 00901 SetStatus(job_MED_PROC); 00902 { 00903 //request resources 00904 cmn_MutexLock l(m_activate_x); 00905 try { 00906 ipc_EXEC_m( 00907 i_ResourceList_t tmpRes; 00908 tmpRes.length(1); 00909 SetResRequested(1); 00910 tmpRes[0] = GetResources()[1]; 00911 m_rm->GetResources( 00912 m_iJob, 00913 m_iJobParams, 00914 tmpRes); 00915 ); 00916 } 00917 catch (ivd_Exception){ 00918 ostringstream msg; 00919 msg << "[" << m_iJobParams.jobID << 00920 "] " << "GetResources failed."; 00921 log_WriteEvent(msg.str(), evt_ADMINJOB, 00922 m_iJobParams.jobID); 00923 m_ui.DisplayMessage(msg.str()); 00924 log_ERR_m(msg.str()); 00925 m_status = i_RESOURCE_ERROR; 00926 throw; 00927 } 00928 //wait for rm to call back with resources 00929 m_activate_c.Wait(); 00930 } 00931 if (!NeedsProcess(1)){ 00932 log_ERR_m("Job started with check but resources not assigned."); 00933 } 00934 00935 //prepare medium 00936 LoadUnload(1); 00937 00938 ostringstream msg2; 00939 msg2 << "Starting Back End Agent for medium: "; 00940 msg2 << m_targetMedium->barcode; 00941 00942 ipc_EXEC_m(m_ui.DisplayMessage(msg2.str());); 00943 00944 log_WriteEvent(msg2.str(), evt_ADMINJOB, 00945 m_iJobParams.jobID); 00946 00947 { 00948 cmn_MutexLock l(m_beasStatus_x); 00949 ActivateBea(1); 00950 SetBeaStatus(1, bs_RUNNING); 00951 } 00952 m_targetBeaRunning = true; 00953 00954 //check if there are volumes 00955 i_VolSizes_t_var volumeSizes; 00956 ipc_EXEC_m( 00957 volumeSizes = m_activeBeas[1]->GetVolumeSizes(); 00958 ); 00959 ostringstream msg; 00960 if (volumeSizes->length() > 1){ 00961 log_DBG_m(dbg_NORM, "Several volumes detected on target medium:" << 00962 volumeSizes->length() ); 00963 if (m_forced){ 00964 log_DBG_m(dbg_NORM, "Forced mode starting Format"); 00965 PreFormat(); 00966 } 00967 else { 00968 msg << "Target medium already formated. Duplication not allowed." << 00969 " Use --force option to override."; 00970 00971 ipc_EXEC_m(m_ui.DisplayMessage(msg.str());); 00972 log_WriteEvent(evt_ERROR, msg.str(), evt_DUPLJOB, 00973 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00974 throw ivd_Error(ie_MEDIUM_PARTITIONED, msg.str()); 00975 } 00976 } // if (volumeSizes->length() > 1 00977 00978 i_VolInfo_t_var volInfo; 00979 try { 00980 ipc_EXEC_m( 00981 volInfo = m_activeBeas[1]->GetVolInfo(1); 00982 ); 00983 log_DBG_m(dbg_DETAIL, "[" << m_iJobParams.jobID << 00984 "] " << "Found volume" << 00985 endl << ipc_Log::LogVolInfo(volInfo)); 00986 00987 if (ivd_MediaTypeToFamily(static_cast<ivd_MediaType_e>(volInfo->mediumType)) != 00988 ivd_MediaTypeToFamily(static_cast<ivd_MediaType_e>(m_sourceMedium->mediumType))){ 00989 throw ivd_Error(ie_PRECONDITION, 00990 "Source and target medium are not of same Media Family."); 00991 } 00992 00993 00994 00995 switch (volInfo->type) { 00996 case i_VOL_BLANK: 00997 ipc_EXEC_m(m_ui.DisplayMessage("Blank target medium detected.");); 00998 PreFormat(); 00999 // OK 01000 break; 01001 case i_VOL_IVD: 01002 throw ivd_Error(ie_MED_VOL_HDR_EXISTS); 01003 break; 01004 case i_VOL_ECMA: 01005 throw ivd_Error(ie_MED_VOL_HDR_EXISTS); 01006 break; 01007 case i_VOL_TAR: 01008 throw ivd_Error(ie_MED_VOL_HDR_EXISTS); 01009 break; 01010 case i_VOL_IVD_NT: 01011 throw ivd_Error(ie_MED_VOL_HDR_EXISTS); 01012 break; 01013 case i_VOL_OTHER: 01014 // OK 01015 PreFormat(); 01016 break; 01017 } 01018 01019 ReleaseResource(1); 01020 SetResProcessed(1); 01021 } catch (ivd_Exception &e){ 01022 log_ERR_m("[" << m_iJobParams.jobID << 01023 "] " << "Get volume info failed:" << endl << e); 01024 msg << "Failed retrieving volume info (" << e.GetFriendly() << ")."; 01025 log_WriteEvent(evt_ERROR, msg.str(), evt_DUPLJOB, 01026 m_iJobParams.jobID, string(m_targetMedium->barcode)); 01027 ipc_EXEC_m(m_ui.DisplayError(msg.str());); 01028 throw; 01029 } 01030 }


| void i_MediumDupl_i::PreFormat | ( | ) | [private] |
Definition at line 722 of file i_mediumdupl_impl.cpp.
References dbg_LOW, ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, ipc_EXEC_m, i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), i_Job_i::m_activeBeas, i_Job_i::m_iJobParams, i_Job_i::m_rm, m_sourceMedium, m_targetMedium, m_ui, i_MediaPool_t::mediaFamily, and mf_AIT.
Referenced by CheckTargetMedium(), and Process().
00722 { 00723 log_FUNC_m(PreFormat); 00724 i_VolSizes_t volSizes; 00725 //if source medium is AIT and has more than 1 volume, format target medium in AIT mode 00726 bool duplAITMode(false); 00727 i_MediaPool_t* rmPool = m_rm->SelectMediaPool(m_sourceMedium->mediaPoolName); 00728 if (rmPool->mediaFamily == mf_AIT && m_sourceMedium->numOfVolumes > 1){ 00729 duplAITMode = true; 00730 } 00731 volSizes.length(1); 00732 volSizes[0] = 1; 00733 ostringstream msg1; 00734 msg1 << "Medium " << m_targetMedium->barcode << ": Formating Medium " << 00735 m_targetMedium->barcode << "."; 00736 log_DBG_m(dbg_LOW, "[" << m_iJobParams.jobID << 00737 "] " << msg1 ); 00738 ipc_EXEC_m(m_ui.DisplayMessage(msg1.str());); 00739 log_WriteEvent(msg1.str(), evt_ADMINJOB, 00740 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00741 00742 m_activeBeas[1]->Format(volSizes, duplAITMode); 00743 }


| void i_MediumDupl_i::Execute | ( | ) | [private, virtual] |
Second step RM-> ask for source resources
Implements i_Job_i.
Definition at line 746 of file i_mediumdupl_impl.cpp.
References cfg_MEGABYTE, CheckTargetMedium(), dbg_DETAIL, dbg_NORM, ui_MsgWriter::DisplayMessage(), evt_ADMINJOB, evt_WARNING, mif_VolStatus::GetCurrentTargetVol(), i_Job_i::GetResources(), i_FAILED, i_RESOURCE_ERROR, ipc_EXEC_m, i_Job_i::IsAborted(), i_Job_i::IsFinished(), job_MED_PROC, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), i_Job_i::m_activate_x, m_forced, i_Job_i::m_iJob, i_Job_i::m_iJobParams, m_medVolInRmdb, i_Job_i::m_rm, m_sourceDataSize, m_sourceMedium, m_srcMediumFull, i_Job_i::m_status, m_targetMedium, m_ui, m_volStatus, MIF_DATA_COMPRESSION_FACTOR, i_Job_i::NeedsProcess(), Process(), i_Job_i::RequestDiskBuffer(), rmdb_MEDIUM_FULL, i_Job_i::SetResProcessed(), i_Job_i::SetResRequested(), i_Job_i::SetStatus(), mif_VolStatus::SourceVolRead(), and i_Job_i::WaitBeasToFinish().
00746 { 00747 log_FUNC_m(Execute); 00748 00749 if (!m_forced) { 00750 CheckTargetMedium(); 00751 } 00752 try { 00753 // calculate needed space 00754 for (UInt32_t i(0); i < m_medVolInRmdb.length(); i++){ 00755 m_sourceDataSize += (m_medVolInRmdb[i].volSize * m_medVolInRmdb[i].volUsed)/100; 00756 log_DBG_m(dbg_NORM, "[" << m_iJobParams.jobID << 00757 "] " << "SourceVolSize:" << m_medVolInRmdb[i].volSize << 00758 " Sum: " << m_sourceDataSize); 00759 } 00760 00761 m_sourceDataSize *= cfg_MEGABYTE; 00762 00763 UInt64_t dataSize(UInt64_t(m_sourceDataSize * MIF_DATA_COMPRESSION_FACTOR)); 00764 UInt64_t allocated(0); 00765 00766 string mif("mif"); 00767 UInt64_t maxDiskBuff = m_rm->GetMaxDiskBufferSize(mif.c_str()); 00768 00769 RequestDiskBuffer(dataSize, dataSize, allocated, maxDiskBuff); 00770 } 00771 catch (ivd_Exception){ 00772 ostringstream msg; 00773 msg << " ReserveDiskBuffer failed."; 00774 log_WriteEvent(msg.str(), evt_ADMINJOB, 00775 m_iJobParams.jobID); 00776 00777 m_ui.DisplayMessage(msg.str()); 00778 log_ERR_m(msg.str()); 00779 00780 m_status = i_RESOURCE_ERROR; 00781 throw; 00782 } 00783 00785 SetStatus(job_MED_PROC); 00786 try { 00787 ipc_EXEC_m( 00788 i_ResourceList_t tmpRes; 00789 tmpRes.length(1); 00790 SetResRequested(0); 00791 tmpRes[0] = GetResources()[0]; 00792 m_rm->GetResources( 00793 m_iJob, 00794 m_iJobParams, 00795 tmpRes); 00796 ); 00797 } 00798 catch (ivd_Exception){ 00799 ostringstream msg; 00800 msg << "[" << m_iJobParams.jobID << 00801 "] " << "GetResources failed."; 00802 log_WriteEvent(msg.str(), evt_ADMINJOB, 00803 m_iJobParams.jobID); 00804 m_ui.DisplayMessage(msg.str()); 00805 log_ERR_m(msg.str()); 00806 m_status = i_RESOURCE_ERROR; 00807 throw; 00808 } 00809 00810 // if sys volume of source medium is closed/full then the copy of the medium does 00811 // not need to have sys volume of size equal to source sys volume, but just the size 00812 // that is actually taken by FRI. 00813 try { 00814 i_Medium_t_var rmMedium = m_rm->SelectMedium(CORBA::string_dup(m_sourceMedium->barcode)); 00815 00816 if ((rmMedium->status & rmdb_MEDIUM_FULL) == rmdb_MEDIUM_FULL) { 00817 m_srcMediumFull = true; 00818 log_DBG_m(dbg_NORM, "Medium is full."); 00819 } 00820 } catch(...) { 00821 // Ignore all exceptions at this point. 00822 ostringstream sstr; 00823 sstr << "Cannot get medium status from RM"; 00824 00825 log_WriteEvent(evt_WARNING, sstr.str(), "", 00826 m_iJobParams.jobID, string(m_targetMedium->barcode)); 00827 } 00828 00829 try { 00830 while ( !IsFinished() && !IsAborted() ) { 00831 00832 for (UInt32_t i(0); i < GetResources().length(); i++){ 00833 log_DBG_m(dbg_DETAIL, 00834 "[" << m_iJobParams.jobID << 00835 "] " <<"Processing copyNum:" << i << 00836 " resources assigned:" << 00837 GetResources()[i].resAssigned << 00838 " copy processed:" << 00839 GetResources()[i].resProcessed); 00840 00841 if ( NeedsProcess(i) ) { 00842 if (Process(i)){ 00843 SetResProcessed(i); 00844 } 00845 } 00846 } 00847 if (IsAborted()){ 00848 return; 00849 } 00850 00851 00852 cmn_MutexLock l(m_activate_x); 00853 00854 if (!NeedsProcess(0) || 00855 (!NeedsProcess(1) && !m_volStatus.SourceVolRead(m_volStatus.GetCurrentTargetVol())) ){ 00856 // target medium need process but will still wait because source needs to finish first 00857 WaitBeasToFinish(5); 00858 } 00859 00860 } 00861 } 00862 catch (ivd_Exception){ 00863 m_status = i_FAILED; 00864 throw; 00865 } 00866 00867 }

i_Medium_t_var i_MediumDupl_i::m_sourceMedium [private] |
Definition at line 102 of file i_mediumdupl_impl.h.
Referenced by CheckTargetMedium(), Execute(), i_MediumDupl_i(), MediumOperationComplete(), PreFormat(), and Process().
UInt64_t i_MediumDupl_i::m_sourceMedSize [private] |
UInt64_t i_MediumDupl_i::m_sourceDataSize [private] |
bool i_MediumDupl_i::m_srcMediumFull [private] |
mif_VolStatus i_MediumDupl_i::m_volStatus [private] |
Definition at line 106 of file i_mediumdupl_impl.h.
Referenced by Execute(), i_MediumDupl_i(), MediumOperationComplete(), and Process().
i_Medium_t_var i_MediumDupl_i::m_targetMedium [private] |
Definition at line 107 of file i_mediumdupl_impl.h.
Referenced by CheckTargetMedium(), Execute(), i_MediumDupl_i(), MediumOperationComplete(), PreFormat(), and Process().
bool i_MediumDupl_i::m_forced [private] |
Definition at line 110 of file i_mediumdupl_impl.h.
Referenced by CheckTargetMedium(), and Execute().
bool i_MediumDupl_i::m_sourceBeaRunning [private] |
bool i_MediumDupl_i::m_targetBeaRunning [private] |
Definition at line 112 of file i_mediumdupl_impl.h.
Referenced by CheckTargetMedium(), and Process().
ui_MsgWriter i_MediumDupl_i::m_ui [private] |
Definition at line 113 of file i_mediumdupl_impl.h.
Referenced by AssignResources(), CheckTargetMedium(), CompleteJob(), Execute(), i_MediumDupl_i(), MediumOperationComplete(), PreFormat(), and Process().
Definition at line 115 of file i_mediumdupl_impl.h.
Referenced by Execute(), i_MediumDupl_i(), MediumOperationComplete(), Process(), and ~i_MediumDupl_i().
bool i_MediumDupl_i::m_duplSucceeded [private] |
Definition at line 117 of file i_mediumdupl_impl.h.
1.5.6