#include <i_hsm_impl.h>


Definition at line 116 of file i_hsm_impl.h.
Public Member Functions | |
| i_HSM_i (bool &a_hsmRun) | |
| virtual | ~i_HSM_i () |
| void | Remove () |
| i_Count_t | ForceMigration (const i_StringList_t &a_fileNames) |
| i_ActivateResult_t | ActivateFiles (const i_StringList_t &a_fileNames) |
| i_Count_t | ForceRelease (const i_StringList_t &a_fileNames) |
| void | Reconfigure (const i_ClientConf_t &a_clientConf) |
| void | GetInfo (i_HsmInfo_t_out a_hsmInfo) |
| void | ShowStatus (i_UIMessageServer_ptr a_uims, i_BitFlag_t a_showFlags) |
| void | GetCfg (i_ClientConf_t_out a_clientConf) |
| void | ChangeLogLevel (CORBA::Char a_lLevel) |
| void | Recall (const i_Recall_t &a_file, i_JobID_t a_pmJobId, i_BlkSize_t a_blockSize, i_BufType_t a_bufType, const char *a_diskBufferFS, CORBA::Boolean a_succeeded, i_DownloadAgent_ptr a_download) |
| void | EfficientRecall (const i_RecallList_t &a_seqRecallList, i_JobID_t a_pmJobId, i_JobID_t a_hsmJobIndexID, i_BlkSize_t a_blockSize, i_BufType_t a_bufType, const char *a_diskBufferFS, CORBA::Boolean a_succeeded, i_DownloadAgent_ptr a_download) |
| void | RunScripts () |
| i_Count_t | DoMigrationJob (i_BufType_t a_resType, const char *a_diskBufferFS, i_JobID_t a_pmJobId, i_BlkSize_t a_blkSize, i_Count_t a_numCopies, i_MigID_t a_migrationID, const i_JobRequestList_t &a_jobFiles, i_UploadAgent_ptr a_upload) |
| void | CompleteMigration (i_BufType_t a_resType, i_JobID_t a_pmJobId, i_CompletionStatus_e a_status) |
| void | CheckFSCvsIVDFS (i_Count_t a_numFilesPerBatch, CORBA::Short a_sysLoadPct, i_UIMessageServer_ptr a_uims) |
| CORBA::Boolean | IsCheckFSCvsIVDFSRunning () |
| void | Abort (i_HsmTask_e a_hsmTask) |
| i_Status_t | Suspend () |
| void | Continue (i_Status_t a_status) |
| void | TrigRecall (const i_FileList_t &a_files, CORBA::Boolean a_byFileName, i_MigID_t a_migID, const char *a_into) |
| i_Count_t | TrigMigration () |
| void | IVDFSRecover (const i_DataBlock_t &a_friBlock) |
| CORBA::Long | IVDFSPrepareRecovery (bool a_fromScratch, const char *a_incrementalFilePath) |
| CORBA::Boolean | IsHSMReady () |
| i_Count_t | DoDeletion (const i_FileAgeList_t &a_files, i_Count_t &a_missing) |
| void | SetFullAccess (void) |
| void | MigrateByAPI (CORBA::Long a_flags, const char *a_fileName, CORBA::LongLong a_majorColId, CORBA::LongLong a_minorColId, i_JobIDList_t_out a_jobIDs) |
| void | SetReady (bool a_ready) |
| void | SetSendTerminateEvent (bool a_sendTerminateEvent) |
| void | SetLastFscFileID (ivd_RecordIDX_t a_lastFscFileID) |
| ivd_RecordIDX_t | GetLastFscFileID () |
Private Member Functions | |
| bool | PackFile (CORBA::LongLong a_migrationID, hsm_FileHeader &fh, UInt64_t &migSize, df_Packer &packer) |
| bool | UnPackFile (const i_Recall_t &a_file, ivd_FS_File &recallFile, bool manualRecall, UInt64_t &rclSize, df_Unpacker &unpacker) |
| void | TrigEfficientRecall (const i_FileList_t &a_files, bool a_MigrateAfter) |
Private Attributes | |
| UInt32_t | m_numForcedRelease |
| UInt32_t | m_numRecalls |
| UInt32_t | m_numMigs |
| UInt32_t | m_upTime |
| bool | m_ready |
| ready when filter's events are able to cauth | |
| bool | m_shutDownInProgress |
| cmn_Mutex | m_consistencyCheckRun_x |
| bool | m_consistencyCheckRun |
| bool | m_abortCheckFSCvsIVDFS |
| bool & | m_hsmRun |
| bool | m_sendTerminateEvent |
| auto_ptr< hsm_IVDFSRecoverer > | m_recoverer |
| ivd_RecordIDX_t | m_lastFscFileID |
| cmn_Mutex | m_efficientRecall_x |
| log_CLASSID_m | |
| i_HSM_i::i_HSM_i | ( | bool & | a_hsmRun | ) |
Definition at line 151 of file i_hsm_impl.cpp.
References m_hsmRun.
00152 : 00153 m_numForcedRelease(0), 00154 m_numRecalls(0), 00155 m_numMigs(0), 00156 m_upTime(time(NULL)), // set Up time 00157 m_ready(false), 00158 m_shutDownInProgress(false), 00159 m_consistencyCheckRun(false), 00160 m_hsmRun(a_hsmRun), 00161 m_sendTerminateEvent(false) 00162 { 00163 m_hsmRun = true; 00164 } //============================================================================//
| i_HSM_i::~i_HSM_i | ( | ) | [virtual] |
Definition at line 167 of file i_hsm_impl.cpp.
References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_hsmRun, and ipc_Corba::Shutdown().
00167 { 00168 00169 log_FUNC_m(~i_HSM_i); 00170 ipc_Corba::Shutdown(); 00171 log_DBG_m(dbg_DETAIL, "i_HSM IS_DOWN."); 00172 m_hsmRun = false; 00173 }

