|
Classes | |
| class | i_UploadAgent_i |
| class | i_DownloadAgent_i |
| class | ivd_DD_Result |
| Class for passing dd exitcode & output from dd thread to Agent. More... | |
| class | ivd_DD |
| Class for dd thread (for Backup and Restore Agent). More... | |
| class | i_BackupAgent_i |
| class | i_RestoreAgent_i |
| struct | svc_execString |
| class | i_Service_i |
Enumerations | |
| enum | svc_Binaries_e { SVC_IVDRM, SVC_IVDPM, SVC_IVDFSEVTMGR, SVC_IVDHSM, SVC_IVDBEA, SVC_IVDLAS, SVC_IVDLAM, SVC_ECHO, SVC_SENTINEL } |
Functions | |
| i_UploadAgent_i::i_UploadAgent_i (i_DirectoryType_e a_dtType, const char *a_relName) | |
| virtual | i_UploadAgent_i::~i_UploadAgent_i () |
| void | i_UploadAgent_i::Write (const i_DataBlock_t &a_block, i_BlkSize_t a_size) |
| Write methods has built in retries for a predefined amount of time for cases when target disk gets full. | |
| void | i_UploadAgent_i::Close () |
| i_DownloadAgent_i::i_DownloadAgent_i (i_DirectoryType_e a_dtType, const char *a_relName) | |
| virtual | i_DownloadAgent_i::~i_DownloadAgent_i () |
| void | i_DownloadAgent_i::Read (i_DataBlock_t_out a_block, i_BlkSize_t &a_size) |
| void | i_DownloadAgent_i::Close () |
| ivd_DD_Result::ivd_DD_Result () | |
| void | ivd_DD_Result::SetResult (long a_exitCode, const string &a_outputStr) |
| long | ivd_DD_Result::GetResult (string &a_outputStr) |
| ivd_DD::ivd_DD (const string &a_device, const string &a_pipe, UInt32_t a_blkSize, bool a_write, ivd_DD_Result *a_result) | |
| virtual void | ivd_DD::Run (void *a_arg) |
| i_BackupAgent_i::i_BackupAgent_i (const char *a_device, const char *a_pipe, i_BlkSize_t a_blkSize) | |
| virtual | i_BackupAgent_i::~i_BackupAgent_i () |
| CORBA::Long | i_BackupAgent_i::GetResult (CORBA::String_out a_outputStr) |
| i_RestoreAgent_i::i_RestoreAgent_i (const char *a_device, const char *a_pipe, i_BlkSize_t a_blkSize) | |
| virtual | i_RestoreAgent_i::~i_RestoreAgent_i () |
| CORBA::Long | i_RestoreAgent_i::GetResult (CORBA::String_out a_outputStr) |
| enum svc_Binaries_e |
| SVC_IVDRM | |
| SVC_IVDPM | |
| SVC_IVDFSEVTMGR | |
| SVC_IVDHSM | |
| SVC_IVDBEA | |
| SVC_IVDLAS | |
| SVC_IVDLAM | |
| SVC_ECHO | |
| SVC_SENTINEL |
Definition at line 23 of file svc_defines.h.
00023 { 00024 SVC_IVDRM, 00025 SVC_IVDPM, 00026 SVC_IVDFSEVTMGR, 00027 SVC_IVDHSM, 00028 SVC_IVDBEA, 00029 SVC_IVDLAS, 00030 SVC_IVDLAM, 00031 00032 SVC_ECHO, //just for ut 00033 00034 SVC_SENTINEL 00035 } svc_Binaries_e ;
| void i_DownloadAgent_i::Close | ( | void | ) | [inherited] |
Definition at line 191 of file i_netio_impl.cpp.
References cmn_File::CloseF(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and i_DownloadAgent_i::m_source.
00191 { 00192 00193 log_FUNC_m(Close); 00194 00195 try { 00196 m_source.CloseF(); 00197 } 00198 ipc_CATCH_IVD_THROW_CORBA_m; 00199 }

| void i_UploadAgent_i::Close | ( | void | ) | [inherited] |
Definition at line 116 of file i_netio_impl.cpp.
References cmn_File::CloseF(), dbg_LOW, cmn_File::GetCurrentPosF(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, i_UploadAgent_i::m_target, and cmn_File::TruncF().
Referenced by i_UploadAgent_i::~i_UploadAgent_i().
00116 { 00117 00118 log_FUNC_m(Close); 00119 00120 try { 00121 // Only valid amount of data in the block is written to the file 00122 // We have to prolong the last block of the file to be divisable 00123 // with the block size. 00124 ivd_FilePosition_t eofPos = m_target.GetCurrentPosF(); 00125 log_DBG_m(dbg_LOW, "Setting EOF at " << eofPos); 00126 m_target.TruncF(eofPos); 00127 m_target.CloseF(); 00128 } 00129 ipc_CATCH_IVD_THROW_CORBA_m; 00130 }


| CORBA::Long i_RestoreAgent_i::GetResult | ( | CORBA::String_out | a_outputStr | ) | [inherited] |
Definition at line 364 of file i_netio_impl.cpp.
References ivd_DD_Result::GetResult(), log_FUNC_m, and i_RestoreAgent_i::m_ddResult.
00364 { 00365 00366 log_FUNC_m(GetResult); 00367 00368 string outStr; 00369 CORBA::Long ret = m_ddResult.GetResult(outStr); 00370 00371 a_outputStr = CORBA::string_dup(outStr.c_str()); 00372 return ret; 00373 }

| CORBA::Long i_BackupAgent_i::GetResult | ( | CORBA::String_out | a_outputStr | ) | [inherited] |
Definition at line 330 of file i_netio_impl.cpp.
References ivd_DD_Result::GetResult(), log_FUNC_m, and i_BackupAgent_i::m_ddResult.
00330 { 00331 00332 log_FUNC_m(GetResult); 00333 00334 string outStr; 00335 CORBA::Long ret = m_ddResult.GetResult(outStr); 00336 00337 a_outputStr = CORBA::string_dup(outStr.c_str()); 00338 return ret; 00339 }

| long ivd_DD_Result::GetResult | ( | string & | a_outputStr | ) | [inherited] |
Definition at line 223 of file i_netio_impl.cpp.
References log_FUNC_m, ivd_DD_Result::m_exitCode, ivd_DD_Result::m_exited, ivd_DD_Result::m_outputStr, ivd_DD_Result::m_result_c, ivd_DD_Result::m_result_x, and cmn_Condition::Wait().
Referenced by i_RestoreAgent_i::GetResult(), and i_BackupAgent_i::GetResult().
00223 { 00224 log_FUNC_m(GetResult); 00225 00226 cmn_MutexLock l(m_result_x); 00227 00228 while (!m_exited) { 00229 m_result_c.Wait(); 00230 } 00231 00232 a_outputStr = m_outputStr; 00233 return m_exitCode; 00234 }


| i_BackupAgent_i::i_BackupAgent_i | ( | const char * | a_device, | |
| const char * | a_pipe, | |||
| i_BlkSize_t | a_blkSize | |||
| ) | [inherited] |
Definition at line 307 of file i_netio_impl.cpp.
References dbg_NORM, fom_WRITE, g_cmn, cmn_File::GetFullPathRef(), log_DBG_m, log_FUNC_m, i_BackupAgent_i::m_dd, i_BackupAgent_i::m_ddResult, ivd_Product::m_nameShortLC, i_UploadAgent_i::m_target, cmn_File::OpenF(), cmn_Global::prod, and cmn_Thread::Start().
00308 : 00309 i_UploadAgent_i(dt_PIPE, a_relName) { 00310 00311 log_FUNC_m(i_BackupAgent_i); 00312 00313 log_DBG_m(dbg_NORM, "Create " << g_cmn.prod.m_nameShortLC 00314 << "-dd thread for write..."); 00315 m_dd = new ivd_DD(a_device, m_target.GetFullPathRef(), a_blkSize, 00316 true, &m_ddResult); 00317 00318 m_dd->Start(); 00319 00320 // ivd-dd is started, now we can open pipe... 00321 m_target.OpenF(fom_WRITE); 00322 }

| i_DownloadAgent_i::i_DownloadAgent_i | ( | i_DirectoryType_e | a_dtType, | |
| const char * | a_relName | |||
| ) | [inherited] |
Definition at line 136 of file i_netio_impl.cpp.
References cmn_File::CreatePipe(), cmn_Global::dirs, ivd_Directories::diskbuf, dt_DISKBUF, dt_PIPE, dt_TMP, fom_OPEN_EXISTING, fom_READ, g_cmn, ie_INVALID_ARG, log_FUNC_m, i_DownloadAgent_i::m_source, cmn_File::OpenF(), cmn_File::SetFullPath(), and ivd_Directories::tmp.
00138 { 00139 00140 log_FUNC_m(i_DownloadAgent_i); 00141 00142 switch (a_dtType) { 00143 case dt_DISKBUF: 00144 m_source.SetFullPath(g_cmn.dirs.diskbuf + string(a_relName)); 00145 m_source.OpenF(fom_READ | fom_OPEN_EXISTING); 00146 break; 00147 case dt_TMP: 00148 m_source.SetFullPath(g_cmn.dirs.tmp + string(a_relName)); 00149 m_source.OpenF(fom_READ | fom_OPEN_EXISTING); 00150 break; 00151 case dt_PIPE: 00152 m_source.SetFullPath(string(a_relName)); 00153 m_source.CreatePipe(); 00154 // file will be opened explicitly later (when other side is ready) 00155 break; 00156 default: 00157 throw ivd_InternalError(ie_INVALID_ARG, "Wrong data transfer type."); 00158 } 00159 }

| i_RestoreAgent_i::i_RestoreAgent_i | ( | const char * | a_device, | |
| const char * | a_pipe, | |||
| i_BlkSize_t | a_blkSize | |||
| ) | [inherited] |
Definition at line 342 of file i_netio_impl.cpp.
References dbg_NORM, fom_READ, g_cmn, cmn_File::GetFullPathRef(), log_DBG_m, log_FUNC_m, i_RestoreAgent_i::m_dd, i_RestoreAgent_i::m_ddResult, ivd_Product::m_nameShortLC, i_DownloadAgent_i::m_source, cmn_File::OpenF(), cmn_Global::prod, and cmn_Thread::Start().
00343 : 00344 i_DownloadAgent_i(dt_PIPE, a_relName) { 00345 00346 log_FUNC_m(i_RestoreAgent_i); 00347 00348 log_DBG_m(dbg_NORM, "Create " << g_cmn.prod.m_nameShortLC 00349 << "-dd thread for read..."); 00350 m_dd = new ivd_DD(a_device, m_source.GetFullPathRef(), a_blkSize, 00351 false, &m_ddResult); 00352 m_dd->Start(); 00353 00354 // ivd-dd is started, now we can open pipe... 00355 m_source.OpenF(fom_READ); 00356 }

| i_UploadAgent_i::i_UploadAgent_i | ( | i_DirectoryType_e | a_dtType, | |
| const char * | a_relName | |||
| ) | [inherited] |
Definition at line 45 of file i_netio_impl.cpp.
References cmn_File::CreatePipe(), cmn_Global::dirs, ivd_Directories::diskbuf, dt_DISKBUF, dt_PIPE, dt_TMP, fom_CREATE_NEW, fom_WRITE, g_cmn, ie_INVALID_ARG, log_FUNC_A_m, i_UploadAgent_i::m_target, cmn_File::OpenF(), cmn_File::SetFullPath(), and ivd_Directories::tmp.
00047 { 00048 00049 log_FUNC_A_m(i_UploadAgent_i, "name: " << a_relName); 00050 00051 switch (a_dtType) { 00052 case dt_DISKBUF: 00053 m_target.SetFullPath(g_cmn.dirs.diskbuf + string(a_relName)); 00054 m_target.OpenF(fom_WRITE | fom_CREATE_NEW); 00055 break; 00056 case dt_TMP: 00057 m_target.SetFullPath(g_cmn.dirs.tmp + string(a_relName)); 00058 m_target.OpenF(fom_WRITE | fom_CREATE_NEW); 00059 break; 00060 case dt_PIPE: 00061 m_target.SetFullPath(string(a_relName)); 00062 m_target.CreatePipe(); 00063 // file will be opened explicitly later (when other side is ready) 00064 break; 00065 default: 00066 throw ivd_InternalError(ie_INVALID_ARG, "Wrong data transfer type."); 00067 } 00068 }

| ivd_DD::ivd_DD | ( | const string & | a_device, | |
| const string & | a_pipe, | |||
| UInt32_t | a_blkSize, | |||
| bool | a_write, | |||
| ivd_DD_Result * | a_result | |||
| ) | [inherited] |
| ivd_DD_Result::ivd_DD_Result | ( | ) | [inherited] |
Definition at line 203 of file i_netio_impl.cpp.
00203 : 00204 m_result_c(&m_result_x), 00205 m_exited(false), 00206 m_exitCode(-1) { 00207 }
| void i_DownloadAgent_i::Read | ( | i_DataBlock_t_out | a_block, | |
| i_BlkSize_t & | a_size | |||
| ) | [inherited] |
Definition at line 165 of file i_netio_impl.cpp.
References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, i_DownloadAgent_i::m_dataBlock, i_DownloadAgent_i::m_source, and cmn_File::ReadF().
00165 { 00166 00167 log_FUNC_m(Read); 00168 00169 try { 00170 if (m_dataBlock.size() == 0 || m_dataBlock.size() < a_size) { 00171 // (Re)allocate buffer. 00172 m_dataBlock.resize(a_size, 0); 00173 } 00174 00175 ivd_FileRetSize_t readBytes = m_source.ReadF(&(m_dataBlock[0]), a_size); 00176 00177 i_DataBlock_t_var data(new i_DataBlock_t( 00178 readBytes, readBytes, 00179 (CORBA::Octet*)(&(m_dataBlock[0])), 0) ); 00180 00181 a_block = data._retn(); 00182 00183 // Logical block size is the same as requested by the call. 00184 // a_size = a_size; 00185 } 00186 ipc_CATCH_IVD_THROW_CORBA_m; 00187 00188 }

| void ivd_DD::Run | ( | void * | a_arg | ) | [virtual, inherited] |
Reimplemented from cmn_Thread.
Definition at line 248 of file i_netio_impl.cpp.
References cmn_EXEC_WAIT, cmn_ExecCommand(), cmn_Num2Str(), cmn_Global::dbg, dbg_NORM, cmn_Global::dirs, g_cmn, log_Debugger::GetArgFile(), log_Debugger::GetArgFlags(), log_Debugger::GetArgLevel(), ivd_BaseException::GetFriendly(), ivd_Directories::lbin, log_DBG_m, log_FUNC_m, log_WriteEvent(), ivd_DD::m_blkSize, ivd_DD::m_device, ivd_Product::m_nameShortLC, ivd_DD::m_pipe, ivd_DD::m_result, ivd_DD::m_write, cmn_Global::prod, and ivd_DD_Result::SetResult().
00248 { 00249 00250 log_FUNC_m(Run); 00251 00252 log_DBG_m(dbg_NORM, g_cmn.prod.m_nameShortLC << "-dd thread started..."); 00253 00254 long ret = 0; 00255 string ddCmd = g_cmn.dirs.lbin + (g_cmn.prod.m_nameShortLC + "-dd"); // First add strings then paths. 00256 string outStr; 00257 vector<string> argVec; 00258 00259 if (m_write) { 00260 argVec.push_back("--write"); 00261 } 00262 else { 00263 argVec.push_back("--read"); 00264 } 00265 argVec.push_back(m_device); 00266 argVec.push_back(m_pipe); 00267 argVec.push_back(cmn_Num2Str(m_blkSize/1024)); 00268 00269 // append End-Of-Medium script options 00270 argVec.push_back("--eom"); 00271 ostringstream sstr; 00272 sstr << "/usr/bin/python " << g_cmn.dirs.lbin; 00273 if (m_write) { 00274 sstr << g_cmn.prod.m_nameShortLC << "-backup.py --change-medium"; 00275 } 00276 else { 00277 sstr << g_cmn.prod.m_nameShortLC << "-restore.py --change-medium"; 00278 } 00279 00280 argVec.push_back(sstr.str()); 00281 00282 if (g_cmn.dbg.GetArgLevel() != "") { 00283 argVec.push_back("--dbg"); 00284 argVec.push_back(g_cmn.dbg.GetArgLevel()); 00285 argVec.push_back(g_cmn.dbg.GetArgFile()); 00286 argVec.push_back(g_cmn.dbg.GetArgFlags()); 00287 } 00288 00289 try { 00290 ret = cmn_ExecCommand(ddCmd, argVec, cmn_EXEC_WAIT); 00291 } 00292 catch (ivd_Exception &e) { 00293 ostringstream sstr; 00294 sstr << "ERROR: Cannot execute " << ddCmd 00295 << " (" << e.GetFriendly() << ")."; 00296 log_WriteEvent(sstr.str()); 00297 m_result->SetResult(-1, outStr); 00298 return; 00299 } 00300 00301 m_result->SetResult(ret, outStr); 00302 }

| void ivd_DD_Result::SetResult | ( | long | a_exitCode, | |
| const string & | a_outputStr | |||
| ) | [inherited] |
Definition at line 210 of file i_netio_impl.cpp.
References cmn_Condition::Broadcast(), log_FUNC_m, ivd_DD_Result::m_exitCode, ivd_DD_Result::m_exited, ivd_DD_Result::m_outputStr, ivd_DD_Result::m_result_c, and ivd_DD_Result::m_result_x.
Referenced by ivd_DD::Run().
00210 { 00211 log_FUNC_m(SetResult); 00212 00213 cmn_MutexLock l(m_result_x); 00214 00215 m_exited = true; 00216 m_exitCode = a_exitCode; 00217 m_outputStr = a_outputStr; 00218 00219 m_result_c.Broadcast(); 00220 }


| void i_UploadAgent_i::Write | ( | const i_DataBlock_t & | a_block, | |
| i_BlkSize_t | a_size | |||
| ) | [inherited] |
Write methods has built in retries for a predefined amount of time for cases when target disk gets full.
Definition at line 87 of file i_netio_impl.cpp.
References ie_FILE_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_FUNC_m, i_UploadAgent_i::m_target, cmn_File::SeekRelF(), and cmn_File::WriteF().
00087 { 00088 00089 log_FUNC_m(Write); 00090 00091 try { 00092 UInt32_t dataLen = a_block.length(); 00093 if (dataLen > 0) { 00094 UInt32_t bytesWritten = m_target.WriteF(a_block.get_buffer(), dataLen); 00095 if (bytesWritten != dataLen) { 00096 ostringstream sstr; 00097 sstr 00098 << "Written differs from requested: " 00099 << bytesWritten << " != " << dataLen << "."; 00100 00101 throw ivd_Error(ie_FILE_ERROR, sstr.str(), true); 00102 } 00103 } 00104 00105 // valid amount of data might be smaller than block size 00106 // move forward to the end of block size 00107 if (a_size > dataLen) { 00108 m_target.SeekRelF(a_size - dataLen); 00109 } 00110 } 00111 ipc_CATCH_IVD_THROW_CORBA_m; 00112 00113 }

| i_BackupAgent_i::~i_BackupAgent_i | ( | ) | [protected, virtual, inherited] |
Definition at line 325 of file i_netio_impl.cpp.
References log_FUNC_m.
00325 { 00326 log_FUNC_m(~i_BackupAgent_i); 00327 }
| i_DownloadAgent_i::~i_DownloadAgent_i | ( | ) | [protected, virtual, inherited] |
Definition at line 161 of file i_netio_impl.cpp.
References log_FUNC_m.
00161 { 00162 log_FUNC_m(~i_DownloadAgent_i); 00163 }
| i_RestoreAgent_i::~i_RestoreAgent_i | ( | ) | [protected, virtual, inherited] |
Definition at line 359 of file i_netio_impl.cpp.
References log_FUNC_m.
00359 { 00360 log_FUNC_m(~i_RestoreAgent_i); 00361 }
| i_UploadAgent_i::~i_UploadAgent_i | ( | ) | [protected, virtual, inherited] |
Definition at line 70 of file i_netio_impl.cpp.
References i_UploadAgent_i::Close(), cmn_File::IsOpen(), log_FUNC_m, log_WRN_m, and i_UploadAgent_i::m_target.
00070 { 00071 log_FUNC_m(~i_UploadAgent_i); 00072 if (m_target.IsOpen()) { 00073 try { 00074 Close(); 00075 } 00076 catch(...) { 00077 // Ignore everything in dtor. 00078 log_WRN_m("Exception in dtor ignored."); 00079 } 00080 } 00081 }

1.5.6