| void i_HSM_i::Remove | ( | ) | [virtual] |
Reimplemented from i_Component_i.
Definition at line 176 of file i_hsm_impl.cpp.
References dbg_DETAIL, g_fs_api_p, log_DBG_m, log_FUNC_m, m_abortCheckFSCvsIVDFS, m_consistencyCheckRun_x, m_sendTerminateEvent, m_shutDownInProgress, i_Component_i::Remove(), and ivd_FileSystemAPI::TriggerTerminateEvent().
Referenced by main().
00176 { 00177 log_FUNC_m(Remove); 00178 00179 { 00180 cmn_MutexLock l(m_consistencyCheckRun_x); 00181 m_abortCheckFSCvsIVDFS = true; 00182 } 00183 00184 if (m_shutDownInProgress) { 00185 // Was here. 00186 log_DBG_m(dbg_DETAIL, "Remove was already called. Do nothing."); 00187 return; 00188 } 00189 00190 m_shutDownInProgress = true; 00191 00192 if (m_sendTerminateEvent) { 00193 log_DBG_m(dbg_DETAIL, "Sending terminate to fsfilter"); 00194 g_fs_api_p->TriggerTerminateEvent(); 00195 } 00196 00197 // Do any cleanup necessary 00198 i_Component_i::Remove(); 00199 }


| i_Count_t i_HSM_i::ForceMigration | ( | const i_StringList_t & | a_fileNames | ) |
Definition at line 203 of file i_hsm_impl.cpp.
References ClientConf_t::CfgRecallOnly, ivd_FS_File::Close(), cmn_IsSpecialFile(), dbg_NORM, ivd_FS_File::e_Cache, ivd_FS_File::e_MigrateEvt, evt_WARNING, file, g_clientConf_p, g_fs_api_p, ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_offlineFlag, max, ivd_FS_File::Open(), path, cmn_Path::RemoveTrailingPathSeparator(), TrigEfficientRecall(), and ivd_FS_File::TriggerEvent().
00203 { 00204 log_FUNC_m(ForceMigration); 00205 00206 try { 00207 if (g_clientConf_p->CfgRecallOnly) { 00208 throw ivd_Error(ie_PRECONDITION, "Operation not allowed in Recall only mode."); 00209 } 00210 log_DBG_m(dbg_NORM, "Force migration on mountpoint : " << g_fs_api_p->GetRootPath()); 00211 Int32_t numMigrated = 0; 00212 00213 i_FileList_t toRecall; 00214 UInt32_t seqIdx = 0; 00215 CORBA::ULong max = 16; 00216 toRecall.length(max); 00217 00218 for (UInt32_t idx = 0; idx < a_fileNames.length(); idx++){ 00219 cmn_Path path(a_fileNames[idx]); 00220 path.RemoveTrailingPathSeparator(); 00221 00222 cmn_Path rootPath(g_fs_api_p->GetRootPath()); 00223 rootPath.RemoveTrailingPathSeparator(); 00224 if (path == rootPath) { // skip root migration 00225 log_WriteEvent(evt_WARNING, "Cannot migrate root directory."); 00226 numMigrated--; 00227 continue; 00228 } 00229 00230 if (cmn_IsSpecialFile(path)){ 00231 log_DBG_m(dbg_NORM, "Special file: " << path << " Will skip it."); 00232 numMigrated--; 00233 continue; 00234 } 00235 00236 log_DBG_m(dbg_NORM, "file to migrate: " << path); 00237 00238 try { 00239 ivd_FS_File file(*g_fs_api_p, path); 00240 00241 ivd_FS_FileProperty_t fileProp; 00242 try { 00243 file.Open(ivd_FS_File::e_Cache, path); 00244 file.GetProperties(fileProp); 00245 file.Close(); 00246 } 00247 catch (ivd_SysError &ise) { 00248 log_DBG_m(dbg_NORM, "Can't get general inode of fileID " << fileProp.m_fileID 00249 << " Probably not exist. " << ise); 00250 continue; // no file found 00251 } 00252 if (fileProp.m_offlineFlag) { 00253 if (seqIdx >= toRecall.maximum()) { 00254 max *= 2; 00255 toRecall.length(max); 00256 } 00257 00258 toRecall[seqIdx].fileID = fileProp.m_fileID; 00259 toRecall[seqIdx].name = CORBA::string_dup(path.c_str()); 00260 00261 ++seqIdx; 00262 } 00263 else { 00264 file.TriggerEvent(ivd_FS_File::e_MigrateEvt); 00265 } 00266 } 00267 catch (...) { 00268 log_DBG_m(dbg_NORM, "trig migrate failed: " << 00269 path); 00270 continue; 00271 } 00272 numMigrated++; 00273 } 00274 if (seqIdx > 0) { 00275 toRecall.length(seqIdx); 00276 TrigEfficientRecall(toRecall, true); 00277 } 00278 00279 if (numMigrated < 0) { 00280 numMigrated = 0; 00281 } 00282 else if (numMigrated > 0) { 00283 ostringstream sstr; 00284 sstr << "Migration requested by user (#files: " 00285 << numMigrated << ", " << seqIdx << " files are recalled first)."; 00286 log_WriteEvent(sstr.str()); 00287 } 00288 return (UInt32_t)numMigrated; 00289 } 00290 ipc_CATCH_IVD_THROW_CORBA_m; 00291 }

| i_ActivateResult_t i_HSM_i::ActivateFiles | ( | const i_StringList_t & | a_fileNames | ) |
Definition at line 296 of file i_hsm_impl.cpp.
References hsm_FileHeader::AddToReleaseCanList(), ClientConf_t::CfgRecallOnly, ivd_FS_File::Close(), cmn_IsSpecialFile(), dbg_DETAIL, dbg_NORM, hsm_FileHeader::DecrRef(), ivd_FS_File::e_Cache, ivd_FS_File::e_MigrateEvt, evt_WARNING, file, g_clientConf_p, g_fs_api_p, g_hsmDB_p, ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), fio_DataBase::GetTransObj(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, ivd_NULLCHK_m, log_DBG_m, log_FUNC_m, log_WriteEvent(), ivd_FS_FileProperty_t::m_dirtyFlag, ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_offlineFlag, NULL, ivd_FS_File::Open(), path, fio_DataBase::ReleaseTransObj(), cmn_Path::RemoveTrailingPathSeparator(), s_className, and ivd_FS_File::TriggerEvent().
00296 { 00297 log_FUNC_m(ActivateFiles); 00298 00299 try { 00300 if (g_clientConf_p->CfgRecallOnly) { 00301 throw ivd_Error(ie_PRECONDITION, "Operation not allowed in Recall only mode."); 00302 } 00303 log_DBG_m(dbg_NORM, "Control Files on mountpoint : " << g_fs_api_p->GetRootPath()); 00304 i_ActivateResult_t_var activateResult; 00305 activateResult->migListCount = 0; 00306 activateResult->relListCount = 0; 00307 activateResult->noListCount = 0; 00308 00309 for (UInt32_t idx = 0; idx < a_fileNames.length(); idx++){ 00310 00311 cmn_Path path(a_fileNames[idx]); 00312 path.RemoveTrailingPathSeparator(); 00313 00314 cmn_Path rootPath(g_fs_api_p->GetRootPath()); 00315 rootPath.RemoveTrailingPathSeparator(); 00316 00317 if (path == rootPath) { // skip root migration 00318 log_WriteEvent(evt_WARNING, "Cannot migrate root directory."); 00319 activateResult->noListCount++; 00320 continue; 00321 } 00322 00323 if (cmn_IsSpecialFile(path)){ 00324 log_DBG_m(dbg_DETAIL, "Special file: " << path << " Will skip it."); 00325 activateResult->noListCount++; 00326 continue; 00327 } 00328 00329 log_DBG_m(dbg_NORM, "file to control: " << path); 00330 00331 try { 00332 ivd_FS_File file(*g_fs_api_p, path); 00333 00334 ivd_FS_FileProperty_t fileProp; 00335 try { 00336 file.Open(ivd_FS_File::e_Cache, path); 00337 file.GetProperties(fileProp); 00338 file.Close(); 00339 } 00340 catch (ivd_SysError) { 00341 log_DBG_m(dbg_NORM, "Can't get general inode of fileID " << fileProp.m_fileID 00342 << " Probably not exist."); 00343 activateResult->noListCount++; 00344 continue; // no file found 00345 } 00346 00347 if (fileProp.m_offlineFlag) { 00348 log_DBG_m(dbg_NORM, "file is offline, do nothing: " << path); 00349 activateResult->noListCount++; 00350 } 00351 else if (fileProp.m_dirtyFlag) { 00352 log_DBG_m(dbg_NORM, "file is dirty, put to MigCandidate: " << path); 00353 file.TriggerEvent(ivd_FS_File::e_MigrateEvt); 00354 activateResult->migListCount++; 00355 } 00356 else { 00357 //file is online 00358 fio_Transaction &trans = *g_hsmDB_p->GetTransObj(); 00359 log_DBG_m(dbg_NORM, "file is online, put to ReleaseCandidate: " << path); 00360 00361 hsm_FileHeader *hsmOwnFH = NULL; 00362 hsm_FileHeader *hsmOldOwnFH = NULL; 00363 hsm_FileHeader *hsmFH = NULL; 00364 hsm_InoObj *hsmIObj = NULL; 00365 00366 hsmIObj = new hsm_InoObj(fileProp, 0); 00367 00368 ivd_NULLCHK_m(hsmIObj, hsm_InoObj::s_className); 00369 00370 hsmFH = new hsm_FileHeader( fileProp.m_fileID, 00371 path, 00372 "", 00373 hsmOwnFH, 00374 hsmOldOwnFH, 00375 hsmIObj); 00376 00377 ivd_NULLCHK_m(hsmFH, hsm_FileHeader::s_className); 00378 00379 if (hsmOwnFH != NULL) { // now is used, so decrease temporary reference 00380 hsmOwnFH->DecrRef(); 00381 } 00382 if (hsmOldOwnFH != NULL) { // now is used, so decrease temporary reference 00383 hsmOldOwnFH->DecrRef(); 00384 } 00385 00386 00387 activateResult->relListCount++; 00388 hsmFH->AddToReleaseCanList(trans); 00389 00390 g_hsmDB_p->ReleaseTransObj(trans); 00391 } 00392 } 00393 catch (...) { 00394 log_DBG_m(dbg_NORM, "trig migrate failed: " << path); 00395 activateResult->noListCount++; 00396 continue; 00397 } 00398 } 00399 00400 00401 ostringstream sstr; 00402 sstr << "Files put to Migration candidate list by user #files: " 00403 << activateResult->migListCount << endl; 00404 sstr << "Files put to Release candidate list by user #files: " 00405 << activateResult->relListCount << endl; 00406 sstr << "Files left inactive #files: " 00407 << activateResult->noListCount << endl; 00408 log_WriteEvent(sstr.str()); 00409 00410 return activateResult._retn(); 00411 } 00412 ipc_CATCH_IVD_THROW_CORBA_m; 00413 }

| i_Count_t i_HSM_i::ForceRelease | ( | const i_StringList_t & | a_fileNames | ) |
Definition at line 417 of file i_hsm_impl.cpp.
References ivd_FS_File::Close(), dbg_DETAIL, dbg_LOW, dbg_NORM, ivd_FS_File::e_Cache, ivd_FS_File::e_Release, g_fs_api_p, g_hsm_fhLock, ivd_FS_File::GetProperties(), ift_FILE, ipc_CATCH_IVD_THROW_CORBA_m, ivd_FS_File::IsOfflineProlonged(), IVD_PRINT_ID_FS, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), ivd_FS_FileProperty_t::m_dirtyFlag, ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_fileSize, ivd_FS_FileProperty_t::m_Inode, m_numForcedRelease, ivd_FS_FileProperty_t::m_offlineFlag, ivd_FS_FileProperty_t::m_type, ivd_FS_File::Open(), ivd_FS_File::Release(), and ivd_FS_File::SetDataOffline().
00417 { 00418 log_FUNC_m(ForceRelease); 00419 00420 try { 00421 UInt32_t numReleased = 0; 00422 UInt64_t sizeReleased = 0; 00423 00424 for (UInt32_t idx = 0; idx < a_fileNames.length(); idx ++) { 00425 00426 cmn_Path fullPath = string(a_fileNames[idx]); 00427 ivd_FS_FileProperty_t fileProp; 00428 00429 try { 00430 ivd_FS_File releaseFile(*g_fs_api_p, fullPath); 00431 try { 00432 releaseFile.Open(ivd_FS_File::e_Cache, fullPath); 00433 releaseFile.GetProperties(fileProp); 00434 } 00435 catch (ivd_Exception &ie) { 00436 log_DBG_m(dbg_LOW, "Can't GetProperties before ForceRelease " << ie); 00437 continue; 00438 } 00439 log_DBG_m(dbg_NORM, 00440 "Forced release :" << fullPath << 00441 " inode " << IVD_PRINT_ID_FS(fileProp.m_Inode) << 00442 " file id " << fileProp.m_fileID ); 00443 00444 bool prolonged(false); 00445 00446 if ( fileProp.m_fileID == 0 00447 || fileProp.m_dirtyFlag 00448 || fileProp.m_fileSize == 0 00449 || fileProp.m_type != ift_FILE 00450 || ( fileProp.m_offlineFlag 00451 && !(prolonged = releaseFile.IsOfflineProlonged()) 00452 ) 00453 ) { 00454 00455 log_DBG_m(dbg_NORM, 00456 "Can't release file " << fullPath << endl 00457 << " fileID = " << fileProp.m_fileID 00458 << " dirtyFlag = "<< boolalpha << fileProp.m_dirtyFlag 00459 << " fileSize = " << fileProp.m_fileSize 00460 << " type != ift_FILE = "<< boolalpha << (fileProp.m_type != ift_FILE) 00461 << " offlineFlag = " << boolalpha << fileProp.m_offlineFlag 00462 << " partially recalled = " << boolalpha << prolonged 00463 << endl << " fileId = 0 or file is dirty or file size is 0 or entry is not a file or not prolonged."); 00464 00465 continue; 00466 }; 00467 00468 if (!g_hsm_fhLock.CanLockByID(fileProp.m_Inode)) { 00469 log_DBG_m(dbg_NORM, 00470 "Forced Release file " << fullPath << endl << 00471 " FAILED. Cannot Lock by Inode."); 00472 00473 continue; 00474 }; 00475 00476 try { 00477 releaseFile.SetDataOffline(0, fileProp.m_fileSize); 00478 } 00479 catch (ivd_Exception) { 00480 g_hsm_fhLock.UnLockByID(fileProp.m_Inode); 00481 continue; 00482 } 00483 catch (...) { 00484 log_ERR_m( 00485 "File " << fullPath << 00486 " can't be set offline!"); 00487 00488 g_hsm_fhLock.UnLockByID(fileProp.m_Inode); 00489 continue; 00490 } 00491 00492 log_DBG_m(dbg_DETAIL, 00493 "Truncate file " << fullPath << " write offline flag done."); 00494 //HPUX 00495 releaseFile.Close(); 00496 releaseFile.Open(ivd_FS_File::e_Release); 00497 try { 00498 releaseFile.Release(); 00499 releaseFile.Close(); 00500 } 00501 catch (ivd_Exception &ie) { 00502 log_ERR_m( 00503 "File " << fullPath << 00504 " was not truncated but marked OFFLINE!" << endl << ie); 00505 00506 g_hsm_fhLock.UnLockByID(fileProp.m_Inode); 00507 00508 continue; 00509 } 00510 catch (...) { 00511 log_ERR_m( 00512 "File " << fullPath << 00513 " was not truncated but marked OFFLINE!"); 00514 00515 g_hsm_fhLock.UnLockByID(fileProp.m_Inode); 00516 00517 continue; 00518 } 00519 00520 log_DBG_m(dbg_NORM, 00521 "File released: " << fullPath << 00522 " inode: " << IVD_PRINT_ID_FS(fileProp.m_Inode) << 00523 " file id " << fileProp.m_fileID ); 00524 00525 sizeReleased += fileProp.m_fileSize; 00526 numReleased++; 00527 } 00528 catch (ivd_Exception &ise) { 00529 log_DBG_m(dbg_NORM, 00530 "File " << fullPath << 00531 ". fileId " << fileProp.m_fileID << 00532 " cannot be released. " << ise); 00533 } 00534 catch (...) { 00535 log_DBG_m(dbg_NORM, "->ReleaseFiles caught an exception. Ignore it."); 00536 } 00537 00538 g_hsm_fhLock.UnLockByID(fileProp.m_Inode); 00539 } 00540 if (numReleased) { 00541 m_numForcedRelease++; 00542 00543 ostringstream sstr; 00544 sstr << "Forced release by user (#files: " << numReleased 00545 << ", size: " << sizeReleased/1024 << " KB)."; 00546 log_WriteEvent(sstr.str()); 00547 00548 } 00549 return numReleased; 00550 } 00551 ipc_CATCH_IVD_THROW_CORBA_m; 00552 00553 00554 }

| void i_HSM_i::Reconfigure | ( | const i_ClientConf_t & | a_clientConf | ) |
Definition at line 557 of file i_hsm_impl.cpp.
References ClientConf_t::CfgCriticalWaterMark, ClientConf_t::CfgHighWaterMark, ClientConf_t::CfgLowWaterMark, ClientConf_t::CfgMaxMigSize, ClientConf_t::CfgMaxNumFiles, ClientConf_t::CfgMaxWaitTime, ClientConf_t::CfgMFAge, ClientConf_t::CfgMigRetentionTime, ClientConf_t::CfgMinFileSize, ClientConf_t::CfgMinMigSize, ClientConf_t::CfgMinNumFiles, ClientConf_t::CfgMinWaitTime, ClientConf_t::CfgOperationMode, ClientConf_t::CfgRecallOnly, ClientConf_t::CfgRecallRetentionTime, ClientConf_t::CfgRecallTimeOut, ClientConf_t::CfgReleaseInterval, ClientConf_t::CfgWORMTimeout, dbg_DETAIL, e_Regular, e_RegularRecallOnly, e_WORM, e_WORMRecallOnly, g_clientConf_p, g_fs_api_p, g_hsm_dirtyList_p, g_hsm_migcList_p, g_hsm_relcList_p, ivd_FileSystemAPI::GetConfiguration(), i_FST_WORM, ClientConf_t::Init(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, ivd_FS_Cfg_t::operationMode, hsm_FHdirty::Reconfigure(), hsm_FHmigc::Reconfigure(), hsm_FHrelc::Reconfigure(), hsm_MigByAPI::SetAPIMode(), ivd_FileSystemAPI::SetConfiguration(), ivd_FS_Cfg_t::syncEventTimeout, and ivd_FS_Cfg_t::WORMTimeout.
00557 { 00558 00559 log_FUNC_m(Reconfigure); 00560 try { 00561 g_clientConf_p->Init(a_clientConf); 00562 00563 ivd_FS_Cfg_t cfg; 00564 g_fs_api_p->GetConfiguration(cfg); 00565 cfg.syncEventTimeout = g_clientConf_p->CfgRecallTimeOut; 00566 if (i_FST_WORM == g_clientConf_p->CfgOperationMode) { 00567 if (g_clientConf_p->CfgRecallOnly) { 00568 cfg.operationMode = e_WORMRecallOnly; 00569 log_DBG_m(dbg_DETAIL, "WORM RecallOnly set!"); 00570 } 00571 else { 00572 cfg.operationMode = e_WORM; 00573 } 00574 cfg.WORMTimeout = g_clientConf_p->CfgWORMTimeout; 00575 } 00576 else { 00577 if (g_clientConf_p->CfgRecallOnly) { 00578 cfg.operationMode = e_RegularRecallOnly; 00579 log_DBG_m(dbg_DETAIL, "Regular RecallOnly set!"); 00580 } 00581 else { 00582 cfg.operationMode = e_Regular; 00583 } 00584 cfg.WORMTimeout = 0; 00585 } 00586 00587 g_fs_api_p->SetConfiguration(cfg); 00588 00589 g_mig.SetAPIMode(g_clientConf_p->CfgRecallOnly); 00590 00591 g_hsm_relcList_p->Reconfigure(g_clientConf_p->CfgReleaseInterval, 00592 g_clientConf_p->CfgLowWaterMark, 00593 g_clientConf_p->CfgHighWaterMark, 00594 g_clientConf_p->CfgCriticalWaterMark, 00595 g_clientConf_p->CfgMigRetentionTime, 00596 g_clientConf_p->CfgRecallRetentionTime, 00597 g_clientConf_p->CfgMinFileSize); 00598 00599 g_hsm_migcList_p->Reconfigure(g_clientConf_p->CfgMinWaitTime, 00600 g_clientConf_p->CfgMinNumFiles, 00601 g_clientConf_p->CfgMinMigSize, 00602 g_clientConf_p->CfgMaxWaitTime, 00603 g_clientConf_p->CfgMaxNumFiles, 00604 g_clientConf_p->CfgMaxMigSize); 00605 00606 g_hsm_dirtyList_p->Reconfigure(g_clientConf_p->CfgMFAge); 00607 // end by jandrej@hermes.si 00608 } ipc_CATCH_IVD_THROW_CORBA_m; 00609 }

| void i_HSM_i::GetInfo | ( | i_HsmInfo_t_out | a_hsmInfo | ) |
Definition at line 1857 of file i_hsm_impl.cpp.
References ClientConf_t::CfgPartitionUUID, dbg_DETAIL, g_clientConf_p, g_cmn, g_fs_api_p, g_hsm_dirtyList_p, g_hsm_migcList_p, g_hsm_preJobList_p, g_hsm_relcList_p, hsm_FHmigc::GetFilesListSize(), hsm_JobListMgr::GetNumJobs(), hsm_FHrelc::GetNumTruncations(), ivd_FileSystemAPI::GetRootPath(), hsm_FHrelc::GetWakeUpTime(), hsm_FHmigc::GetWakeUpTime(), ie_HSM_NOTREADY, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, cmn_SysInfo::m_hostName, ivd_Product::m_nameShort, m_numForcedRelease, m_numMigs, m_numRecalls, m_ready, m_upTime, cmn_Global::prod, and cmn_Global::si.
01857 { 01858 01859 log_FUNC_m(GetInfo); 01860 01861 try { 01862 if (!m_ready) { 01863 throw ivd_Error(ie_HSM_NOTREADY, "See " + g_cmn.prod.m_nameShort 01864 + ".log to know when ready."); 01865 } 01866 01867 a_hsmInfo = new i_HsmInfo_t; 01868 01869 log_DBG_m(dbg_DETAIL, "Getting Info of HSM:"); 01870 01871 a_hsmInfo->numMig = m_numMigs; 01872 a_hsmInfo->numRecall = m_numRecalls; 01873 a_hsmInfo->numRelease = g_hsm_relcList_p->GetNumTruncations(); 01874 a_hsmInfo->upTime = m_upTime; 01875 a_hsmInfo->numForcedMig = 0; 01876 a_hsmInfo->numForcedRelease = m_numForcedRelease; 01877 a_hsmInfo->mountPoint = CORBA::string_dup(g_fs_api_p->GetRootPath().c_str()); 01878 a_hsmInfo->host = CORBA::string_dup(g_cmn.si.m_hostName.c_str()); 01879 a_hsmInfo->fsID = CORBA::string_dup(g_clientConf_p->CfgPartitionUUID.c_str()); 01880 01881 a_hsmInfo->numDirtyFiles = g_hsm_dirtyList_p->size(); 01882 01883 UInt32_t numMigJob; 01884 UInt32_t numMigJobPreparation; 01885 UInt32_t numMigJobWaitForDoMig; 01886 UInt32_t numMigJobDoMig; 01887 UInt32_t numMigJobWaitForComplete; 01888 UInt32_t numMigJobComplete; 01889 UInt32_t numFailedMigJob; 01890 UInt32_t numRecJob; 01891 01892 g_hsm_preJobList_p->GetNumJobs(numMigJob, 01893 numMigJobPreparation, 01894 numMigJobWaitForDoMig, 01895 numMigJobDoMig, 01896 numMigJobWaitForComplete, 01897 numMigJobComplete, 01898 numFailedMigJob, 01899 numRecJob); 01900 01901 a_hsmInfo->numMigJob = numMigJob; 01902 a_hsmInfo->numMigJobPreparation = numMigJobPreparation; 01903 a_hsmInfo->numMigJobWaitForDoMig = numMigJobWaitForDoMig; 01904 a_hsmInfo->numMigJobDoMig = numMigJobDoMig; 01905 a_hsmInfo->numMigJobWaitForComplete = numMigJobWaitForComplete; 01906 a_hsmInfo->numMigJobComplete = numMigJobComplete; 01907 a_hsmInfo->numFailedMigJob = numFailedMigJob; 01908 a_hsmInfo->numRecallJob = numRecJob; 01909 01910 a_hsmInfo->numMigCndFiles = g_hsm_migcList_p->size(); 01911 a_hsmInfo->sizeMigCndFiles = g_hsm_migcList_p->GetFilesListSize(); 01912 a_hsmInfo->numRelCndFiles = 0; 01913 a_hsmInfo->wakeUpTimeMigCnd = g_hsm_migcList_p->GetWakeUpTime(); 01914 a_hsmInfo->wakeUpTimeRelCnd = g_hsm_relcList_p->GetWakeUpTime(); 01915 } 01916 ipc_CATCH_IVD_THROW_CORBA_m; 01917 }

| void i_HSM_i::ShowStatus | ( | i_UIMessageServer_ptr | a_uims, | |
| i_BitFlag_t | a_showFlags | |||
| ) |
Definition at line 1920 of file i_hsm_impl.cpp.
References ClientConf_t::CfgPartitionName, ClientConf_t::CfgPartitionUUID, hsm_FHmigc::DumpList(), hsm_FHdirty::DumpList(), hsm_FileHeader::DumpStatus(), hsm_FHdirty::DumpStatus(), hsm_FHmigc::DumpStatus(), hsm_DirWaitList::DumpStatus(), g_clientConf_p, g_cmn, g_fs_api_p, g_hsm_dirtyList_p, g_hsm_dirWaitList_p, g_hsm_migcList_p, g_hsm_preJobList_p, g_hsm_relcList_p, hsm_JobListMgr::GetNumJobs(), hsm_FHrelc::GetNumTruncations(), ivd_FileSystemAPI::GetRootPath(), hsm_FHrelc::GetWakeUpTime(), ipc_CATCH_IVD_THROW_CORBA_m, isf_DETAIL, isf_SH_DIRTY, isf_SH_MIG_CAN, log_FUNC_m, cmn_SysInfo::m_hostName, m_numForcedRelease, m_numMigs, m_numRecalls, m_upTime, NULL, cmn_Global::si, and cmn_Time::Time2YMDhms().
01921 { 01922 01923 log_FUNC_m(ShowStatus); 01924 01925 try { 01926 01927 ostringstream sstr; 01928 01929 cmn_Time uptime(m_upTime,0); 01930 01931 UInt32_t numMigJob; 01932 UInt32_t numMigJobPreparation; 01933 UInt32_t numMigJobWaitForDoMig; 01934 UInt32_t numMigJobDoMig; 01935 UInt32_t numMigJobWaitForComplete; 01936 UInt32_t numMigJobComplete; 01937 UInt32_t numFailedMigJob; 01938 UInt32_t numRecJob; 01939 01940 g_hsm_preJobList_p->GetNumJobs(numMigJob, 01941 numMigJobPreparation, 01942 numMigJobWaitForDoMig, 01943 numMigJobDoMig, 01944 numMigJobWaitForComplete, 01945 numMigJobComplete, 01946 numFailedMigJob, 01947 numRecJob); 01948 01949 sstr << endl<< "Partition " << g_clientConf_p->CfgPartitionName << " is up from " << uptime.Time2YMDhms() << endl; 01950 sstr << "partition mount point " << g_fs_api_p->GetRootPath() << 01951 " with file system ID " << g_clientConf_p->CfgPartitionUUID << 01952 " on host " << g_cmn.si.m_hostName << endl; 01953 01954 if (a_showFlags & isf_SH_DIRTY) { 01955 g_hsm_dirtyList_p->DumpList(sstr); 01956 a_uims->DisplayMessage(sstr.str().c_str()); 01957 return; 01958 } 01959 if (a_showFlags & isf_SH_MIG_CAN) { 01960 g_hsm_migcList_p->DumpList(sstr); 01961 a_uims->DisplayMessage(sstr.str().c_str()); 01962 return; 01963 } 01964 01965 sstr << endl << "This partition was done successful:" << endl; 01966 sstr << "-----------------------------------------------" << endl; 01967 sstr << "Number of migrated files: " << m_numMigs << endl; 01968 sstr << "Number of releases: " << g_hsm_relcList_p->GetNumTruncations() << endl; 01969 sstr << "Number of recalled files: " << m_numRecalls << endl << endl; 01970 sstr << "Number of forced releases: " << m_numForcedRelease << endl; 01971 sstr << "-----------------------------------------------" << endl; 01972 01973 if (a_showFlags & isf_DETAIL) { 01974 cmn_Time upRtime(g_hsm_relcList_p->GetWakeUpTime() ,0); 01975 cmn_Time curTime(time(NULL)); 01976 01977 sstr << "Additional info of Partition at the moment: "<< endl; 01978 sstr << "-----------------------------------------------------------" << endl; 01979 sstr << "Number of REC jobs at the moment: " << numRecJob << endl; 01980 sstr << "Number of MIG jobs at the moment: " << numMigJob << endl; 01981 sstr << "Count by status: preparation: " << numMigJobPreparation << endl; 01982 sstr << " wait for do migration: " << numMigJobWaitForDoMig << endl; 01983 sstr << " on do migration: " << numMigJobDoMig << endl; 01984 sstr << " wait for complete mig: " << numMigJobWaitForComplete << endl; 01985 sstr << " on complete mig: " << numMigJobComplete << endl; 01986 sstr << "Number of FAILED migrations : " << numFailedMigJob << endl; 01987 01988 sstr << "Number of files on dirty list : " << g_hsm_dirtyList_p->size() << endl; 01989 g_hsm_dirWaitList_p->DumpStatus(sstr); 01990 g_hsm_migcList_p->DumpStatus(sstr); 01991 g_hsm_dirtyList_p->DumpStatus(sstr); 01992 sstr << "Next Release will wake up at: " << upRtime.Time2YMDhms() << endl; 01993 sstr << " Current time : " << curTime.Time2YMDhms() << endl; 01994 // sstr << "number of Recall Jobs at the moment: " << hsmInfo->numRecallJob << endl; 01995 sstr << "-----------------------------------------------------------" << endl; 01996 hsm_FileHeader::DumpStatus(sstr); 01997 } 01998 // NOTE str duplicate not need, it produce mem leak 01999 a_uims->DisplayMessage(sstr.str().c_str()); 02000 } 02001 ipc_CATCH_IVD_THROW_CORBA_m; 02002 }

| void i_HSM_i::GetCfg | ( | i_ClientConf_t_out | a_clientConf | ) |
Definition at line 2006 of file i_hsm_impl.cpp.
References ClientConf_t::CfgChunkSize, ClientConf_t::CfgCriticalWaterMark, ClientConf_t::CfgFileHeaderSize, ClientConf_t::CfgHashSize, ClientConf_t::CfgHighWaterMark, ClientConf_t::CfgLowWaterMark, ClientConf_t::CfgMaxMigSize, ClientConf_t::CfgMaxNumFiles, ClientConf_t::CfgMaxWaitTime, ClientConf_t::CfgMFAge, ClientConf_t::CfgMigRetentionTime, ClientConf_t::CfgMinFileSize, ClientConf_t::CfgMinMigSize, ClientConf_t::CfgMinNumFiles, ClientConf_t::CfgMinWaitTime, ClientConf_t::CfgOperationMode, ClientConf_t::CfgPartitionName, ClientConf_t::CfgPartitionUUID, ClientConf_t::CfgRecallRetentionTime, ClientConf_t::CfgRecallTimeOut, ClientConf_t::CfgReleaseInterval, ClientConf_t::CfgWORMTimeout, g_clientConf_p, ipc_CATCH_IVD_THROW_CORBA_m, and log_FUNC_m.
02006 { 02007 02008 log_FUNC_m(GetCfg); 02009 02010 try { 02011 02012 a_clientConf = new i_ClientConf_t; 02013 02014 a_clientConf->CfgChunkSize = g_clientConf_p->CfgChunkSize ; 02015 a_clientConf->CfgFileHeaderSize = g_clientConf_p->CfgFileHeaderSize ; 02016 a_clientConf->CfgCriticalWaterMark = g_clientConf_p->CfgCriticalWaterMark; 02017 a_clientConf->CfgHighWaterMark = g_clientConf_p->CfgHighWaterMark ; 02018 a_clientConf->CfgLowWaterMark = g_clientConf_p->CfgLowWaterMark ; 02019 a_clientConf->CfgReleaseInterval = g_clientConf_p->CfgReleaseInterval ; 02020 // a_clientConf->CfgStartReleaseNumF = g_clientConf_p->CfgStartReleaseNumF ; 02021 // a_clientConf->CfgStartReleaseTime = g_clientConf_p->CfgStartReleaseTime ; 02022 a_clientConf->CfgMaxMigSize = g_clientConf_p->CfgMaxMigSize ; 02023 a_clientConf->CfgMaxNumFiles = g_clientConf_p->CfgMaxNumFiles ; 02024 a_clientConf->CfgMaxWaitTime = g_clientConf_p->CfgMaxWaitTime ; 02025 a_clientConf->CfgMFAge = g_clientConf_p->CfgMFAge ; 02026 a_clientConf->CfgMigRetentionTime = g_clientConf_p->CfgMigRetentionTime ; 02027 a_clientConf->CfgMinFileSize = g_clientConf_p->CfgMinFileSize ; 02028 a_clientConf->CfgMinMigSize = g_clientConf_p->CfgMinMigSize ; 02029 a_clientConf->CfgMinNumFiles = g_clientConf_p->CfgMinNumFiles ; 02030 // a_clientConf->CfgMinNumMigfile = g_clientConf_p->CfgMinNumMigfile ; 02031 a_clientConf->CfgMinWaitTime = g_clientConf_p->CfgMinWaitTime ; 02032 a_clientConf->CfgRecallTimeOut = g_clientConf_p->CfgRecallTimeOut ; 02033 // a_clientConf->CfgTreeWalkWaitTime = g_clientConf_p->CfgTreeWalkWaitTime ; 02034 // a_clientConf->CfgTreeWalkNumFiles = g_clientConf_p->CfgTreeWalkNumFiles ; 02035 a_clientConf->CfgRecallRetentionTime = g_clientConf_p->CfgRecallRetentionTime; 02036 a_clientConf->CfgHashSize = g_clientConf_p->CfgHashSize; 02037 a_clientConf->CfgPartitionName = CORBA::string_dup(g_clientConf_p->CfgPartitionName.c_str()); 02038 a_clientConf->CfgPartitionUUID = CORBA::string_dup(g_clientConf_p->CfgPartitionUUID.c_str()); 02039 02040 /* if (g_clientConf_p->CfgRunTreeWalk == false) { 02041 a_clientConf->CfgRunTreeWalk = 0; 02042 } 02043 else { 02044 a_clientConf->CfgRunTreeWalk = 1; 02045 } 02046 if (g_clientConf_p->CfgStartReleaseEarly == false) { 02047 a_clientConf->CfgStartReleaseEarly = 0; 02048 } 02049 else { 02050 a_clientConf->CfgStartReleaseEarly = 1; 02051 } 02052 */ 02053 a_clientConf->CfgOperationMode = g_clientConf_p->CfgOperationMode; 02054 a_clientConf->CfgWORMTimeout = g_clientConf_p->CfgWORMTimeout; 02055 } 02056 ipc_CATCH_IVD_THROW_CORBA_m; 02057 }
| void i_HSM_i::ChangeLogLevel | ( | CORBA::Char | a_lLevel | ) |
Definition at line 2061 of file i_hsm_impl.cpp.
References cmn_Global::dbg, dbg_DETAIL, dbg_EXTAPI, dbg_LOW, dbg_NORM, g_cmn, log_Debugger::GetLevel(), log_DBG_m, log_FUNC_m, and log_Debugger::SetLevel().
02061 { 02062 02063 log_FUNC_m(ChangeLogLevel); 02064 02065 char lLevel = a_lLevel; 02066 02067 log_DbgLevel_t setlevel; 02068 02069 switch (lLevel) { 02070 case 'L': 02071 setlevel = dbg_LOW; 02072 break; 02073 case 'A': 02074 setlevel = dbg_EXTAPI; 02075 break; 02076 case 'N': 02077 setlevel = dbg_NORM; 02078 break; 02079 default: 02080 setlevel = dbg_DETAIL; 02081 } 02082 switch (g_cmn.dbg.GetLevel()){ 02083 case dbg_LOW: 02084 log_DBG_m(dbg_LOW, "Changing Log level to " << lLevel); 02085 break; 02086 case dbg_EXTAPI: 02087 log_DBG_m(dbg_EXTAPI, "Changing Log level to " << lLevel); 02088 break; 02089 case dbg_NORM: 02090 log_DBG_m(dbg_NORM, "Changing Log level to " << lLevel); 02091 break; 02092 default: 02093 log_DBG_m(dbg_DETAIL, "Changing Log level to " << lLevel); 02094 } 02095 g_cmn.dbg.SetLevel(setlevel); 02096 02097 log_DBG_m(setlevel, "Changing Log level to " << lLevel << " done."); 02098 }

| void i_HSM_i::Recall | ( | const i_Recall_t & | a_file, | |
| i_JobID_t | a_pmJobId, | |||
| i_BlkSize_t | a_blockSize, | |||
| i_BufType_t | a_bufType, | |||
| const char * | a_diskBufferFS, | |||
| CORBA::Boolean | a_succeeded, | |||
| i_DownloadAgent_ptr | a_download | |||
| ) |
Definition at line 613 of file i_hsm_impl.cpp.
References hsm_JobListMgr::At(), hsm_JobElemVecMgr::At(), bbt_DISK_BUF, bbt_REMOTE_BUF, bbt_SHMEM_BUF, blk_Data_c, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, i_Recall_t::fileID, g_cmn, g_fs_api_p, g_fsLog, g_hsm_fhLock, g_hsm_preJobList_p, hsm_FileHeader::GetInode(), hsm_JobListMgr::GetJobElemVecMgr(), hsm_FileHeader::GetRecallIntoName(), i_DISK_BUF, i_REMOTE_BUF, i_SHMEM_BUF, ie_INVALID_ARG, ie_NOFINDOBJ, ivd_FS_ERR_Reply, ivd_USleep, log_DBG_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, ivd_Product::m_nameShortLC, m_numRecalls, i_Recall_t::migrationID, df_Unpacker::NewDiskBuffer(), df_BlockReader::NewDiskBuffer(), df_Unpacker::NewNetBuffer(), df_BlockReader::NewNetBuffer(), NULL, cmn_Global::prod, hsm_FileHeader::Recalled(), hsm_JobListMgr::ReleaseElement(), hsm_JobListMgr::ReleaseJobIdx(), hsm_JobListMgr::ReleaseJobIdxWithTest(), hsm_FileHeader::SendReply(), hsm_FileHeader::TruncateFile(), UnPackFile(), and log_ivdfs::Write().
00620 { 00621 00622 log_FUNC_m(Recall); 00623 00624 string diskBufferFS(a_diskBufferFS); 00625 bool recalled = false; 00626 UInt32_t numRclFiles = 0; 00627 UInt64_t sizeRclFiles = 0; 00628 00629 UInt32_t blkSize = a_blockSize; 00630 string bufId = cmn_Num2Str((Int64_t)a_pmJobId); 00631 bbt_BufType_t bufType = bbt_DISK_BUF; 00632 00633 auto_ptr<ivd_FS_File> recallFile_p; 00634 bool manualRecall = false; 00635 00636 hsm_FileHeader *tFHobj = NULL; 00637 00638 try { 00639 00640 Int32_t jobIdx(0); 00641 hsm_JobElemVecMgr *jobElemVecMgr_p = 00642 g_hsm_preJobList_p->GetJobElemVecMgr(a_pmJobId, jobIdx); 00643 00644 if (jobElemVecMgr_p == NULL) { 00645 log_WRN_m( 00646 "HSM job file list not found. " 00647 << "Did the job already fail or was it aborted: " 00648 << a_pmJobId); 00649 return; 00650 } 00651 00652 tFHobj = jobElemVecMgr_p->At(0); 00653 00654 log_DBG_m (dbg_DETAIL, " RECALL with jobID " << a_pmJobId << 00655 " of file at Job[" << jobIdx << "]" << 00656 "\t\tfileID " << a_file.fileID << " MigID " << a_file.migrationID); 00657 00658 if (tFHobj == NULL) { 00659 string idFileStr = cmn_Num2Str((ivd_FileID_t)((unsigned long)a_file.fileID)); 00660 throw ivd_InternalError(ie_NOFINDOBJ, "Object with fileId: " + idFileStr + " IS_NOT_FOUND", true); 00661 } 00662 00663 ivd_GenInode_t inode = tFHobj->GetInode(); 00664 00665 string intoName = tFHobj->GetRecallIntoName(); 00666 00667 if (!intoName.empty()) { 00668 // File Header for manual recall has into name defined. 00669 manualRecall = true; 00670 log_DBG_m(dbg_LOW, "Manually triggerd recall into: " << intoName); 00671 } 00672 /*#endif*/ 00673 00674 // fix bug 692 and 736 00675 if (!a_succeeded){ 00676 log_DBG_m(dbg_LOW,"Recall failed for fileId " << a_file.fileID); 00677 goto end; 00678 } 00679 00680 if (manualRecall) { 00681 log_DBG_m(dbg_LOW, "Manual Recall for file Id:" 00682 << a_file.fileID << " into " << intoName); 00683 recallFile_p.reset(new ivd_FS_File(*g_fs_api_p, intoName)); 00684 } 00685 else { 00686 i_RecallList_t seqRecallList; 00687 seqRecallList.length(1); 00688 seqRecallList[0] = a_file; 00689 log_DBG_m (dbg_DETAIL, "a_file: " << a_file); 00690 00691 switch (a_bufType ) { 00692 case i_DISK_BUF: 00693 bufType = bbt_DISK_BUF; 00694 break; 00695 case i_SHMEM_BUF: 00696 bufType = bbt_SHMEM_BUF; 00697 break; 00698 case i_REMOTE_BUF: 00699 bufType = bbt_REMOTE_BUF; 00700 break; 00701 default: 00702 throw ivd_InternalError( 00703 ie_INVALID_ARG, "Unsupported transfer type."); 00704 } 00705 df_BlockReader *blockReader_p = new df_BlockReader(blk_Data_c, bufType, a_blockSize); 00706 hsm_Recall recallData(blockReader_p, 00707 g_hsm_preJobList_p->At(jobIdx), 00708 a_pmJobId, 00709 seqRecallList); 00710 00711 switch (bufType) { 00712 case bbt_DISK_BUF: 00713 blockReader_p->NewDiskBuffer(bufId, diskBufferFS); 00714 break; 00715 case bbt_REMOTE_BUF: 00716 blockReader_p->NewNetBuffer(a_download); 00717 break; 00718 default:; 00719 } 00720 00721 recallData.Unpack(); 00722 00723 UInt32_t numRclFiles; 00724 UInt64_t sizeRclFiles; 00725 00726 if (g_hsm_preJobList_p->ReleaseJobIdxWithTest(jobIdx, numRclFiles, sizeRclFiles)) { 00727 ostringstream sstr; 00728 sstr << "(#files: " << numRclFiles 00729 << ", size: " << sizeRclFiles/1024 << " KB" 00730 << ", FileID: " << a_file.fileID << " )."; 00731 00732 log_WriteEvent( 00733 sstr.str(), "RECALL", 00734 a_pmJobId, 00735 cmn_Num2Str(jobIdx)); 00736 } 00737 00738 return; 00739 } 00740 00741 switch (a_bufType ) { 00742 case i_DISK_BUF: 00743 bufType = bbt_DISK_BUF; 00744 break; 00745 case i_SHMEM_BUF: 00746 bufType = bbt_SHMEM_BUF; 00747 break; 00748 case i_REMOTE_BUF: 00749 bufType = bbt_REMOTE_BUF; 00750 break; 00751 default: 00752 throw ivd_InternalError( 00753 ie_INVALID_ARG, "Unsupported transfer type."); 00754 } 00755 00756 log_DBG_m (dbg_DETAIL, 00757 " RECALL: to create dfUnpacker for bufType " << bufType << endl << 00758 " bufID:" << bufId << endl << 00759 " Block size " << a_blockSize << endl 00760 ); 00761 00762 try { 00763 UInt64_t rclSize; 00764 df_Unpacker unpacker(blk_Data_c, bufType, blkSize); 00765 switch (bufType) { 00766 case bbt_DISK_BUF: 00767 unpacker.NewDiskBuffer(bufId, diskBufferFS); 00768 break; 00769 case bbt_REMOTE_BUF: 00770 unpacker.NewNetBuffer(a_download); 00771 break; 00772 default:; 00773 } 00774 recalled = UnPackFile(a_file, *recallFile_p.get(), manualRecall, 00775 rclSize, unpacker); 00776 intoName = recallFile_p.get()->GetFullPathRef(); 00777 if (!recalled) { 00778 tFHobj->TruncateFile(*recallFile_p.get()); 00779 } 00780 else { 00781 numRclFiles++; 00782 sizeRclFiles += rclSize; 00783 } 00784 } 00785 catch (ivd_Exception &ie) { 00786 log_DBG_m(dbg_DETAIL, ie); 00787 } 00788 catch (...) { 00789 log_DBG_m(dbg_DETAIL, "Recall: Error in packer."); 00790 } 00791 00792 end: 00793 if (manualRecall) { 00794 g_hsm_preJobList_p->ReleaseElement(jobIdx, 0); 00795 ostringstream sstr; 00796 if (recalled) { 00797 sstr << "Recalled into. ( MigID : " << a_file.migrationID << " )"; 00798 } 00799 else { 00800 sstr << "ERROR: Recall into failed "; 00801 if (a_succeeded) { 00802 sstr << "(" << g_cmn.prod.m_nameShortLC 00803 << "-hsm unpacker problem)."; 00804 } 00805 else { 00806 sstr << "(" << g_cmn.prod.m_nameShortLC << "-pm problem)."; 00807 } 00808 } 00809 g_fsLog.Write(inode, a_file.fileID, jobIdx, intoName, sstr.str().c_str()); 00810 } 00811 else { 00812 // fix bug 537 00813 while (!g_hsm_fhLock.CanLockByID(inode)) { 00814 ivd_USleep(10000); // wait a 10 mili sec 00815 } 00816 // end fix 00817 00818 tFHobj->Recalled(recalled); 00819 00820 g_hsm_fhLock.UnLockByID(inode); 00821 } 00822 00823 g_hsm_preJobList_p->ReleaseJobIdx(jobIdx); 00824 00825 m_numRecalls++; // added for statistic by jandrej@hermes.si 00826 00827 ostringstream sstr; 00828 sstr << "(#files: " << numRclFiles 00829 << ", size: " << sizeRclFiles/1024 << " KB" 00830 << ", FileID: " << a_file.fileID << " )."; 00831 00832 log_WriteEvent( 00833 sstr.str(), "RECALL", 00834 a_pmJobId, 00835 cmn_Num2Str(jobIdx)); 00836 } 00837 catch (ivd_Exception) { 00838 tFHobj->SendReply(ivd_FS_ERR_Reply); 00839 } 00840 catch (ivd_InternalError) { 00841 tFHobj->SendReply(ivd_FS_ERR_Reply); 00842 } 00843 catch (...) { 00844 tFHobj->SendReply(ivd_FS_ERR_Reply); 00845 } 00846 }

| void i_HSM_i::EfficientRecall | ( | const i_RecallList_t & | a_seqRecallList, | |
| i_JobID_t | a_pmJobId, | |||
| i_JobID_t | a_hsmJobIndexID, | |||
| i_BlkSize_t | a_blockSize, | |||
| i_BufType_t | a_bufType, | |||
| const char * | a_diskBufferFS, | |||
| CORBA::Boolean | a_succeeded, | |||
| i_DownloadAgent_ptr | a_download | |||
| ) |
Definition at line 849 of file i_hsm_impl.cpp.
References hsm_JobElemVecMgr::At(), bbt_DISK_BUF, bbt_REMOTE_BUF, bbt_SHMEM_BUF, blk_Data_c, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, i_Recall_t::fileIdx, g_hsm_fhLock, g_hsm_preJobList_p, hsm_FileHeader::GetFileID(), hsm_FileHeader::GetInode(), hsm_JobListMgr::GetJobElemVecMgr(), hsm_Recall::GetNumOfRecalledFiles(), hsm_Recall::GetSizeOfRecalledData(), i_DISK_BUF, i_REMOTE_BUF, i_SHMEM_BUF, ie_INVALID_ARG, IVD_PRINT_ID_FS, ivd_USleep, cmn_Mutex::Lock(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, m_efficientRecall_x, hsm_JobElemVecMgr::m_jobElemVecMgr_x, hsm_FileHeader::MakePath(), df_BlockReader::NewDiskBuffer(), df_BlockReader::NewNetBuffer(), NULL, hsm_FileHeader::Recalled(), hsm_JobListMgr::ReleaseJobIdxWithTest(), cmn_Mutex::Unlock(), and df_RecReader::Unpack().
00857 { 00858 00859 log_FUNC_m(EfficientRecall); 00860 00861 cmn_MutexLock l(m_efficientRecall_x); 00862 00863 string diskBufferFS(a_diskBufferFS); 00864 string bufId = cmn_Num2Str((Int64_t)a_pmJobId); 00865 00866 bbt_BufType_t bufType = bbt_DISK_BUF; 00867 00868 Int32_t jobIdx(0); 00869 hsm_JobElemVecMgr *jobElemVecMgr_p = 00870 g_hsm_preJobList_p->GetJobElemVecMgr(a_hsmJobIndexID, jobIdx); 00871 00872 00873 if (jobElemVecMgr_p == NULL) { 00874 if (!a_succeeded) { 00875 log_DBG_m(dbg_LOW, 00876 "HSM job file list not found. " 00877 << "The job already failed or was aborted. " 00878 << "job ID: " << a_pmJobId 00879 << " hsmJobIndexID: " << a_hsmJobIndexID); 00880 } 00881 else { 00882 log_WRN_m( 00883 "HSM job file list not found for efficient recall. " << endl 00884 << "Did the job already fail or was aborted? " 00885 << "job ID: " << a_pmJobId 00886 << " hsmJobIndexID: " << a_hsmJobIndexID); 00887 } 00888 return; 00889 } 00890 00891 00892 if (!a_succeeded) { 00893 00894 ostringstream errMsg; 00895 errMsg << "Recall failed. JobID: " << a_pmJobId 00896 << ". HSM Job Idx: " << jobIdx << ". " 00897 << "Check server log for details." << endl; 00898 00899 log_ERR_m(errMsg.str()); 00900 errMsg.clear(); 00901 00902 00903 //list all files that failed 00904 errMsg << " Inode FileID Path relative to mount point" << endl; 00905 00906 int listLen = a_seqRecallList.length(); 00907 const i_Recall_t *pi = &a_seqRecallList[0]; 00908 log_DBG_m (dbg_DETAIL, "pi: " << hex << pi << dec); 00909 00910 const i_Recall_t *pe = pi + listLen; 00911 log_DBG_m (dbg_DETAIL, "pe: " << hex << pe << dec); 00912 for (;pi != pe; ++pi) { 00913 log_DBG_m (dbg_DETAIL, "FAILED to recall a file: " << *pi); 00914 00915 // 00916 // Code review by Matej Kenda 00917 // Bad design: Locking for class' members is used from 00918 // outside: The object jobElemVecMgr_p should protect it's own members 00919 // by itself. 00920 // 00921 jobElemVecMgr_p->m_jobElemVecMgr_x.Lock(); 00922 hsm_FileHeader* fh_p = jobElemVecMgr_p->At(pi->fileIdx); 00923 jobElemVecMgr_p->m_jobElemVecMgr_x.Unlock(); 00924 if (fh_p == NULL) { 00925 continue; 00926 } 00927 ivd_GenInode_t inode = fh_p->GetInode(); 00928 while (!g_hsm_fhLock.CanLockByID(inode)) { 00929 ivd_USleep(10000); // wait a 10 mili sec 00930 } 00931 errMsg << IVD_PRINT_ID_FS(fh_p->GetInode()) 00932 << setw(10) << fh_p->GetFileID() 00933 << " " << fh_p->MakePath() << endl; 00934 log_DBG_m(dbg_DETAIL, IVD_PRINT_ID_FS(fh_p->GetInode()) 00935 << setw(10) << fh_p->GetFileID() 00936 << " " << fh_p->MakePath()); 00937 00938 00939 fh_p->Recalled(false); 00940 00941 g_hsm_fhLock.UnLockByID(inode); 00942 } 00943 00944 log_ERR_m(errMsg.str()); 00945 00946 ostringstream sstr; 00947 sstr << "(#files: " << a_seqRecallList.length() << ")"; 00948 00949 log_WriteEvent( 00950 sstr.str(), "Recall failed.", 00951 a_pmJobId, 00952 cmn_Num2Str(jobIdx)); 00953 00954 UInt32_t numRclFiles; 00955 UInt64_t sizeRclFiles; 00956 g_hsm_preJobList_p->ReleaseJobIdxWithTest(jobIdx, numRclFiles, sizeRclFiles); 00957 00958 return; 00959 } 00960 00961 try { 00962 00963 log_DBG_m (dbg_DETAIL, " Efficient RECALL with jobID " << a_pmJobId); 00964 00965 switch (a_bufType ) { 00966 case i_DISK_BUF: 00967 bufType = bbt_DISK_BUF; 00968 break; 00969 case i_SHMEM_BUF: 00970 bufType = bbt_SHMEM_BUF; 00971 break; 00972 case i_REMOTE_BUF: 00973 bufType = bbt_REMOTE_BUF; 00974 break; 00975 default: 00976 throw ivd_InternalError( 00977 ie_INVALID_ARG, "Unsupported transfer type."); 00978 } 00979 df_BlockReader *blockReader_p = new df_BlockReader(blk_Data_c, bufType, a_blockSize); 00980 hsm_Recall recallData( 00981 blockReader_p, 00982 *jobElemVecMgr_p, 00983 a_pmJobId, 00984 a_seqRecallList); 00985 00986 switch (bufType) { 00987 case bbt_DISK_BUF: 00988 blockReader_p->NewDiskBuffer(bufId, diskBufferFS); 00989 break; 00990 case bbt_REMOTE_BUF: 00991 blockReader_p->NewNetBuffer(a_download); 00992 break; 00993 default:; 00994 } 00995 00996 recallData.Unpack(); 00997 00998 UInt32_t numRclFiles; 00999 UInt64_t sizeRclFiles; 01000 01001 log_DBG_m (dbg_DETAIL, "Unpack finished."); 01002 01003 if (g_hsm_preJobList_p->ReleaseJobIdxWithTest(jobIdx, numRclFiles, sizeRclFiles)) { 01004 ostringstream sstr; 01005 sstr << "Finished (#files: " << recallData.GetNumOfRecalledFiles() 01006 << ", size: " << recallData.GetSizeOfRecalledData()/1024 << " KB"; 01007 sstr << "; Grand total #files: " << numRclFiles 01008 << ", size: " << sizeRclFiles/1024 << " KB)."; 01009 01010 //log_WriteEvent(sstr.str()); 01011 log_WriteEvent( 01012 sstr.str(), "RECALL", 01013 a_pmJobId, 01014 cmn_Num2Str(jobIdx)); 01015 } 01016 else { 01017 ostringstream sstr; 01018 sstr << " (#files: " << recallData.GetNumOfRecalledFiles() 01019 << ", size: " << recallData.GetSizeOfRecalledData()/1024 << " KB)."; 01020 01021 //log_WriteEvent(sstr.str()); 01022 log_WriteEvent( 01023 sstr.str(), "RECALL", 01024 a_pmJobId, 01025 cmn_Num2Str(jobIdx)); 01026 } 01027 01028 } 01029 catch (ivd_Exception &ie) { 01030 log_DBG_m(dbg_DETAIL, ie); 01031 } 01032 catch (...) { 01033 log_DBG_m(dbg_DETAIL, "Recall: Error in packer."); 01034 } 01035 }

| void i_HSM_i::RunScripts | ( | ) |
Definition at line 1217 of file i_hsm_impl.cpp.
01217 { 01218 // @todo insert code here and remove the warning 01219 // #warning "Code missing in function <void i_HSM_i::RunScripts()>" 01220 }
| i_Count_t i_HSM_i::DoMigrationJob | ( | i_BufType_t | a_resType, | |
| const char * | a_diskBufferFS, | |||
| i_JobID_t | a_pmJobId, | |||
| i_BlkSize_t | a_blkSize, | |||
| i_Count_t | a_numCopies, | |||
| i_MigID_t | a_migrationID, | |||
| const i_JobRequestList_t & | a_jobFiles, | |||
| i_UploadAgent_ptr | a_upload | |||
| ) |
Definition at line 1224 of file i_hsm_impl.cpp.
References hsm_JobElemVecMgr::At(), bbt_DISK_BUF, bbt_REMOTE_BUF, blk_Data_c, cmn_Num2Str(), cmn_Global::dbg, dbg_DETAIL, dbg_LOW, dbg_NORM, eDoMigStart, df_Packer::EndOfData(), eNotInDoMig, g_cmn, g_hsm_fhLock, g_hsm_preJobList_p, hsm_FileHeader::GetInode(), hsm_ListPos::GetJobElemIdx(), hsm_JobListMgr::GetJobElemVecMgr(), hsm_ListPos::GetJobIdx(), log_Debugger::GetLevel(), df_Packer::Go(), hjs_DOMIG, hjs_WAITFORCOMPLETEMIG, i_DISK_BUF, i_REMOTE_BUF, ie_EMPTYLIST, ie_HSM_OTHERLIST, ie_INVALID_ARG, ie_JOB_NOT_FOUND, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, IVD_PRINT_ID_FS, ivd_USleep, cmn_Mutex::Lock(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), hsm_JobElemVecMgr::m_jobElemVecMgr_x, m_shutDownInProgress, hsm_FileHeader::MakePath(), hsm_FileHeader::MigrationIsDone(), df_Packer::NewDiskBuffer(), df_Packer::NewNetBuffer(), NULL, PackFile(), hsm_FileHeader::SetDataMigStat(), hsm_JobElemVecMgr::SetJobStatus(), hsm_JobElemVecMgr::SetMigJobID(), and cmn_Mutex::Unlock().
01232 { 01233 01234 log_FUNC_m(DoMigrationJob); 01235 01236 log_DBG_m(dbg_NORM, "Number of copies: " << a_numCopies); 01237 01238 UInt32_t numMigFiles = 0; 01239 UInt64_t sizeMigFiles = 0; 01240 01241 string diskBufferFS(a_diskBufferFS); 01242 try { 01243 UInt32_t numFiles = a_jobFiles.length(); 01244 01245 if (numFiles == 0) { 01246 throw ivd_Error(ie_EMPTYLIST, "DoMigrationJob got empty sequence of files", true); 01247 } 01248 01249 const UInt32_t blkSize_c = a_blkSize; 01250 string tjobID = cmn_Num2Str((Int64_t)a_pmJobId); 01251 01252 Int32_t jobIdx(0); 01253 hsm_JobElemVecMgr *jobElemVecMgr_p(NULL); 01254 01255 /* 01256 * HSM starts job in PM and stores it's job ID in the internal job list. 01257 * Job might call DoMigrationJob job sooner than the ID is stored. 01258 * Several retries are done before returning error to the job. 01259 * 01260 * NOTE: THIS IS A HACK, because modifying the internal list should be better protected 01261 * by some kind of locking mechanism: hsm_JobListMgr & Co requires partial rewrite. 01262 */ 01263 for (int retries(1); retries <= 100; retries++) { 01264 jobElemVecMgr_p = 01265 g_hsm_preJobList_p->GetJobElemVecMgr(a_pmJobId, jobIdx); 01266 01267 if (jobElemVecMgr_p != NULL) { 01268 break; 01269 } 01270 else { 01271 // The job ID might not be stored in the list yet 01272 // Do retries in steps of 50ms, 100ms, 150ms, ..., 5s. 01273 ivd_USleep(retries * 50000); 01274 } 01275 } 01276 01277 if (jobElemVecMgr_p == NULL) { 01278 ostringstream sstr; 01279 sstr 01280 << "Internal data structures for job don't exist any more. " 01281 << "Job already aborted (?): " << a_pmJobId; 01282 throw ivd_Error(ie_JOB_NOT_FOUND, sstr.str(), true); 01283 } 01284 01285 log_DBG_m(dbg_LOW, "DoMigrationJob: idx [" << jobIdx << "]" << endl 01286 << "MigID=" << a_migrationID 01287 << " JobID=" << a_pmJobId << " num files " << numFiles); 01288 // 01289 // job id was already set when migration job was created 01290 // We are setting migration ID at this point 01291 // TODO: Split setting job ID and migration ID 01292 // 01293 jobElemVecMgr_p->SetMigJobID(a_pmJobId, a_migrationID); 01294 01295 if (g_cmn.dbg.GetLevel() == dbg_DETAIL) { 01296 log_DBG_m(dbg_DETAIL, " DoMigration list elements"); 01297 for (UInt32_t idx = 0; idx < numFiles; idx++){ 01298 log_DBG_m(dbg_DETAIL, 01299 "~~~~~ file at [" << a_jobFiles[idx].fileIdx << "]"); 01300 } 01301 }; 01302 01303 // Prepare data transfer 01304 bbt_BufType_t transferType; 01305 switch (a_resType) { 01306 case i_DISK_BUF: 01307 transferType = bbt_DISK_BUF; break; 01308 case i_REMOTE_BUF: 01309 transferType = bbt_REMOTE_BUF; break; 01310 default: throw ivd_InternalError( 01311 ie_INVALID_ARG, "Unsupported transfer type."); 01312 }; 01313 df_Packer packer(blk_Data_c, transferType, blkSize_c, UInt16_t(a_numCopies)); 01314 switch (a_resType) { 01315 case i_DISK_BUF: 01316 packer.NewDiskBuffer(tjobID, diskBufferFS); 01317 break; 01318 case i_REMOTE_BUF: 01319 packer.NewNetBuffer(a_upload); 01320 break; 01321 default: 01322 throw ivd_InternalError( 01323 ie_INVALID_ARG, "Unsupported transfer type."); 01324 }; 01325 packer.Go(); 01326 log_DBG_m(dbg_DETAIL, "*-DoMigrationJob df_packer created"); 01327 01328 jobElemVecMgr_p->SetJobStatus(hjs_DOMIG); 01329 01330 // if file header can't be locked then its index goes to skipped list. 01331 list<UInt32_t> postponnedList; 01332 01333 for (UInt32_t i = 0; i < numFiles; i++){ 01334 postponnedList.push_back(i); 01335 } 01336 01337 int lastMigLeftCounter = 20; 01338 list<UInt32_t>::iterator iter; 01339 // fix lock bug. Lock list until FH is locked by inode 01340 jobElemVecMgr_p->m_jobElemVecMgr_x.Lock(); 01341 01342 while ((iter = postponnedList.begin()) != postponnedList.end()) { 01343 if (m_shutDownInProgress) { 01344 log_DBG_m (dbg_NORM, "Shut down. Abort DoMigrationJob."); 01345 jobElemVecMgr_p->m_jobElemVecMgr_x.Unlock(); 01346 return numMigFiles; 01347 } 01348 01349 UInt32_t fIdx = *iter; 01350 01351 Int32_t fileIdx = a_jobFiles[fIdx].fileIdx; 01352 01353 if (fileIdx == -1) { 01354 // file is removed from list 01355 log_DBG_m(dbg_DETAIL, "Skip, unused field."); 01356 postponnedList.erase(iter); 01357 continue; 01358 } 01359 hsm_FileHeader *tFHobj = jobElemVecMgr_p->At(fileIdx); 01360 if (tFHobj == NULL) { 01361 // file is removed from list 01362 log_DBG_m(dbg_DETAIL, "Skip FH, it's NULL"); 01363 postponnedList.erase(iter); 01364 continue; 01365 } 01366 ivd_GenInode_t inode = tFHobj->GetInode(); 01367 // try to lock FH 01368 if (!g_hsm_fhLock.CanLockByID(inode)) { 01369 log_DBG_m(dbg_DETAIL, "Postpone FH, it's currently locked."); 01370 // move it to last in list 01371 if (postponnedList.size() == 1) { 01372 ivd_USleep(100000); // only one left, sleep a while 01373 lastMigLeftCounter--; 01374 if (lastMigLeftCounter == 0) { 01375 // fix bug 490 01376 log_ERR_m("DoMigrationJob: Can't lock file " << tFHobj->MakePath() 01377 << " Skip it. Inode " << IVD_PRINT_ID_FS(inode)); 01378 postponnedList.erase(iter); 01379 continue; 01380 // throw ivd_Error(ie_HSM_LONG_INO_LOCK); // time out 01381 } 01382 } 01383 else { 01384 postponnedList.splice(postponnedList.end(), postponnedList, iter); 01385 } 01386 continue; 01387 } 01388 // fix lock bug 01389 log_DBG_m(dbg_DETAIL, "m_jobElemVecMgr_x.Unlock()"); 01390 jobElemVecMgr_p->m_jobElemVecMgr_x.Unlock(); 01391 01392 // fix bug 491 01393 // this member is not under mutex, it is set soon after obj lock 01394 // on other side event manager can set it util wait a while 01395 // after unsucceed lock see /client/hsm/event.mgr.cpp method AddEvent() 01396 tFHobj->SetDataMigStat(eDoMigStart); 01397 01398 // check if job indexes match 01399 if ( tFHobj->GetJobIdx() != jobIdx 01400 || tFHobj->GetJobElemIdx() != fileIdx) { 01401 // FH is probably moved to other list after FH is got, 01402 // checket to NULL and lock it 01403 // another get of FH must be NULL 01404 if (jobElemVecMgr_p->At(fileIdx) != NULL) { 01405 // one of bug 469 01406 // fix bug 491 01407 tFHobj->SetDataMigStat(eNotInDoMig); 01408 g_hsm_fhLock.UnLockByID(inode); 01409 throw ivd_Error(ie_HSM_OTHERLIST); 01410 } 01411 postponnedList.erase(iter); 01412 // fix bug 491 01413 log_DBG_m(dbg_DETAIL, "postponnedList.erase(iter)"); 01414 tFHobj->SetDataMigStat(eNotInDoMig); 01415 g_hsm_fhLock.UnLockByID(inode); 01416 jobElemVecMgr_p->m_jobElemVecMgr_x.Lock(); 01417 continue; 01418 } 01419 01420 UInt64_t migSize; 01421 if (PackFile(a_migrationID, *tFHobj, migSize, packer)) { 01422 tFHobj->MigrationIsDone(); 01423 // 01424 // Do not increase the counter if the file is not packed to the 01425 // disk buffer. 01426 // 01427 // PM needs the information about the number of files actually 01428 // packed in the disk buffer. 01429 // 01430 numMigFiles++; 01431 sizeMigFiles += migSize; 01432 } 01433 01434 postponnedList.erase(iter); 01435 01436 // fix bug 491 01437 tFHobj->SetDataMigStat(eNotInDoMig); 01438 g_hsm_fhLock.UnLockByID(inode); 01439 01440 // fix lock bug 01441 jobElemVecMgr_p->m_jobElemVecMgr_x.Lock(); 01442 } // while (for each file) 01443 // fix lock bug 01444 jobElemVecMgr_p->m_jobElemVecMgr_x.Unlock(); 01445 01446 packer.EndOfData(); // end of data - flush last block 01447 01448 01449 jobElemVecMgr_p->SetJobStatus(hjs_WAITFORCOMPLETEMIG); 01450 log_DBG_m(dbg_LOW, "DoMigrationJob: FINISHED. Waiting for CompleteMigration for JobID " 01451 << a_pmJobId 01452 << " Num files: " << numMigFiles); 01453 ostringstream sstr; 01454 sstr << "Migration (#files: " << numMigFiles 01455 << ", size: " << sizeMigFiles/1024 << " KB)."; 01456 log_WriteEvent(sstr.str(), "", a_pmJobId); 01457 } 01458 ipc_CATCH_IVD_THROW_CORBA_m; 01459 return numMigFiles; 01460 }

| void i_HSM_i::CompleteMigration | ( | i_BufType_t | a_resType, | |
| i_JobID_t | a_pmJobId, | |||
| i_CompletionStatus_e | a_status | |||
| ) |
Definition at line 1715 of file i_hsm_impl.cpp.
References hsm_JobElemVecMgr::At(), hsm_FileHeader::CompleteMigIsDone(), dbg_DETAIL, dbg_NORM, g_hsm_fhLock, g_hsm_preJobList_p, g_hsmDB_p, hsm_FileHeader::GetInode(), hsm_ListPos::GetJobElemIdx(), hsm_JobListMgr::GetJobElemVecMgr(), hsm_ListPos::GetJobIdx(), fio_DataBase::GetTransObj(), hjs_COMPLETEMIG, hjs_MIGFAILED, i_SUCCEDED, ie_HSM_OTHERLIST, ie_JOB_NOT_FOUND, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, IVD_PRINT_ID_FS, ivd_USleep, cmn_Mutex::Lock(), log_DBG_m, log_ERR_m, log_FUNC_m, hsm_JobElemVecMgr::m_jobElemVecMgr_x, m_numMigs, m_shutDownInProgress, hsm_FileHeader::MakePath(), NULL, hsm_JobListMgr::ReleaseJobIdxWithTest(), fio_DataBase::ReleaseTransObj(), hsm_JobListMgr::SetJobStatus(), hsm_JobElemVecMgr::SetJobStatus(), and cmn_Mutex::Unlock().
01718 { 01719 01720 log_FUNC_m(CompleteMigration); 01721 01722 fio_Transaction &trans = *g_hsmDB_p->GetTransObj(); 01723 try { 01724 if (a_status != i_SUCCEDED){ 01725 log_DBG_m(dbg_NORM, "CompleteMigration: Migration IS_NOT SUCCEDED! Files WILL_BE released from job."); 01726 } 01727 01728 // Use iterator on list instead of index on sequence, cause of manipulation. 01729 // if file header can't be locked then its index goes to the end of list. 01730 list<Int32_t> postponnedList; 01731 Int32_t hsmJobIdx(0); 01732 01733 hsm_JobElemVecMgr *jobElemVecMgr_p = g_hsm_preJobList_p->GetJobElemVecMgr(a_pmJobId, hsmJobIdx); 01734 01735 if (jobElemVecMgr_p == NULL) { 01736 // release transaction 01737 g_hsmDB_p->ReleaseTransObj(trans); 01738 01739 ostringstream sstr; 01740 sstr 01741 << "Internal data structures for job don't exist any more. " 01742 << "Job already aborted (?): " << a_pmJobId; 01743 throw ivd_Error(ie_JOB_NOT_FOUND, sstr.str(), true); 01744 } 01745 01746 jobElemVecMgr_p->SetJobStatus(hjs_COMPLETEMIG); 01747 01748 log_DBG_m(dbg_NORM, "CompleteMigration: Start JobIdx=[" << hsmJobIdx << "] for jobID: " << a_pmJobId); 01749 01750 for (Int32_t i = 0; i < (Int32_t)jobElemVecMgr_p->size(); i++){ 01751 postponnedList.push_back(i); 01752 } 01753 01754 int lastMigLeftCounter = 20; 01755 list<Int32_t>::iterator iter; 01756 01757 // 01758 // Code review by Matej Kenda 01759 // Bad design: Locking for class' members is used from 01760 // outside: The object jobElemVecMgr_p should protect it's own members 01761 // by itself. 01762 // 01763 // fix lock bug. Lock list until FH is locked by inode 01764 jobElemVecMgr_p->m_jobElemVecMgr_x.Lock(); 01765 while ((iter = postponnedList.begin()) != postponnedList.end()) { 01766 if (m_shutDownInProgress) { 01767 log_DBG_m (dbg_NORM, "Shut down. Abort CompleteMigration."); 01768 break; 01769 } 01770 01771 Int32_t fIdx = *iter; 01772 01773 log_DBG_m(dbg_DETAIL, "Job at idx [" << hsmJobIdx << ":" << fIdx << "]"); 01774 01775 hsm_FileHeader *tFHobj = jobElemVecMgr_p->At(fIdx); 01776 if (tFHobj == NULL) { 01777 // file is removed from list 01778 log_DBG_m(dbg_DETAIL, "Skip FH, it's NULL"); 01779 postponnedList.erase(iter); 01780 continue; 01781 } 01782 // try to lock FH 01783 ivd_GenInode_t inode = tFHobj->GetInode(); 01784 if (!g_hsm_fhLock.CanLockByID(inode)) { 01785 log_DBG_m(dbg_DETAIL, "Postpone FH, it's currently locked."); 01786 // move it to last in list 01787 if (postponnedList.size() == 1) { 01788 ivd_USleep(100000); // only one left, sleep 0.1 sec for lastMigLeftCounter times 01789 lastMigLeftCounter--; 01790 if (lastMigLeftCounter == 0) { 01791 // fix bug 490 01792 log_ERR_m("CompleteMigration: Can't lock file " << tFHobj->MakePath() 01793 << " Skip it. Inode " << IVD_PRINT_ID_FS(inode)); 01794 postponnedList.erase(iter); 01795 continue; 01796 // throw ivd_Error(ie_HSM_LONG_INO_LOCK); // time out 01797 } 01798 } 01799 else { 01800 postponnedList.splice(postponnedList.end(), postponnedList, iter); 01801 } 01802 continue; 01803 } 01804 // fix lock bug 01805 jobElemVecMgr_p->m_jobElemVecMgr_x.Unlock(); 01806 // check if job indeces match 01807 if ( tFHobj->GetJobIdx() != hsmJobIdx 01808 || tFHobj->GetJobElemIdx() != fIdx) { 01809 // FH is probably moved to other list after FH is got, 01810 // checket to NULL and lock it 01811 // another get of FH must be NULL 01812 // if (g_hsm_preJobList_p->At(hsmJobIdx, fileIdx) != NULL) { 01813 if (jobElemVecMgr_p->At(fIdx) != NULL) { 01814 throw ivd_Error(ie_HSM_OTHERLIST); 01815 } 01816 postponnedList.erase(iter); 01817 g_hsm_fhLock.UnLockByID(inode); 01818 continue; 01819 } 01820 01821 if (tFHobj->CompleteMigIsDone(a_status == i_SUCCEDED, trans)){ 01822 m_numMigs++; // added for statistic by jandrej@hermes.si 01823 } 01824 01825 postponnedList.erase(iter); 01826 01827 g_hsm_fhLock.UnLockByID(inode); 01828 01829 01830 // fix lock bug. Lock list until FH is locked by inode 01831 jobElemVecMgr_p->m_jobElemVecMgr_x.Lock(); 01832 } // for each file 01833 // fix lock bug 01834 jobElemVecMgr_p->m_jobElemVecMgr_x.Unlock(); 01835 01836 if (hsmJobIdx != -1) { 01837 if (a_status != i_SUCCEDED){ 01838 g_hsm_preJobList_p->SetJobStatus(hsmJobIdx, hjs_MIGFAILED); 01839 } 01840 else { 01841 g_hsm_preJobList_p->ReleaseJobIdxWithTest(hsmJobIdx); 01842 } 01843 } 01844 } 01845 ipc_CATCH_IVD_THROW_CORBA_m; 01846 01847 g_hsmDB_p->ReleaseTransObj(trans); 01848 01849 log_DBG_m(dbg_NORM, "CompleteMigration: End for jobID: " << a_pmJobId); 01850 }

| void i_HSM_i::CheckFSCvsIVDFS | ( | i_Count_t | a_numFilesPerBatch, | |
| CORBA::Short | a_sysLoadPct, | |||
| i_UIMessageServer_ptr | a_uims | |||
| ) |
Definition at line 2102 of file i_hsm_impl.cpp.
References ClientConf_t::CfgPartitionName, dbg_DETAIL, cmn_Global::dirs, evt_ERROR, evt_WARNING, g_clientConf_p, g_cmn, g_fs_api_p, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ivd_FileSystemAPI::GetRootPath(), ie_ABORT, ie_HSM_NOTREADY, ie_SINGLETON_EXISTS, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, ivd_Directories::log, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_abortCheckFSCvsIVDFS, m_consistencyCheckRun, m_consistencyCheckRun_x, ivd_Product::m_nameShort, m_ready, cmn_Global::prod, and cmn_TreeWalk::Start().
02105 { 02106 02107 log_FUNC_m(CheckFSCvsIVDFS); 02108 try { 02109 ui_MsgWriter msgWrite(g_cmn.dirs.log + ( string("check_hsmfs_fsc_") 02110 + g_clientConf_p->CfgPartitionName 02111 + string(".log")), 02112 a_uims, false); 02113 if (!m_ready) { 02114 throw ivd_Error(ie_HSM_NOTREADY, "See " + g_cmn.prod.m_nameShort 02115 + ".log to know when ready."); 02116 } 02117 02118 { 02119 cmn_MutexLock l(m_consistencyCheckRun_x); 02120 if (m_consistencyCheckRun) { 02121 ostringstream sstr; 02122 sstr << "HSMFS vs. FSC consistency check already running."; 02123 log_WriteEvent(evt_WARNING, sstr.str()); 02124 throw ivd_Error(ie_SINGLETON_EXISTS, sstr.str()); 02125 } 02126 m_consistencyCheckRun = true; 02127 m_abortCheckFSCvsIVDFS = false; 02128 } 02129 02130 try { 02131 log_DBG_m(dbg_DETAIL, "generate tree walk object" 02132 << " filesPer batch " << a_numFilesPerBatch 02133 << " sysLoad " << a_sysLoadPct << "%"); 02134 02135 02136 TreeWalk tw(g_clientConf_p->CfgPartitionName, 02137 msgWrite, // where to write out msg 02138 a_numFilesPerBatch, 02139 a_sysLoadPct, 02140 m_abortCheckFSCvsIVDFS); 02141 02142 log_DBG_m(dbg_DETAIL, "tree walk object is generated"); 02143 tw.Start(g_fs_api_p->GetRootPath()); 02144 } 02145 catch (ivd_Exception &ie) { 02146 if (ie.GetError() != ie_ABORT) { 02147 ostringstream sstr; 02148 sstr << "Tree-walk failed (" << ie.GetFriendly() << ")."; 02149 log_WriteEvent(evt_ERROR, sstr.str()); 02150 } 02151 } 02152 catch (...) { 02153 log_WriteEvent(evt_ERROR, "Tree-walk failed."); 02154 } 02155 02156 { 02157 cmn_MutexLock l(m_consistencyCheckRun_x); 02158 m_consistencyCheckRun = false; 02159 } 02160 02161 /* ostringstream sstre; 02162 sstre << "End of tree-walk to check IVDFS with FSC."; 02163 log_WriteEvent( sstre.str()); 02164 */ 02165 } 02166 ipc_CATCH_IVD_THROW_CORBA_m; 02167 }

| CORBA::Boolean i_HSM_i::IsCheckFSCvsIVDFSRunning | ( | ) |
Definition at line 2171 of file i_hsm_impl.cpp.
References m_consistencyCheckRun, and m_consistencyCheckRun_x.
02171 { 02172 cmn_MutexLock l(m_consistencyCheckRun_x); 02173 return m_consistencyCheckRun; 02174 }
| void i_HSM_i::Abort | ( | i_HsmTask_e | a_hsmTask | ) |
Definition at line 2384 of file i_hsm_impl.cpp.
References dbg_LOW, i_htCheckFSCvsIVDFS, log_DBG_m, log_FUNC_m, m_abortCheckFSCvsIVDFS, and m_consistencyCheckRun_x.
02384 { 02385 log_FUNC_m(Abort); 02386 log_DBG_m(dbg_LOW, "Abrot called:" << a_hsmTask); 02387 switch (a_hsmTask) { 02388 case i_htCheckFSCvsIVDFS : 02389 { 02390 cmn_MutexLock l(m_consistencyCheckRun_x); 02391 m_abortCheckFSCvsIVDFS = true; 02392 } 02393 break; 02394 default : ; 02395 break; 02396 } 02397 }
| i_Status_t i_HSM_i::Suspend | ( | ) |
Definition at line 2178 of file i_hsm_impl.cpp.
References evt_ERROR, g_hsmDB_p, ivd_BaseException::GetFriendly(), log_FUNC_m, log_WriteEvent(), and fio_DataBase::Suspend().
02178 { 02179 log_FUNC_m(Suspend); 02180 try { 02181 g_hsmDB_p->Suspend(); 02182 log_WriteEvent("HSM DB suspended."); 02183 return 0; 02184 } 02185 catch (ivd_Exception &ie) { 02186 ostringstream sstr; 02187 sstr << "HSM DB suspend failed (" << ie.GetFriendly() << ")."; 02188 log_WriteEvent(evt_ERROR, sstr.str()); 02189 return 1; 02190 } 02191 catch (...) { 02192 log_WriteEvent(evt_ERROR, "HSM DB suspend failed"); 02193 return 1; 02194 } 02195 }

| void i_HSM_i::Continue | ( | i_Status_t | a_status | ) |
Definition at line 2199 of file i_hsm_impl.cpp.
References fio_DataBase::Continue(), evt_ERROR, g_hsmDB_p, ivd_BaseException::GetDescription(), ivd_BaseException::GetFriendly(), ivd_BaseException::GetText(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and log_WriteEvent().
02199 { 02200 log_FUNC_m(Continue); 02201 try { 02202 02203 try { 02204 g_hsmDB_p->Continue(a_status); 02205 log_WriteEvent("HSM DB resumed."); 02206 } 02207 catch (ivd_Exception &ie) { 02208 ostringstream sstr; 02209 sstr << "HSM DB resume failed (" << ie.GetFriendly() << ")."; 02210 log_WriteEvent(evt_ERROR, sstr.str()); 02211 string throwStr = ie.GetText() + ie.GetDescription(); 02212 throw; 02213 } 02214 catch (...) { 02215 log_WriteEvent(evt_ERROR, "HSM DB resume failed."); 02216 throw; 02217 } 02218 } ipc_CATCH_IVD_THROW_CORBA_m; 02219 }

| void i_HSM_i::TrigRecall | ( | const i_FileList_t & | a_files, | |
| CORBA::Boolean | a_byFileName, | |||
| i_MigID_t | a_migID, | |||
| const char * | a_into | |||
| ) |
Definition at line 2222 of file i_hsm_impl.cpp.
References dbg_DETAIL, evt_ERROR, i_Recall_t::fileID, i_Recall_t::fileIdx, g_fs_api_p, g_hsm_preJobList_p, g_iPM, hsm_JobListMgr::GetJobIdx(), hjs_RECALL, ie_PRECONDITION, hsm_JobListMgr::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), fs_api::m_fsUUID, hsm_RecallInfoGrp::m_jobElemIdx, hsm_RecallInfoGrp::m_jobIdx, i_Recall_t::migrationID, hsm_JobListMgr::SetJobStatus(), hsm_JobListMgr::SetMigJobID(), str, and TrigEfficientRecall().
02226 { 02227 02228 log_FUNC_m(TrigRecall); 02229 try { 02230 string into(a_into); 02231 02232 if (!into.empty()) { 02233 // Check for destination file system. 02234 string fsID = cmn_File(into).GetFileSystemID(); 02235 if (g_fs_api_p->m_fsUUID.compare(fsID) == 0) { 02236 string str("Wrong destination file system (" + fsID + ")."); 02237 log_WriteEvent(evt_ERROR, str); 02238 02239 throw ivd_Error(ie_PRECONDITION, 02240 "Recall into hsm file system is not allowed."); 02241 } 02242 } 02243 else { 02244 TrigEfficientRecall(a_files, false); 02245 return; 02246 } 02247 02248 log_DBG_m(dbg_DETAIL, "Manual Recall into '" << a_into 02249 << "' triggered for " << a_files.length() << " files."); 02250 log_DBG_m(dbg_DETAIL, " byName=" << a_byFileName 02251 << ", migID=" << a_migID); 02252 02253 for (UInt32_t i = 0; i < a_files.length(); i++){ 02254 log_DBG_m(dbg_DETAIL, a_files[i].name 02255 << "(" << a_files[i].fileID << ":" << a_files[i].fileIdx << ")"); 02256 02257 // Create new FileHeader w/o owner. 02258 cmn_Path dstFileName(into); 02259 02260 hsm_RecallInfoGrp *pRI = new hsm_RecallInfoGrp( 02261 ivd_FS_File(*g_fs_api_p, dstFileName), 0); // file size is not important 02262 02263 hsm_FileHeader *pFH = new hsm_FileHeader(pRI); 02264 02265 pRI->m_jobIdx = g_hsm_preJobList_p->GetJobIdx(1); 02266 pRI->m_jobElemIdx = g_hsm_preJobList_p->Insert(pRI->m_jobIdx, pFH); 02267 02268 struct i_Recall_t recallStr; 02269 recallStr.fileID = a_files[i].fileID; 02270 recallStr.migrationID = a_migID; 02271 recallStr.fileIdx = a_files[i].fileIdx; 02272 ipc_EXEC_m( 02273 i_JobID_t hsmJobIndexID = g_iPM->Recall(recallStr); 02274 g_hsm_preJobList_p->SetJobStatus(pRI->m_jobIdx, hjs_RECALL); 02275 g_hsm_preJobList_p->SetMigJobID(pRI->m_jobIdx, hsmJobIndexID, 0); 02276 ); 02277 } 02278 } ipc_CATCH_IVD_THROW_CORBA_m; 02279 }

| i_Count_t i_HSM_i::TrigMigration | ( | ) |
Definition at line 2281 of file i_hsm_impl.cpp.
References ClientConf_t::CfgRecallOnly, g_clientConf_p, g_hsm_migcList_p, ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_FUNC_m, log_WriteEvent(), and hsm_FHmigc::TrigMigration().
02281 { 02282 log_FUNC_m(TrigMigration); 02283 UInt32_t numMigrated = 0; 02284 try { 02285 if (g_clientConf_p->CfgRecallOnly) { 02286 throw ivd_Error(ie_PRECONDITION, "Operation not allowed in Recall only mode."); 02287 } 02288 // collect all orphaned files from HSMDB 02289 numMigrated = g_hsm_migcList_p->TrigMigration(); 02290 if (numMigrated) { 02291 ostringstream sstr; 02292 sstr << "Migration triggered by user (#files: " 02293 << numMigrated << ")."; 02294 log_WriteEvent(sstr.str()); 02295 } 02296 } ipc_CATCH_IVD_THROW_CORBA_m; 02297 return numMigrated; 02298 }

| void i_HSM_i::IVDFSRecover | ( | const i_DataBlock_t & | a_friBlock | ) |
Definition at line 2300 of file i_hsm_impl.cpp.
References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_recoverer, and NULL.
02300 { 02301 log_FUNC_m(IVDFSRecover); 02302 try { 02303 if (m_recoverer.get() == NULL) { 02304 m_recoverer.reset(new hsm_IVDFSRecoverer(a_friBlock.length())); 02305 } 02306 else if (m_recoverer->GetBlkSize() != a_friBlock.length()) { 02307 m_recoverer.reset(new hsm_IVDFSRecoverer(a_friBlock.length())); 02308 } 02309 const UInt8_t* block_p = reinterpret_cast<const UInt8_t*>(a_friBlock.get_buffer()); 02310 m_recoverer->Unpack(block_p, 0); 02311 } ipc_CATCH_IVD_THROW_CORBA_m; 02312 }
| CORBA::Long i_HSM_i::IVDFSPrepareRecovery | ( | bool | a_fromScratch, | |
| const char * | a_incrementalFilePath | |||
| ) |
Definition at line 2315 of file i_hsm_impl.cpp.
References cmn_CleanDir(), dbg_DETAIL, cmn_File::DeleteDir(), g_fs_api_p, cmn_Path::GetFileName(), ivd_FileSystemAPI::GetRootPath(), HSMFS_DBDIR, ie_HSM_IVDFS_RECOVERY, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), and PATH_SEPARATOR.
02315 { 02316 log_FUNC_m(IVDFSPrepareRecovery); 02317 cmn_Path toRemove; 02318 try { 02319 // check if FS is empty, remove lost+found if exist 02320 bool fsEmpty = true; 02321 cmn_DirLst dirList(g_fs_api_p->GetRootPath(), ""); 02322 string name = dirList.GetNextName(); 02323 while (name.length() > 0) { 02324 if ( name == "." 02325 || name == "..") { 02326 // empty 02327 } 02328 #if IVD_POSIX_OS 02329 else if (name == "lost+found") { 02330 if (a_fromScratch) { 02331 toRemove = g_fs_api_p->GetRootPath() + name; 02332 } 02333 } 02334 #endif 02335 #if TGT_OS_hpux 02336 else if (name == HSMFS_DBDIR) { 02337 log_DBG_m(dbg_DETAIL, "Found hsmdb directory " HSMFS_DBDIR); 02338 } 02339 #endif 02340 else { 02341 ostringstream sstr; 02342 sstr << "Found entry " << name; 02343 log_WriteEvent(sstr.str(), "HSMFS Recovery"); 02344 02345 fsEmpty = false; 02346 break; 02347 } 02348 name = dirList.GetNextName(); 02349 continue; 02350 } // while (name.length() > 0) 02351 02352 if (a_fromScratch 02353 && !fsEmpty) { 02354 throw ivd_Error(ie_HSM_IVDFS_RECOVERY, "FS is not empty.", true); 02355 } 02356 else if (!a_fromScratch 02357 && fsEmpty) { 02358 throw ivd_Error(ie_HSM_IVDFS_RECOVERY, 02359 "FS is empty and incremental FS recovery is run. Remove " 02360 + string(a_incrementalFilePath) + " file.", true); 02361 } 02362 02363 if (!toRemove.empty()) { 02364 cmn_CleanDir(toRemove); 02365 cmn_File::DeleteDir(toRemove); 02366 ostringstream sstr; 02367 sstr << "Entry " << toRemove.GetFileName() << " is removed"; 02368 log_WriteEvent(sstr.str(), "HSMFS Recovery"); 02369 } 02370 } 02371 ipc_CATCH_IVD_THROW_CORBA_m; 02372 02373 log_DBG_m(dbg_DETAIL, "pathSeparator = " << PATH_SEPARATOR 02374 << ", is it slash = " << boolalpha << (PATH_SEPARATOR == '/')); 02375 return (PATH_SEPARATOR == '/'); // return 1 if client path separator is slash 02376 }

| CORBA::Boolean i_HSM_i::IsHSMReady | ( | ) |
Definition at line 2379 of file i_hsm_impl.cpp.
References m_ready.
02379 { 02380 return m_ready; 02381 }
| i_Count_t i_HSM_i::DoDeletion | ( | const i_FileAgeList_t & | a_files, | |
| i_Count_t & | a_missing | |||
| ) |
Definition at line 2400 of file i_hsm_impl.cpp.
References dbg_DETAIL, cmn_File::DeleteDir(), evt_WARNING, i_FileAge_t::expAge, file, i_FileAge_t::filePath, g_fs_api_p, ivd_BaseException::GetFriendly(), ivd_FileSystemAPI::GetRootPath(), ift_DIR, ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, log_WriteEvent(), NULL, and subcomp_DELETE.
02400 { 02401 log_FUNC_m(DoDeletion); 02402 02403 i_Count_t count = 0; 02404 i_Count_t total = a_files.length(); 02405 ivd_FileInfo_t info; 02406 ivd_Time_t timeNow; 02407 02408 a_missing = 0; 02409 02410 try { 02411 02412 #if IVD_POSIX_OS 02413 #warning "Use cmn_Time, because it already hides platform differences." 02414 timeNow = time(NULL); 02415 #elif TGT_OS_windows 02416 FILETIME ft; 02417 // get current time as filetime 02418 GetSystemTimeAsFileTime(&ft); 02419 // convert to ivd_Time_t: see ToUInt64 and cmn_File::StatF in cmn_File_WIN32.cpp 02420 timeNow = ((static_cast<UInt64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime); 02421 #endif 02422 02423 log_WriteEvent("Started deletion job.", subcomp_DELETE); 02424 for (UInt32_t item = 0; item < total; item++) { 02425 const i_FileAge_t &fileAge = a_files[item]; 02426 cmn_File file(g_fs_api_p->GetRootPath() + string(fileAge.filePath)); 02427 try { 02428 // check for file existence 02429 file.StatF(info); 02430 #if IVD_POSIX_OS 02431 if ((timeNow - info.timeModify) < fileAge.expAge) { 02432 #elif TGT_OS_windows 02433 if (((timeNow - info.timeModify)/10000000) < fileAge.expAge) { 02434 #endif 02435 // file is too young 02436 log_WriteEvent("WARNING: File \"" + file.GetFullPathRef() 02437 + "\" is younger than FSC thinks.", 02438 subcomp_DELETE); 02439 continue; 02440 } 02441 } 02442 catch (ivd_SysError) { 02443 // assume file doesn't exist 02444 a_missing += 1; 02445 log_WriteEvent("WARNING: Path \"" + file.GetFullPathRef() 02446 + "\" does not exist on file system.", 02447 subcomp_DELETE); 02448 continue; 02449 } 02450 // delete file/directory 02451 try { 02452 if (info.type == ift_DIR) { 02453 cmn_File::DeleteDir(file.GetFullPathRef()); 02454 } 02455 else { 02456 02457 // NOTE: In future it would be better to use libfsapi 02458 02459 #if TGT_OS_windows 02460 UInt32_t attr = file.GetFileAttributes(); 02461 bool isReadOnly = (attr & FILE_ATTRIBUTE_READONLY); 02462 02463 if (isReadOnly) { 02464 // Clear RO flag 02465 log_DBG_m(dbg_DETAIL, "Clearing " << file.GetFullPathRef() << " RO attribute.") 02466 file.SetFileAttributes(attr & !FILE_ATTRIBUTE_READONLY); 02467 } 02468 #endif 02469 file.DeleteF(); 02470 } 02471 count += 1; 02472 } 02473 catch (ivd_SysError &se) { 02474 ostringstream sstr; 02475 sstr << "A problem accured when deleting \"" 02476 << file.GetFullPathRef() 02477 << "\". System error " 02478 << se.GetFriendly(); 02479 log_WriteEvent(evt_WARNING, sstr.str(), subcomp_DELETE); 02480 } 02481 } 02482 ostringstream oss; 02483 oss << total << " expired files, " 02484 << count << " deleted files, " 02485 << a_missing << " files not found."; 02486 log_DBG_m(dbg_DETAIL, oss.str()); 02487 log_WriteEvent(oss.str(), subcomp_DELETE); 02488 return count; 02489 } 02490 ipc_CATCH_IVD_THROW_CORBA_m; 02491 }

| void i_HSM_i::SetFullAccess | ( | void | ) |
Definition at line 2494 of file i_hsm_impl.cpp.
References ClientConf_t::CfgOperationMode, ClientConf_t::CfgRecallOnly, ClientConf_t::CfgRecallTimeOut, ClientConf_t::CfgWORMTimeout, dbg_NORM, e_Regular, e_RegularRecallOnly, e_WORM, e_WORMRecallOnly, g_clientConf_p, g_fs_api_p, ivd_FileSystemAPI::GetConfiguration(), i_FST_WORM, log_DBG_m, log_FUNC_m, ivd_FS_Cfg_t::operationMode, ivd_FileSystemAPI::SetConfiguration(), ivd_FS_Cfg_t::syncEventTimeout, and ivd_FS_Cfg_t::WORMTimeout.
02494 { 02495 log_FUNC_m(SetFullAccess); 02496 02497 ivd_FS_Cfg_t cfg; 02498 g_fs_api_p->GetConfiguration(cfg); 02499 02500 cfg.syncEventTimeout = g_clientConf_p->CfgRecallTimeOut; 02501 if (i_FST_WORM == g_clientConf_p->CfgOperationMode) { 02502 if (g_clientConf_p->CfgRecallOnly) { 02503 cfg.operationMode = e_WORMRecallOnly; 02504 log_DBG_m(dbg_NORM, "RecallOnly set!"); 02505 } 02506 else { 02507 cfg.operationMode = e_WORM; 02508 } 02509 cfg.WORMTimeout = g_clientConf_p->CfgWORMTimeout; 02510 } 02511 else { 02512 if (g_clientConf_p->CfgRecallOnly) { 02513 cfg.operationMode = e_RegularRecallOnly; 02514 log_DBG_m(dbg_NORM, "RecallOnly set!"); 02515 } 02516 else { 02517 cfg.operationMode = e_Regular; 02518 } 02519 cfg.WORMTimeout = 0; 02520 } 02521 02522 g_fs_api_p->SetConfiguration(cfg); 02523 }

| void i_HSM_i::MigrateByAPI | ( | CORBA::Long | a_flags, | |
| const char * | a_fileName, | |||
| CORBA::LongLong | a_majorColId, | |||
| CORBA::LongLong | a_minorColId, | |||
| i_JobIDList_t_out | a_jobIDs | |||
| ) |
Definition at line 2627 of file i_hsm_impl.cpp.
References MigrateTreewalk::action_CheckPreconditions, MigrateTreewalk::action_TrigMigration, hsm_MigByAPI::AllFilesInJobs(), API_FLAG_EXCLUSIVE, API_FLAG_RECURSIVE, ClientConf_t::CfgReplTargetHost, ClientConf_t::CfgReplTargetPart, Collocation::CheckPreconditions(), hsm_MigByAPI::ClearList(), ivd_FS_File::Close(), cmn_IsPatternValid(), dbg_DETAIL, dbg_LOW, dbg_NORM, hsm_MigByAPI::DumpInputInode(), hsm_MigByAPI::DumpJobInode(), ivd_FS_File::e_Cache, hsm_MigByAPI::EndCall(), cmn_File::Exists(), file, i_MinorCol_t::flags, g_clientConf_p, g_fs_api_p, g_hsm_migcList_p, g_iPM, g_jobList_c, ivd_BaseException::GetError(), cmn_Path::GetFileName(), ivd_FS_File::GetFullPathRef(), hsm_MigByAPI::GetJobs(), MigrateTreewalk::GetProcessedFilesCount(), ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), ie_HSM_COLLOCATION, ie_HSM_EXCLUSIVE_FLAG, ie_HSM_MIG_RUNNING, ie_INVALID_ARG, ie_NO_HSM, ie_NOTFOUND, ie_RMDB_NOTFOUND, ift_DIR, ift_FILE, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, hsm_MigByAPI::IsRunning(), ivd_Error, IVD_PRINT_ID_FS, ivd_Sleep, log_DBG_m, log_FUNC_m, log_NOTE_m, log_WriteErrorEvent, log_WriteEvent(), log_WRN_m, ivd_FS_FileProperty_t::m_dirtyFlag, ivd_FS_FileProperty_t::m_Inode, hsm_MigByAPI::m_majColId, hsm_MigByAPI::m_minColId, ivd_FS_FileProperty_t::m_type, hsm_MigByAPI::MajColExists(), i_MinorCol_t::majColId, i_MinorCol_t::minColId, ivd_FS_File::Open(), path, cmn_Path::RemoveTrailingPathSeparator(), REPL_JOB_ID_PREFIX, ipc_Corba::ResolveRM(), hsm_MigByAPI::SetColIds(), hsm_MigByAPI::SetMajColList(), cmn_TreeWalk::Start(), hsm_MigByAPI::StartCall(), hsm_FHmigc::TrigMigration(), Collocation::TrigMigration(), cmn_Path::UpPath(), and cmn_Condition::Wait().
02631 { 02632 log_FUNC_m(MigrateByAPI); 02633 try { 02634 #if TGT_OS_windows 02635 UInt64_t numRequestedFiles = 0; 02636 if (g_mig.IsRunning()) { 02637 throw ivd_Error(ie_HSM_MIG_RUNNING); 02638 } 02639 02640 i_HSM_var replHsm; 02641 bool doReplication(false); 02642 ipc_EXEC_m( 02643 doReplication = g_iPM->ReplicationNeeded(); 02644 if (doReplication) { 02645 i_PartitionManager_var iPM = g_iPM->GetReplicationPM(); 02646 02647 log_DBG_m(dbg_NORM, "Getting HSM reference..."); 02648 replHsm = iPM->GetHSM(); 02649 if (CORBA::is_nil(replHsm)) { 02650 throw ivd_Error(ie_NO_HSM, "Partition not mounted or no valid HSM reference on target system."); 02651 } 02652 log_DBG_m(dbg_NORM, "Got HSM reference."); 02653 } 02654 ); 02655 bool recursive(false); 02656 if ((a_flags & API_FLAG_RECURSIVE) == API_FLAG_RECURSIVE){ 02657 log_DBG_m(dbg_NORM, "Recursive"); 02658 recursive = true; 02659 a_flags &= ~API_FLAG_RECURSIVE; 02660 } 02661 g_mig.StartCall(); 02662 02663 g_mig.SetColIds(a_majColId, a_minColId, a_flags); 02664 02665 log_DBG_m(dbg_LOW, "m_majColId: " << g_mig.m_majColId << 02666 ", m_minColId: " << g_mig.m_minColId << 02667 ", a_flags: " << a_flags 02668 ); 02669 i_ResourceManager_var rm; 02670 try { 02671 ipc_EXEC_m( 02672 CORBA::Object_var obj = ipc_Corba::ResolveRM(); 02673 rm = i_ResourceManager::_narrow(obj); 02674 log_DBG_m(dbg_DETAIL,"Sucessfully resolved RM"); 02675 ); 02676 } 02677 catch(ivd_Error) { 02678 log_DBG_m(dbg_NORM, "Couldn't resolve RM reference."); 02679 g_mig.EndCall(); 02680 throw; 02681 } 02682 02683 //check if majColId exists 02684 if (!g_mig.MajColExists(a_majColId)){ 02685 02686 //check if it was added to RM 02687 i_MajorColSeq_t_var mcs = rm->SelectAllMajorCol(); 02688 02689 vector<i_MajorCol_t> mcv; 02690 for(UInt32_t i(0); i < mcs->length(); i++) { 02691 mcv.push_back(mcs[i]); 02692 log_DBG_m(dbg_NORM, "push_back(mcs[i]) for id: " << mcs[i].majColId); 02693 } 02694 g_mig.SetMajColList(mcv); 02695 if (!g_mig.MajColExists(a_majColId)){ 02696 g_mig.EndCall(); 02697 throw ivd_Error(ie_NOTFOUND, "Major Collocation ID not found."); 02698 } 02699 } 02700 02701 //check minorCol 02702 i_MinorCol_t_var minCol; 02703 bool found(false); 02704 try { 02705 ipc_EXEC_m(minCol = rm->SelectMinorCol(a_minColId)); 02706 found = true; 02707 } 02708 catch (ivd_Error &e) { 02709 if (e.GetError() == ie_RMDB_NOTFOUND) { 02710 //insert minColId into rmdb 02711 i_MinorCol_t mc; 02712 mc.minColId = a_minColId; 02713 mc.majColId = a_majColId; 02714 mc.flags = a_flags; 02715 try { 02716 ipc_EXEC_m(rm->AddMinorCol(mc)); 02717 } 02718 catch (...) { 02719 g_mig.EndCall(); 02720 throw; 02721 } 02722 } 02723 else { 02724 g_mig.EndCall(); 02725 throw; 02726 } 02727 } 02728 catch (...) { 02729 g_mig.EndCall(); 02730 throw; 02731 } 02732 02733 if (found) { 02734 log_DBG_m(dbg_DETAIL,"Minor already exists"); 02735 if (minCol->majColId != a_majColId) { 02736 log_DBG_m(dbg_DETAIL,"Minor has different major."); 02737 g_mig.EndCall(); 02738 throw ivd_Error(ie_HSM_COLLOCATION, "Migration with different major ID is not allowed."); 02739 } 02740 if (minCol->flags != a_flags) { 02741 ostringstream sstr; 02742 sstr << "Minor ID: " << a_minColId << " Use old flags("; 02743 if ((a_flags & API_FLAG_EXCLUSIVE) == API_FLAG_EXCLUSIVE) { 02744 sstr << "exclusive)"; 02745 } 02746 else { 02747 sstr << "none)"; 02748 } 02749 sstr << "."; 02750 02751 g_mig.EndCall(); 02752 throw ivd_Error(ie_HSM_EXCLUSIVE_FLAG, sstr.str()); 02753 } 02754 else { 02755 g_mig.SetColIds(a_majColId, a_minColId, minCol->flags); 02756 } 02757 } 02758 02759 bool singleFileMigration(false); 02760 02761 cmn_Path mountPoint(g_fs_api_p->GetRootPath()); 02762 mountPoint.RemoveTrailingPathSeparator(); 02763 log_DBG_m(dbg_NORM, "Force migration on mountpoint : " << mountPoint 02764 << ", file: " << a_fileName); 02765 Int32_t numMigrated = 0; 02766 02767 cmn_Path path(a_fileName); 02768 path.RemoveTrailingPathSeparator(); 02769 log_DBG_m(dbg_NORM, "file to migrate: " << path); 02770 02771 i_JobIDList_t_var jobIDs(new i_JobIDList_t()); 02772 02773 // is fileName a file or directory 02774 bool isDir(false); 02775 // check if migration request on mountpoint 02776 if (path.compare(mountPoint) == 0) { 02777 log_DBG_m(dbg_NORM, "Migration request on mountpoint "); 02778 isDir = true; 02779 } 02780 else { 02781 try { 02782 ivd_FS_FileProperty_t fileProp; 02783 ivd_FS_File file(*g_fs_api_p, path); 02784 file.Open(ivd_FS_File::e_Cache, path); 02785 file.GetProperties(fileProp); 02786 file.Close(); 02787 02788 if ((fileProp.m_type == ift_FILE) && (!recursive)) { 02789 singleFileMigration = true; 02790 if (!fileProp.m_dirtyFlag) { 02791 log_DBG_m(dbg_DETAIL, "The file not dirty. Skipping. Name: " << 02792 a_fileName << ", inode: " << IVD_PRINT_ID_FS(fileProp.m_Inode)); 02793 } 02794 else { 02795 try { 02796 Collocation::CheckPreconditions(path, fileProp, 02797 a_majColId, a_minColId, doReplication); 02798 } 02799 catch (ivd_Error) { 02800 a_jobIDs = jobIDs._retn(); 02801 g_mig.EndCall(); 02802 throw; 02803 } 02804 log_DBG_m(dbg_DETAIL, "Precondition checks passed. " << file.GetFullPathRef()); 02805 02806 Collocation::TrigMigration(file, fileProp.m_Inode, a_majColId, a_minColId); 02807 numRequestedFiles++; 02808 } 02809 } 02810 02811 if (fileProp.m_type == ift_DIR) { 02812 isDir = true; 02813 } 02814 } 02815 catch (ivd_SysError &ise) { 02816 log_DBG_m(dbg_DETAIL, "Caught " << ise); 02817 if (ise.GetError() == ERROR_FILE_NOT_FOUND) { 02818 if (!recursive) { 02819 ostringstream sstr; 02820 sstr << "The file '" << a_fileName << "' requested for migration does not exist."; 02821 log_NOTE_m(sstr.str()); 02822 a_jobIDs = jobIDs._retn(); 02823 g_mig.EndCall(); 02824 throw ivd_Error(ie_INVALID_ARG, sstr.str()); 02825 } 02826 } 02827 else if (ise.GetError() == ERROR_INVALID_NAME) { 02828 log_DBG_m(dbg_DETAIL, "It seems to be pattern " << path); 02829 } 02830 else { 02831 ostringstream sstr; 02832 sstr << "Unexpected path '" << a_fileName << "' requested for migration."; 02833 log_NOTE_m(sstr.str()); 02834 a_jobIDs = jobIDs._retn(); 02835 g_mig.EndCall(); 02836 throw ivd_Error(ie_INVALID_ARG, sstr.str()); 02837 } 02838 } 02839 02840 if (!singleFileMigration) { 02841 string pattern; 02842 cmn_Path walkPath; 02843 02844 if (isDir){ 02845 //walk that dir 02846 walkPath = path; 02847 //all files in that dir 02848 pattern = "*"; 02849 } 02850 else { 02851 //walk updir with pattern 02852 walkPath = path.UpPath(); 02853 pattern = path.GetFileName(); 02854 try { 02855 cmn_File walkPathFile(walkPath); 02856 if(!walkPathFile.Exists()) { 02857 ostringstream sstr; 02858 sstr << "Path: '" << a_fileName << "' does not exist."; 02859 log_NOTE_m(sstr.str()); 02860 a_jobIDs = jobIDs._retn(); 02861 g_mig.EndCall(); 02862 throw ivd_Error(ie_INVALID_ARG, sstr.str()); 02863 } 02864 } 02865 catch (ivd_SysError &ise) { 02866 log_DBG_m(dbg_DETAIL, "Caught " << ise); 02867 ostringstream sstr; 02868 sstr << "Wrong path syntax: " << a_fileName << " specified by API."; 02869 log_NOTE_m(sstr.str()); 02870 a_jobIDs = jobIDs._retn(); 02871 g_mig.EndCall(); 02872 throw ivd_Error(ie_INVALID_ARG, sstr.str()); 02873 } 02874 } 02875 02876 //pattern validation check 02877 if (!cmn_IsPatternValid(pattern)){ 02878 ostringstream sstr; 02879 sstr << "Pattern " << pattern << " in path " << a_fileName << " is not valid!" << endl; 02880 log_NOTE_m(sstr.str()); 02881 a_jobIDs = jobIDs._retn(); 02882 g_mig.EndCall(); 02883 throw ivd_Error(ie_INVALID_ARG, sstr.str()); 02884 } 02885 02886 log_DBG_m(dbg_NORM, "isDir: " << boolalpha << isDir 02887 << " walkPath: " << walkPath << " pattern: " << pattern); 02888 bool abort(false); 02889 try { 02890 MigrateTreewalk treewalk(pattern, a_majColId, a_minColId, recursive, abort, 02891 MigrateTreewalk::action_CheckPreconditions, doReplication); 02892 treewalk.Start(walkPath); 02893 } 02894 catch (...) { 02895 a_jobIDs = jobIDs._retn(); 02896 g_mig.EndCall(); 02897 throw; 02898 } 02899 log_DBG_m(dbg_DETAIL, "Precondition checks passed."); 02900 try { 02901 02902 MigrateTreewalk treewalk(pattern, a_majColId, a_minColId, recursive, abort, 02903 MigrateTreewalk::action_TrigMigration, doReplication); 02904 treewalk.Start(walkPath); 02905 numRequestedFiles = treewalk.GetProcessedFilesCount(); 02906 } 02907 catch (...) { 02908 log_DBG_m(dbg_NORM, "trig migrate failed: " << path); 02909 ostringstream sstr; 02910 sstr << "Unexpected error during API migration."; 02911 log_NOTE_m(sstr.str()); 02912 a_jobIDs = jobIDs._retn(); 02913 g_mig.EndCall(); 02914 throw ivd_Error(ie_INVALID_ARG, sstr.str()); 02915 } 02916 } //if (!singleFileMigration) 02917 } // else (path.compare(mountPoint) == 0) 02918 02919 ostringstream sstr; 02920 sstr << "Migration requested by API (#files: " 02921 << numRequestedFiles << ")."; 02922 log_WriteEvent(sstr.str()); 02923 02924 if (numRequestedFiles == 0) { 02925 a_jobIDs = jobIDs._retn(); 02926 g_mig.EndCall(); 02927 return; 02928 } 02929 02930 //check if all files are migrated 02931 UInt32_t i(1); 02932 while (!g_mig.AllFilesInJobs()) { 02933 ivd_Sleep(i); 02934 02935 log_DBG_m(dbg_DETAIL,"before lock"); 02936 cmn_MutexLock l(g_jobList_x); 02937 numMigrated += g_hsm_migcList_p->TrigMigration(); 02938 02939 log_DBG_m(dbg_NORM, "B4 wait"); 02940 g_jobList_c.Wait(); 02941 02942 i++; 02943 if (i > 10) { 02944 log_WRN_m("Incomplete list of files in migration jobs."); 02945 break; 02946 } 02947 } // while (!g_mig.AllFilesInJobs()) 02948 02949 g_mig.DumpInputInode(); 02950 g_mig.DumpJobInode(); 02951 02952 if (numMigrated) { 02953 ostringstream sstr; 02954 sstr << "Migration triggered by API (#files: " 02955 << numMigrated << ")."; 02956 log_WriteEvent(sstr.str()); 02957 } 02958 02959 { 02960 vector<UInt64_t> jobList = g_mig.GetJobs(); 02961 g_mig.ClearList(); 02962 02963 UInt32_t jobListSize(jobList.size()); 02964 02965 i_JobIDList_t_var replJobs; 02966 if (doReplication) { 02967 log_DBG_m(dbg_NORM, "Triggering migration on replication server " 02968 << g_clientConf_p->CfgReplTargetHost << " partition " 02969 << g_clientConf_p->CfgReplTargetPart); 02970 if (!CORBA::is_nil(replHsm)) { 02971 try { 02972 ipc_EXEC_m( 02973 replHsm->MigrateByAPI(a_flags, 02974 CORBA::string_dup(a_fileName), 02975 a_majColId, 02976 a_minColId, 02977 replJobs); 02978 ); 02979 } 02980 catch (...) { 02981 g_mig.EndCall(); 02982 log_DBG_m(dbg_NORM, "Replication migration failed."); 02983 throw; 02984 } 02985 log_DBG_m(dbg_NORM, "Replication jobs: " << replJobs->length()); 02986 jobListSize += replJobs->length(); 02987 } 02988 else { 02989 log_WriteErrorEvent( "Replication HSM is in not available."); 02990 doReplication = false; // to prevent adding jobs to list 02991 } 02992 } 02993 02994 jobIDs->length(jobListSize); 02995 02996 for (i = 0; i < jobList.size(); i++) { 02997 jobIDs[i] = jobList[i]; 02998 log_DBG_m(dbg_NORM, "Started jobs:" << jobList[i]); 02999 } 03000 03001 if (doReplication) { 03002 for (i = 0; i < replJobs->length(); i++) { 03003 log_DBG_m(dbg_NORM, "job: " << (replJobs[i] + REPL_JOB_ID_PREFIX)); 03004 jobIDs[(jobList.size() + i)] = (replJobs[i] + REPL_JOB_ID_PREFIX); 03005 } 03006 } 03007 03008 a_jobIDs = jobIDs._retn(); 03009 03010 } 03011 g_mig.EndCall(); 03012 #endif 03013 } 03014 ipc_CATCH_IVD_THROW_CORBA_m; 03015 }

| void i_HSM_i::SetReady | ( | bool | a_ready | ) | [inline] |
Definition at line 238 of file i_hsm_impl.h.
References m_ready.
Referenced by fs_api::EventMounted(), and main().
00238 {m_ready = a_ready;};

| void i_HSM_i::SetSendTerminateEvent | ( | bool | a_sendTerminateEvent | ) | [inline] |
Definition at line 240 of file i_hsm_impl.h.
References m_sendTerminateEvent.
Referenced by main().
00240 {m_sendTerminateEvent = a_sendTerminateEvent;};

| void i_HSM_i::SetLastFscFileID | ( | ivd_RecordIDX_t | a_lastFscFileID | ) | [inline] |
Definition at line 241 of file i_hsm_impl.h.
References m_lastFscFileID.
Referenced by main().
00241 {m_lastFscFileID = a_lastFscFileID; };

| ivd_RecordIDX_t i_HSM_i::GetLastFscFileID | ( | ) | [inline] |
Definition at line 242 of file i_hsm_impl.h.
References m_lastFscFileID.
Referenced by fs_api::EventMounted(), and main().
00242 { return m_lastFscFileID; };

| bool i_HSM_i::PackFile | ( | CORBA::LongLong | a_migrationID, | |
| hsm_FileHeader & | fh, | |||
| UInt64_t & | migSize, | |||
| df_Packer & | packer | |||
| ) | [private] |
Definition at line 1465 of file i_hsm_impl.cpp.
References CHG_CHGFILE_d, CHG_DATA_d, CHG_DELETED_d, ivd_FS_File::Close(), cmn_Num2Str(), cmn_Global::dbg, dbg_DETAIL, dbg_LOW, dbg_NORM, df_FS_COMPLETE, df_SS_ABORTED, df_SS_COMPLETE, df_SS_ERROR, df_ST_ALTDATA, df_ST_DATA, df_ST_META, ivd_FS_File::e_Cache, ivd_FS_File::e_Migrate, ivd_FS_File::e_MigrateNoData, eDoMigAbort, eJobList, evt_ERROR, file, g_cmn, g_fs_api_p, df_Packer::GetBSData(), hsm_FileHeader::GetChgFlag(), hsm_FileHeader::GetDataMigStat(), ivd_BaseException::GetError(), hsm_FileHeader::GetFileID(), hsm_FileHeader::GetFOwner(), ivd_BaseException::GetFriendly(), hsm_FileHeader::GetFullPath(), hsm_ListPos::GetJobElemIdx(), log_Debugger::GetLevel(), hsm_FileHeader::GetList(), hsm_FileHeader::GetMigAllowedTime(), hsm_FileHeader::GetOldFullPath(), hsm_FileHeader::GetOldOwnFileID(), hsm_FileHeader::GetOwnFileID(), ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), ivd_FS_File::GetStreamHeader(), ie_DF_SSIZE, ie_IMPOSSIBLE, IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, ivd_FS_FileProperty_t::m_chgTime, m_shutDownInProgress, hsm_FileHeader::MakeStat(), NULL, ivd_FS_File::Open(), hsm_FileHeader::OpenFile(), ivd_FS_File::ReadStream(), hsm_FileHeader::SetDataInPacker(), hsm_FileHeader::SetFHChgFlag(), hsm_FileHeader::SetModifyTimeAtMig(), stt_ALTDATA, stt_DATA, stt_META, stt_NONE, df_Packer::WriteBSData(), df_Packer::WriteRecBSEnd(), df_Packer::WriteRecBSStart(), df_Packer::WriteRecFile(), and df_Packer::WriteRecFileEnd().
Referenced by DoMigrationJob().
01466 { 01467 log_FUNC_m(PackFile); 01468 01469 migSize = 0; 01470 01471 // TODO: it would be nicer if file info (Stat()) would be done thorugh FS API 01472 ivd_FileInfo_t fInfo; 01473 try { 01474 fh.MakeStat(fInfo); 01475 } 01476 catch (ivd_Exception &ie) { 01477 log_DBG_m(dbg_LOW, "PackFile: Cannot STAT File: " << ie.GetFriendly()); 01478 return false; // Skip this file 01479 } 01480 01481 ivd_FileID_t fileID = fh.GetFileID(); 01482 01483 cmn_Path name(fh.GetFullPath()); 01484 cmn_Path oldName(fh.GetOldFullPath()); 01485 UInt32_t chgFlags = fh.GetChgFlag(); 01486 ivd_FS_File file(*g_fs_api_p, fInfo.idOnFS, fileID); 01487 01488 UInt32_t status = df_SS_COMPLETE; 01489 01490 // check for OwnerID bug 2695, 2722 01491 if ( fh.GetFOwner() != NULL 01492 && fh.GetOwnFileID() == 0) { 01493 ostringstream sstr; 01494 sstr << "*** NO OWNER set for INO " << IVD_PRINT_ID_FS(fInfo.idOnFS) 01495 << " fileID= " << fileID 01496 << " file " << name << endl 01497 << "*** File must be migrated again!" ; 01498 log_WriteEvent(evt_ERROR, sstr.str()); 01499 } 01500 01501 // always store file header 01502 packer.WriteRecFile(fileID, a_migrationID, 01503 fh.GetOwnFileID(), fh.GetOldOwnFileID(), 01504 name, oldName, fInfo, 01505 chgFlags, 0, 0); 01506 01507 log_DBG_m(dbg_NORM, "PackFile: [" << fh.GetJobElemIdx() << "]" << endl << 01508 " fileId=" << fileID << 01509 " Inode=" << IVD_PRINT_ID_FS(fInfo.idOnFS) << 01510 " ParentID=" << fh.GetOwnFileID() << 01511 " Size=" << fInfo.size << endl << 01512 " file name=" << name << ", old file name=" << oldName); 01513 01514 if (g_cmn.dbg.GetLevel() == dbg_DETAIL) { 01515 cmn_Time migAllowedTime(fh.GetMigAllowedTime()); 01516 log_DBG_m(dbg_DETAIL, "Info type =" << fInfo.type << 01517 " changedata = " << hex << chgFlags << dec << 01518 " migAllowedTime = " << migAllowedTime.Time2hms() << 01519 " FH list = " << fh.GetList()); 01520 01521 } 01522 01523 // we need to pack file streams if: 01524 if (!(chgFlags & CHG_DELETED_d) // is not deleted (no streams) 01525 && fh.GetMigAllowedTime() <= time(NULL) // did not change (bug 527) 01526 && fh.GetList() == eJobList // is on some job list 01527 && fh.GetDataMigStat() != eDoMigAbort) {// migration was not aborted 01528 01529 // get chgTime from filter to verify if file has changed 01530 ivd_FS_FileProperty_t filePropBefore; 01531 try { 01532 //The file needs to be opened ( to be in the kernel cache ) 01533 file.Open(ivd_FS_File::e_Cache,(g_fs_api_p->GetRootPath() + name)); 01534 file.GetProperties(filePropBefore); 01535 //HPUX 01536 file.Close(); 01537 } 01538 catch (ivd_Exception &ie) { 01539 log_DBG_m(dbg_LOW, "PackFile: Cannot GetProperties before migration: " 01540 << ie.GetFriendly()); 01541 status = df_SS_ERROR; 01542 goto end; // Skip this file 01543 } 01544 fh.SetModifyTimeAtMig(filePropBefore.m_chgTime); 01545 try { 01546 fh.OpenFile(file, (chgFlags & CHG_DATA_d) ? 01547 ivd_FS_File::e_Migrate : 01548 ivd_FS_File::e_MigrateNoData); 01549 } 01550 catch (ivd_Exception &ie) { 01551 log_DBG_m(dbg_NORM, "Cannot open file: " << ie.GetFriendly()); 01552 status = df_SS_ERROR; 01553 goto end; 01554 } 01555 01556 UInt32_t badStreams = 0; 01557 UInt32_t streamType; 01558 string streamName; 01559 ivd_FilePosition_t streamSize; 01560 01561 while ((status == df_SS_COMPLETE) 01562 && (streamType = file.GetStreamHeader(streamName, streamSize)) 01563 != stt_NONE) { 01564 01565 log_DBG_m(dbg_DETAIL, "Stream: " << streamType << 01566 " Size: " << streamSize << 01567 " Name: " << streamName); 01568 01569 UInt32_t dfStreamType(0); 01570 switch (streamType) { 01571 case stt_DATA: dfStreamType = df_ST_DATA; break; 01572 case stt_ALTDATA: dfStreamType = df_ST_ALTDATA; break; 01573 case stt_META: dfStreamType = df_ST_META; break; 01574 default: 01575 throw ivd_InternalError(ie_IMPOSSIBLE, 01576 "Invalid stream type from FS API: " + 01577 cmn_Num2Str(streamType)); 01578 } 01579 packer.WriteRecBSStart(dfStreamType, streamName, streamSize); 01580 01581 UInt64_t streamLeft = streamSize; 01582 01583 while (streamLeft > 0) { 01584 // first check if we are going down... 01585 if (m_shutDownInProgress) { 01586 log_DBG_m (dbg_LOW, "Shut down. Abort DoMigrationJob pack data."); 01587 status = df_SS_ABORTED; 01588 badStreams++; 01589 break; 01590 } 01591 // ...or if file migration is aborted... 01592 if (fh.GetDataMigStat() == eDoMigAbort) { 01593 log_DBG_m(dbg_LOW, "Migration aborted. New event occured." << IVD_PRINT_ID_FS(fInfo.idOnFS)); 01594 status = df_SS_ABORTED; 01595 badStreams++; 01596 break; 01597 } 01598 01599 // allocate DF buffer 01600 UInt8_t *buf; 01601 UInt32_t bufSize, bytesRead; 01602 try { 01603 packer.GetBSData(buf, bufSize); 01604 } 01605 catch (ivd_Exception &ie) { 01606 if (ie.GetError() == ie_DF_SSIZE) { 01607 log_DBG_m(dbg_LOW, "Cannot get buffer for stream: " << 01608 ie.GetFriendly()); 01609 status = df_SS_ABORTED; 01610 badStreams++; 01611 break; 01612 } 01613 else 01614 throw; 01615 } 01616 01617 // read data from stream 01618 try { 01619 01620 bytesRead = file.ReadStream(buf, bufSize); 01621 } 01622 catch (ivd_Exception &ie) { 01623 log_DBG_m(dbg_LOW, "Cannot read stream: " << ie.GetFriendly()); 01624 status = df_SS_ERROR; 01625 badStreams++; 01626 break; 01627 } 01628 01629 // verify if stream is larger than expected (unlikely) 01630 // relatted on bug 710 and fix bug 722 01631 if (streamLeft < bytesRead) { 01632 log_DBG_m(dbg_LOW, "Migration aborted. File was grown." << 01633 IVD_PRINT_ID_FS(fInfo.idOnFS)); 01634 status = df_SS_ABORTED; 01635 badStreams++; 01636 break; 01637 } 01638 01639 // commit DF buffer 01640 packer.WriteBSData(); 01641 01642 streamLeft -= bytesRead; 01643 migSize += bytesRead; 01644 01645 } // (streamLeft > 0) 01646 01647 // Ask fsfilter for change time 01648 ivd_FS_FileProperty_t filePropAfter; 01649 01650 01651 try { 01652 file.GetProperties(filePropAfter); 01653 } 01654 catch (ivd_SysError &ise) { 01655 log_DBG_m(dbg_LOW, "PackFile: Cannot GetProperties after migration: " 01656 << ise.GetFriendly() << " Abort mig."); 01657 status = df_SS_ABORTED; 01658 badStreams++; 01659 } 01660 01661 if (filePropBefore.m_chgTime != filePropAfter.m_chgTime) { 01662 log_DBG_m(dbg_NORM, "PackFile: File Modified. Abort. " << 01663 IVD_PRINT_ID_FS(fInfo.idOnFS)); 01664 status = df_SS_ABORTED; 01665 badStreams++; 01666 01667 //bug 8458 01668 log_DBG_m(dbg_LOW, "Bug 8458"); 01669 //set change flag CHG_CHGFILE_d 01670 ostringstream msg; 01671 msg << "File: " << IVD_PRINT_ID_FS(fInfo.idOnFS) << 01672 " modified while migration in progress. No event detected. Setting CHGFILE event."; 01673 01674 log_WRN_m(msg.str()); 01675 fh.SetFHChgFlag(CHG_CHGFILE_d); 01676 } 01677 01678 try { 01679 packer.WriteRecBSEnd(status); 01680 } 01681 catch (ivd_Exception &ie) { 01682 if (ie.GetError() == ie_DF_SSIZE) { 01683 log_DBG_m(dbg_LOW, "BSEnd error: " << ie.GetFriendly()); 01684 badStreams++; 01685 // end byte stream, with different status -> should succeeed 01686 packer.WriteRecBSEnd(df_SS_ABORTED); 01687 } 01688 else 01689 throw; 01690 } 01691 01692 } // (GetNextHeader() != stt_NONE) 01693 01694 file.Close(); 01695 01696 log_DBG_m(dbg_DETAIL, "* Write for file " << name << " is finished" << 01697 " Streams with errors: " << badStreams); 01698 01699 // mark that data was successfuly migrated 01700 if (badStreams == 0 && (chgFlags & CHG_DATA_d)) { 01701 fh.SetDataInPacker(); 01702 } 01703 } 01704 01705 end: 01706 // df_FS_COMPLETE regardless of fileStatus, as at least file header was written. 01707 packer.WriteRecFileEnd(df_FS_COMPLETE); 01708 01709 // at least file header is migrated 01710 return true; 01711 }


| bool i_HSM_i::UnPackFile | ( | const i_Recall_t & | a_file, | |
| ivd_FS_File & | recallFile, | |||
| bool | manualRecall, | |||
| UInt64_t & | rclSize, | |||
| df_Unpacker & | unpacker | |||
| ) | [private] |
Definition at line 1040 of file i_hsm_impl.cpp.
References ivd_FS_File::Close(), cmn_Num2Str(), dbg_DETAIL, dbg_NORM, df_RF_SPLITTED, df_ST_ALTDATA, df_ST_DATA, df_ST_META, ivd_FS_File::e_RecallInto, evt_ERROR, i_Recall_t::fileID, df_Unpacker::GetBSData(), ivd_BaseException::GetFriendly(), ivd_FS_File::GetFullPathRef(), df_Unpacker::GetNextRecord(), ivd_FS_File::GetStreamLeft(), ie_IMPOSSIBLE, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_shutDownInProgress, i_Recall_t::migrationID, ivd_FS_File::Open(), df_Unpacker::ReadRecBSEnd(), df_Unpacker::ReadRecBSStart(), df_Unpacker::ReadRecFile(), df_Unpacker::ReadRecFileEnd(), rec_BSEnd_c, rec_BSStart_c, rec_Data_c, rec_FileEnd_c, rec_FileHdr_c, rec_NoRec_c, ivd_FS_File::SetFullPath(), ivd_FS_File::SetStreamHeader(), stt_ALTDATA, stt_DATA, stt_META, and ivd_FS_File::WriteStream().
Referenced by Recall().
01042 { 01043 log_FUNC_m(UnPackFile); 01044 01045 bool doFile = false; // set to true when we have found file to recall 01046 bool doData = false; // set to true when we have found file's data to recall 01047 bool dataRecalled = false; // set to true when data was recalled 01048 UInt32_t status = 1; // status of unpacker 01049 01050 UInt64_t idFile; // File ID * 01051 UInt64_t idMig; // Mig ID * 01052 UInt32_t recType; 01053 01054 rclSize = 0; 01055 01056 // used to check amount of recalled data. 01057 Int64_t streamSizeLeft = 0; 01058 UInt64_t sSize = 0; 01059 string sName; 01060 01061 while ((recType = unpacker.GetNextRecord()) != rec_NoRec_c) { 01062 log_DBG_m (dbg_DETAIL, " Unpacker Get Next Rec "); 01063 if (m_shutDownInProgress) { 01064 log_DBG_m (dbg_NORM, "Shut down. Abort recall."); 01065 return false; 01066 } 01067 01068 if (recType == rec_FileHdr_c) { 01069 if (doFile) { // file is already opened, got another filheader 01070 log_DBG_m (dbg_DETAIL, " New FH at Recall. File is already open. Probably next split."); 01071 continue; 01072 } 01073 UInt64_t idParent, idParentOld, chunkSize; 01074 string fname, fnameOld; 01075 UInt32_t changeFlags, fflags; 01076 ivd_FileInfo_t finfo; 01077 01078 unpacker.ReadRecFile(idFile, idMig, idParent, idParentOld, 01079 fname, fnameOld, finfo, 01080 changeFlags, fflags, chunkSize); 01081 01082 // 01083 // TODO: Sync types in IDL after merge to Cosmos. typedefs for known types in IDL. 01084 // 01085 01086 if ( a_file.fileID != idFile 01087 || a_file.migrationID != idMig) { 01088 01089 log_DBG_m (dbg_NORM, " Unpacker SKIPPED wrong fileId or MigID. " << endl << 01090 "\t\t\t\tFileID: " << idFile << " MigID: " << idMig); 01091 continue; // skip this file 01092 } 01093 01094 doFile = true; 01095 01096 cmn_Path recallPath = recallFile.GetFullPathRef(); 01097 log_DBG_m(dbg_NORM, " RECALL data of file " << recallPath); 01098 log_DBG_m(dbg_NORM, " stored name:" << fname); 01099 01100 if (manualRecall) { 01101 // File was not opened, since we had no name until now. 01102 recallFile.SetFullPath(recallPath 01103 + cmn_Path(fname).GetFileName()); 01104 try { 01105 recallFile.Open(ivd_FS_File::e_RecallInto); 01106 } 01107 catch (ivd_SysError &se) { 01108 ostringstream sstr; 01109 sstr << "Cannot open destination file " 01110 << recallFile.GetFullPathRef() 01111 << " for recall into. " 01112 << se.GetFriendly(); 01113 log_WriteEvent(evt_ERROR, sstr.str()); 01114 throw; 01115 } 01116 } 01117 } 01118 else if (recType == rec_FileEnd_c) { 01119 if ( doFile ) { // OK, end of file 01120 UInt32_t recFlags; 01121 unpacker.ReadRecFileEnd(idFile, idMig, status, recFlags); 01122 if (status) { // recall failed 01123 log_ERR_m (" There was an ERROR during recall of file." 01124 << " Status=" << status 01125 << " File='" << recallFile.GetFullPathRef() << "'" 01126 << " total stream size " << sSize 01127 << " Stream size left=" << streamSizeLeft ); 01128 break; 01129 } 01130 01131 if (!(recFlags & df_RF_SPLITTED) 01132 && streamSizeLeft == 0) { // if splitted expect new stream 01133 recallFile.Close(); 01134 01135 break; // exit loop 01136 } 01137 } 01138 } 01139 else if (recType == rec_BSStart_c) { 01140 if (doFile) { 01141 UInt32_t sType; 01142 UInt64_t streamOffset; 01143 01144 unpacker.ReadRecBSStart(sType, sName, sSize, streamOffset); 01145 01146 if (sType == df_ST_DATA // always recall data stream... 01147 || manualRecall) { // ... and other streams if recall into 01148 // We go the data to recall 01149 log_DBG_m(dbg_DETAIL, " Data of file " << recallFile.GetFullPathRef() << " IS_FOUND. RECALL proceed."); 01150 doData = true; 01151 01152 // if this is start of stream 01153 // TODO: is this check required for split files? 01154 if (recallFile.GetStreamLeft() == 0 ) { 01155 streamSizeLeft = sSize; 01156 UInt32_t strType(0); 01157 switch (sType) { 01158 case df_ST_DATA: strType = stt_DATA; break; 01159 case df_ST_ALTDATA: strType = stt_ALTDATA; break; 01160 case df_ST_META: strType = stt_META; break; 01161 default: 01162 throw ivd_InternalError(ie_IMPOSSIBLE, 01163 "Invalid stream type from data format: " + 01164 cmn_Num2Str(sType)); 01165 } 01166 recallFile.SetStreamHeader(strType, sName, sSize); 01167 } 01168 } 01169 } 01170 } 01171 else if (recType == rec_BSEnd_c) { 01172 if (doFile && doData) { // recall complete 01173 unpacker.ReadRecBSEnd(status); 01174 01175 if (status != 0) { 01176 log_ERR_m(" There was an ERROR during recall of file at BSE." 01177 << " Status=" << status 01178 << " File='" << recallFile.GetFullPathRef() << "'" 01179 << " stream name='" << sName << "'" 01180 << " total stream size " << sSize 01181 << " Stream size left=" << streamSizeLeft ); 01182 break; 01183 } 01184 if (streamSizeLeft == 0) { 01185 doData = false; 01186 01187 dataRecalled = true; 01188 log_DBG_m(dbg_DETAIL, " RECALL file " << recallFile.GetFullPathRef() << " FINISHED succesfully"); 01189 } 01190 } 01191 } 01192 else if (recType == rec_Data_c) { 01193 if (doFile && doData) { 01194 UInt8_t *buf; 01195 UInt32_t bufsize; 01196 01197 unpacker.GetBSData(buf, bufsize); 01198 log_DBG_m(dbg_DETAIL, "RECALL to write data to file " << recallFile.GetFullPathRef() << " bufsize: " << bufsize); 01199 01200 UInt32_t written; 01201 written = recallFile.WriteStream(buf, bufsize); 01202 streamSizeLeft -= bufsize; 01203 rclSize += written; 01204 log_DBG_m(dbg_DETAIL, " data is written to file " << recallFile.GetFullPathRef()); 01205 } 01206 } 01207 } // while 01208 log_DBG_m(dbg_NORM, 01209 "Unpacker FINISHED: status " << status 01210 << ", dataRecalled " << boolalpha << dataRecalled 01211 << ", doFile " << boolalpha << doFile); 01212 return doFile && dataRecalled && status == 0; 01213 }


| void i_HSM_i::TrigEfficientRecall | ( | const i_FileList_t & | a_files, | |
| bool | a_MigrateAfter | |||
| ) | [private] |
Definition at line 2526 of file i_hsm_impl.cpp.
References ivd_FS_File::Close(), cmn_IsSpecialFile(), dbg_DETAIL, dbg_LOW, dbg_NORM, hsm_FileHeader::DecrRef(), ivd_FS_File::e_Cache, hsm_FileHeader::EventOffline(), file, i_Recall_t::fileID, i_Recall_t::fileIdx, i_Recall_t::fileSize, g_fs_api_p, g_hsm_fhLock, g_hsm_preJobList_p, g_iPM, hsm_JobListMgr::GetJobIdx(), ivd_FS_File::GetProperties(), hjs_RECALL, hsmGetFH(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_Inode, i_Recall_t::migrationID, ivd_FS_File::Open(), hsm_JobListMgr::ReleaseJobIdx(), hsm_JobListMgr::SetJobStatus(), and hsm_JobListMgr::SetMigJobID().
Referenced by ForceMigration(), and TrigRecall().
02527 { 02528 02529 log_FUNC_m(TrigEfficientRecall); 02530 02531 try { 02532 02533 UInt32_t recallJobIdx = 0; 02534 i_RecallList_t recallList; 02535 recallJobIdx = g_hsm_preJobList_p->GetJobIdx(a_files.length()); 02536 02537 g_hsm_preJobList_p->SetJobStatus(recallJobIdx, hjs_RECALL); 02538 recallList.length(a_files.length()); 02539 log_DBG_m(dbg_DETAIL, "Create job for efficient recall. " 02540 << " number of files: " << a_files.length() 02541 << ", recallJobIdx: " << recallJobIdx); 02542 02543 UInt32_t recListIdx = 0; 02544 for (UInt32_t i = 0; i < a_files.length(); i++){ 02545 log_DBG_m(dbg_DETAIL, a_files[i].name 02546 << "(" << a_files[i].fileID << ":" << a_files[i].fileIdx << ")"); 02547 02548 // Recall latest generation, simulate DataOfflineEvent. 02549 cmn_Path filePath(a_files[i].name); 02550 02551 if (cmn_IsSpecialFile(filePath)){ 02552 log_DBG_m(dbg_DETAIL, "Special file: " << a_files[i].name << " Will skip it."); 02553 continue; 02554 } 02555 02556 ivd_FS_File file(*g_fs_api_p, filePath); 02557 02558 ivd_FS_FileProperty_t fileProp; 02559 try { 02560 file.Open(ivd_FS_File::e_Cache, filePath); 02561 file.GetProperties(fileProp); 02562 file.Close(); 02563 } 02564 catch (ivd_SysError &ise) { 02565 log_DBG_m(dbg_NORM, "Can't get general inode of fileID " << fileProp.m_fileID 02566 << " Probably not exist." << ise); 02567 continue; // no file found 02568 } 02569 // if (!g_hsm_fhLock.CanLockByID(fileProp.m_Inode)) { 02570 // } 02571 g_hsm_fhLock.LockByID(fileProp.m_Inode); 02572 02573 log_DBG_m(dbg_DETAIL, "Find FH. path: " << filePath); 02574 // Get FH and add it to cache 02575 hsm_FileHeader *fileHdr = hsmGetFH(filePath, fileProp); 02576 02577 log_DBG_m(dbg_DETAIL, "Got FH."); 02578 i_Recall_t &recallStr = recallList[recListIdx]; 02579 02580 log_DBG_m(dbg_DETAIL, "Set reference to recall structure."); 02581 // fill up recall structure, remove FH from cache in case of 02582 // failure or file is already online 02583 fileHdr->EventOffline(recallJobIdx, recallStr, a_MigrateAfter); 02584 log_DBG_m(dbg_DETAIL, " #, fileID, migID, fileSize, jIdx, fIdx"); 02585 log_DBG_m(dbg_DETAIL, setw(5) << i 02586 << setw(8) << recallStr.fileID 02587 << setw(13) << recallStr.migrationID 02588 << setw(12) << recallStr.fileSize); 02589 02590 if (recallStr.fileID > 0) { // file is added to recall list 02591 ++recListIdx; 02592 } 02593 else { 02594 // TODO remove FH if is not added to recall job. 02595 } 02596 02597 // GetFH and constructor increase ref automaticaly, 02598 // to prevent others to dereference FH before is linked to some list or job 02599 fileHdr->DecrRef(); 02600 02601 g_hsm_fhLock.UnLockByID(fileProp.m_Inode); 02602 } 02603 02604 recallList.length(recListIdx); 02605 if (recListIdx != 0) { 02606 i_JobID_t hsmJobIndexID(0); 02607 02608 ipc_EXEC_m( 02609 hsmJobIndexID = g_iPM->AllocateNewJobIDforEffRecall(); 02610 ); 02611 02612 log_DBG_m(dbg_LOW, "Created jobs will use the following ID: " << hsmJobIndexID); 02613 g_hsm_preJobList_p->SetJobStatus(recallJobIdx, hjs_RECALL); 02614 g_hsm_preJobList_p->SetMigJobID(recallJobIdx, hsmJobIndexID, 0); 02615 02616 ipc_EXEC_m( 02617 hsmJobIndexID = g_iPM->EfficientRecall(recallList, hsmJobIndexID); 02618 ); 02619 } 02620 else { // No files to recall. Release job. 02621 g_hsm_preJobList_p->ReleaseJobIdx(recallJobIdx); 02622 } 02623 } 02624 ipc_CATCH_IVD_THROW_CORBA_m; 02625 }


UInt32_t i_HSM_i::m_numForcedRelease [private] |
Definition at line 121 of file i_hsm_impl.h.
Referenced by ForceRelease(), GetInfo(), and ShowStatus().
UInt32_t i_HSM_i::m_numRecalls [private] |
UInt32_t i_HSM_i::m_numMigs [private] |
Definition at line 123 of file i_hsm_impl.h.
Referenced by CompleteMigration(), GetInfo(), and ShowStatus().
UInt32_t i_HSM_i::m_upTime [private] |
bool i_HSM_i::m_ready [private] |
ready when filter's events are able to cauth
Definition at line 126 of file i_hsm_impl.h.
Referenced by CheckFSCvsIVDFS(), GetInfo(), IsHSMReady(), and SetReady().
bool i_HSM_i::m_shutDownInProgress [private] |
Definition at line 131 of file i_hsm_impl.h.
Referenced by CompleteMigration(), DoMigrationJob(), PackFile(), Remove(), and UnPackFile().
cmn_Mutex i_HSM_i::m_consistencyCheckRun_x [private] |
Definition at line 132 of file i_hsm_impl.h.
Referenced by Abort(), CheckFSCvsIVDFS(), IsCheckFSCvsIVDFSRunning(), and Remove().
bool i_HSM_i::m_consistencyCheckRun [private] |
Definition at line 133 of file i_hsm_impl.h.
Referenced by CheckFSCvsIVDFS(), and IsCheckFSCvsIVDFSRunning().
bool i_HSM_i::m_abortCheckFSCvsIVDFS [private] |
Definition at line 135 of file i_hsm_impl.h.
Referenced by Abort(), CheckFSCvsIVDFS(), and Remove().
bool& i_HSM_i::m_hsmRun [private] |
bool i_HSM_i::m_sendTerminateEvent [private] |
auto_ptr<hsm_IVDFSRecoverer> i_HSM_i::m_recoverer [private] |
ivd_RecordIDX_t i_HSM_i::m_lastFscFileID [private] |
Definition at line 142 of file i_hsm_impl.h.
Referenced by GetLastFscFileID(), and SetLastFscFileID().
cmn_Mutex i_HSM_i::m_efficientRecall_x [private] |
i_HSM_i::log_CLASSID_m [private] |
1.5.6