i_ManagementInterface_i Class Reference
[Management Interface]

#include <i_mif_impl.h>

Inheritance diagram for i_ManagementInterface_i:

Inheritance graph
[legend]
Collaboration diagram for i_ManagementInterface_i:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 34 of file i_mif_impl.h.


Public Member Functions

 i_ManagementInterface_i ()
virtual ~i_ManagementInterface_i ()
void EnableDebug (CORBA::Char a_level, const char *a_output, const char *a_flags, CORBA::ULong a_ivdfsFlags)
void DisableDebug ()
void Remove ()
void UpdateSystemCfg (const char *a_userAtDomain, const i_DataBlock_t &a_cfgFile, i_Index_t &a_newRevNo)
i_DataBlock_tShowSystemCfg (i_Index_t a_revNo)
i_Count_t ShowSystemCfgRevs ()
void SystemStatus (i_UIMessageServer_ptr a_uims)
char * AddLibrary (const char *a_userAtDomain, const i_DataBlock_t &a_cfgFile, i_UIMessageServer_ptr a_uims)
void RemoveLibrary (const char *a_name)
char * UpdateLibrary (const char *a_userAtDomain, const char *a_name, const i_DataBlock_t &a_cfgFile, i_Index_t &a_newRevNo)
i_DataBlock_tShowLibrary (const char *a_name, i_Index_t a_revNo)
i_Count_t ShowLibraryRevs (const char *a_name)
void UpdateLibraryInventory (const char *a_name, CORBA::Boolean a_physicalInv)
void ListLibraries (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
void ShowLibraryInventory (const char *a_name, i_UIMessageServer_ptr a_uims)
void EnableLibrary (const char *a_name, i_UIMessageServer_ptr a_uims)
void DisableLibrary (const char *a_mame, i_UIMessageServer_ptr a_uims)
i_Library_tGetLibrary (const char *a_name)
void ListSlots (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
i_Slot_tGetSlot (const char *a_libraryName, const char *a_slotAddr, CORBA::Long a_type)
char * AddDrive (const char *a_userAtDomain, const i_DataBlock_t &a_cfgFile)
void RemoveDrive (const char *a_name)
char * UpdateDrive (const char *a_userAtDomain, const char *a_name, const i_DataBlock_t &a_cfgFile, i_Index_t &a_newRevNo)
i_DataBlock_tShowDrive (const char *a_name, i_Index_t a_revNo)
i_Count_t ShowDriveRevs (const char *a_name)
i_Drive_tGetDrive (const char *a_name)
void ListDrives (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
void EnableDrive (const char *driveName, i_UIMessageServer_ptr a_uims)
void DisableDrive (const char *driveName, i_UIMessageServer_ptr a_uims)
i_MediaInfoSeq_tGetMediaInfo (const char *a_partName)
i_MinorColSeq_tEnumMinorCollocationId (i_ColID_t a_majColId)
i_MajorColSeq_tEnumMajorCollocationId ()
void ListDriveHosts (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
i_DriveHost_tGetDriveHost (const char *a_driveName, const char *driveHost)
char * AddPool (const char *a_userAtDomain, const i_DataBlock_t &a_cfgFile)
void RemovePool (const char *a_name)
char * UpdatePool (const char *a_userAtDomain, const char *a_name, const i_DataBlock_t &a_cfgFile, i_Index_t &a_newRevNo)
i_DataBlock_tShowPool (const char *a_name, i_Index_t a_revNo)
i_Count_t ShowPoolRevs (const char *a_name)
void ListPools (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
void PoolReorgStat (i_UIMessageServer_ptr a_uims)
i_MediaPool_tGetPool (const char *a_name)
i_MediaPoolSeq_tGetAllPools ()
void RemoveMedium (const char *a_barcode, i_UIMessageServer_ptr a_uims)
void AddMedium (const char *a_barcode)
i_JobID_t FormatAndInitMedium (i_UIMessageServer_ptr a_uims, CORBA::Boolean a_doFormat, CORBA::Boolean a_doInit, CORBA::Boolean a_forced, const char *a_barcode, const i_VolNumList_t &a_volumes)
i_JobID_t RecreateFriAndMic (i_UIMessageServer_ptr a_uims, CORBA::Boolean a_fri, CORBA::Boolean a_mic, CORBA::Boolean a_forced, const char *a_barcode, const i_VolNumList_t &a_volumes, CORBA::Boolean a_into, const char *a_intoPath)
i_JobID_t CloseVolume (i_UIMessageServer_ptr a_uims, const char *a_barcode, const i_VolNumList_t &a_volumes)
i_Job_ptr Backup (const char *a_barcode)
void ListMedia (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
void ListSingleMedium (const char *a_barcode, i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
void MarkMediumUnusable (const char *a_barcode)
void MarkMediumUnreliable (const char *a_barcode)
void MarkMediumGood (const char *a_barcode)
void DuplicateMedium (i_UIMessageServer_ptr a_uims, const char *a_sourceBarCode, const char *a_targetBarCode, CORBA::Boolean a_forced)
void AddMediumToPool (const char *a_barcode, const char *a_poolName, i_UIMessageServer_ptr a_uims)
i_Medium_tGetMedium (const char *a_barcode)
i_Medium_tGetMediumByKey (i_DBKey_t a_mediumKey)
i_MediumSeq_tGetAllMedia ()
void ListMediumVolumes (const char *a_barcode, i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
i_MediumVol_tGetMediumVolume (const char *a_barcode, CORBA::Long a_volNum)
i_MediumVol_tGetMediumVolumeByUUID (const char *a_uuid)
string WaitingForResStatus (i_JobParams_var &a_jobParam, i_Resource_t &a_jobResource, UInt32_t a_copyNum)
void JobInfo (const char *a_partName, i_BitFlag_t a_jobTypeMask, i_UIMessageServer_ptr a_uims)
i_JobList_tGetAllAdminJobs ()
void JobInfoDetail (i_JobID_t a_jobId, i_UIMessageServer_ptr a_uims)
void SetPriority (i_JobID_t a_jobId, i_JobPriorityMod_e a_chgType, CORBA::Long a_value, i_UIMessageServer_ptr a_uims)
void AbortJob (const i_JobIDList_t &a_jobIds, i_UIMessageServer_ptr a_uims)
i_JobID_t CheckFSCvsIVDFS (const char *a_partName, i_Count_t a_numFilesPerBatch, CORBA::Short a_sysLoadPct, i_UIMessageServer_ptr a_uims)
i_JobID_t CheckFSCvsMedia (const char *a_partName, const i_StringList_t &a_volumes, CORBA::Boolean a_autoCorrect, CORBA::Boolean a_removeMissingOnMedia, i_UIMessageServer_ptr a_uims)
i_JobID_t LimitedCheckFSCvsMedia (const i_StringList_t &a_barcodes, const i_VolNumList_t &a_volumes, CORBA::Boolean a_autoCorrect, CORBA::Boolean a_removeMissingOnMedia, i_UIMessageServer_ptr a_uims)
i_JobID_t FSCRecover (const char *a_partName, const i_StringList_t &a_volumes, i_UIMessageServer_ptr a_uims)
i_JobID_t IVDFSRecover (const char *a_partName, i_UIMessageServer_ptr a_uims)
i_JobID_t ReorgScan (const char *a_partName, i_Time_t a_date, CORBA::Long a_numOfGenerations, i_UIMessageServer_ptr a_uims)
 Invokes a scan job on the partition manager.
i_JobID_t Reorg (const char *a_barcode, const i_VolNumList_t &a_volumes, i_UIMessageServer_ptr a_uims)
 Invokes a maintenance job for reorganization on the partition mgr.
i_JobID_t CopyContentsPerVolume (const char *a_barcode, const i_VolNumList_t &a_volumes,::CORBA::Boolean a_best_effort, i_UIMessageServer_ptr a_uims)
 Invokes a maintenance job for redundant copy on the partition mgr.
i_JobID_t CopyContents (const char *a_barcode, i_UIMessageServer_ptr a_uims)
 Invokes a maintenance job for redundant copy on the partition mgr.
void FileHistory (const char *a_clientHost, const char *a_fsID, CORBA::Boolean a_byFileName, const i_FileList_t &a_files, i_UIMessageServer_ptr a_uims)
void RecallFile (const char *a_clientHost, const char *a_fsID, CORBA::Boolean a_byFileName, const i_FileList_t &a_files, i_MigID_t a_migID, const char *a_into, i_UIMessageServer_ptr a_uims)
i_Count_t ReleaseFile (const char *a_clientHost, const char *a_fsID, const i_StringList_t &a_files, i_UIMessageServer_ptr a_uims)
i_Count_t MigrateFile (const char *a_clientHost, const char *a_fsID, const i_StringList_t &a_files, i_UIMessageServer_ptr a_uims)
i_ActivateResult_t ActivateFile (const char *a_clientHost, const char *a_fsID, const i_StringList_t &a_files, i_UIMessageServer_ptr a_uims)
i_Count_t TrigMigration (const char *a_partName, i_UIMessageServer_ptr a_uims)
void TrigDeletion (const char *a_partName, i_UIMessageServer_ptr a_uims, bool &a_noMonitor)
void Mount (const char *host, const char *a_fileUUID, const char *a_mountPoint)
void Umount (const char *host, const char *a_fileUUID, const char *a_mountPoint)
i_PartInfoList_tReportAllPartitions ()
char * AddPartition (const char *a_userAtDomain, const i_DataBlock_t &a_cfgFile)
void RemovePartition (const char *a_name, i_UIMessageServer_ptr a_uims)
void UpdatePartition (const char *a_userAtDomain, const char *a_name, const i_DataBlock_t &a_cfgFile, i_Index_t &a_newRevNo)
i_DataBlock_tShowPartition (const char *a_name, i_Index_t a_revNo)
i_Count_t ShowPartitionRevs (const char *a_name)
void ListPartitions (i_UIMessageServer_ptr a_uims, CORBA::Long a_filter)
void EnablePartition (const char *a_name, i_UIMessageServer_ptr a_uims)
void DisablePartition (const char *a_name, i_UIMessageServer_ptr a_uims)
void PartitionStatus (const char *a_name, i_UIMessageServer_ptr a_uims)
void PartitionReorgStat (const char *a_name, CORBA::ULong a_threshold, i_UIMessageServer_ptr a_uims)
i_StringList_tGetFSList (const char *a_client)
i_Partition_tGetPartition (const char *a_name)
i_Partition_tGetPartitionByUUID (const char *a_uuid)
void ListJobs (string &a_partName, UInt32_t a_jobTypeMask, ui_ResultPacker &a_uires, bool printHeader)
void ListAdminJobs (ui_ResultPacker &a_uires, bool printHeader)
void ListJob (UInt64_t a_jobId, ui_ResultPacker &a_uires)
void SetJobPriority (UInt64_t a_jobId, i_JobPriorityMod_e a_chgType, Int32_t a_value, i_UIMessageServer_ptr a_uims)
void MakeInventoryHeader (ui_ResultPacker &a_uires)
i_Medium_tGetMediumBySlot (i_Slot_t &a_slot, i_MediumSeq_t &a_medSeq)
i_PartitionInfo_t ReportInfo (string partitionName)
void ValidatePMConfig (const cfg_PMCfg &a_partCfg, const string &a_partUUID, string a_name)
void ValidatePoolConfig (const cfg_RMPool &a_poolCfg)

Public Attributes

i_ResourceManager_var m_rm
i_Service_var m_svc

Private Member Functions

ivd_PartitionStatus_e GetPartitionStatus (mif_PartEntry &a_pe, string &a_mtPoint)
ivd_PartitionStatus_e GetPartitionStatus (mif_PartEntry &a_pe, string &a_mtPoint, UInt32_t a_rmdbPartStatus, ivd_PartitionActivity_e &a_activity)
void GetMediumInfo (const i_Medium_t &a_medium, ui_ResultPacker &a_uires, ui_BitFlag a_flags)

Private Attributes

mif_JobManager m_jobMgr
mif_PartMgr m_partMgr
i_LibraryAgent_var m_la
 log_CLASSID_m

Constructor & Destructor Documentation

i_ManagementInterface_i::i_ManagementInterface_i (  ) 

Definition at line 46 of file i_mif_impl.cpp.

References dbg_DETAIL, dbg_LOW, dbg_NORM, evt_ERROR, g_cmn, mif_PartMgr::GetAllPartFromRM(), ivd_BaseException::GetError(), ie_IPC_RESOLVE, ipc_EXEC_m, ivd_Sleep, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), cmn_SysInfo::m_hostName, m_jobMgr, m_partMgr, m_rm, m_svc, ipc_Corba::RegisterMIF(), ipc_Corba::ResolveRM(), ipc_Corba::ResolveSvc(), mif_JobManager::SetIMif(), mif_PartMgr::SetMif(), cmn_Global::si, and mif_PartMgr::StartAllPart().

00046                                                 :
00047     m_partMgr() {
00048     log_FUNC_m(i_ManagementInterface_i);
00049 
00050     m_partMgr.SetMif(this);
00051     
00052 
00053     
00054     // Get SVC reference.
00055     {
00056         CORBA::Object_var obj = ipc_Corba::ResolveSvc(g_cmn.si.m_hostName);
00057         m_svc = i_Service::_narrow(obj);
00058         log_DBG_m(dbg_DETAIL, "MIF: m_svc referenced as: " << m_svc << endl);
00059     }
00060 
00061     //
00062     // Get RM reference.
00063     int retries = 4;
00064     do {
00065         try {
00066             ipc_EXEC_m(
00067                 CORBA::Object_var obj = ipc_Corba::ResolveRM();
00068                 m_rm = i_ResourceManager::_narrow(obj);
00069                 log_DBG_m(dbg_DETAIL,"Sucessfully resolved RM");
00070                 break;
00071             );
00072         }
00073         catch(ivd_Error &ie) {
00074             if (ie.GetError() == ie_IPC_RESOLVE) {
00075                 log_DBG_m(dbg_NORM, "Couldn't resolve RM reference. Sleep & retry.");
00076                 ivd_Sleep(15); //wait for RM to register
00077                 retries--;
00078                 if (retries == 0) {
00079                     log_WriteEvent(evt_ERROR, "MIF couldn't resolve RM even after retries.");
00080                     throw;
00081                 }
00082             } else {
00083                 throw;
00084             }
00085         }
00086     } while(true);
00087 
00088     // Read all partition from rmdb to be able to serve FSEvtMgr
00089     m_partMgr.GetAllPartFromRM();
00090 
00091     //Register to naming service (after this fsEvtMgr will contact MIF)
00092     ipc_EXEC_m(
00093         log_DBG_m(dbg_LOW, "Registering MIF to NamingService.")
00094         i_ManagementInterface_var iMIF = this->_this();
00095 
00096         ipc_Corba::RegisterMIF(iMIF);
00097         log_DBG_m(dbg_DETAIL, "MIF: Reference registered.");
00098     )
00099 
00100     
00101 
00102 
00103     //
00104     // Start all PMs.
00105     try {
00106         m_partMgr.StartAllPart();
00107     }
00108     catch(ivd_Exception& e){
00109         log_ERR_m("could not start all partitions: " << e);
00110     }
00111 
00112     m_jobMgr.SetIMif(this);
00113 
00114 } // i_ManagementInterface_i::i_ManagementInterface_i()

Here is the call graph for this function:

i_ManagementInterface_i::~i_ManagementInterface_i (  )  [virtual]

Definition at line 118 of file i_mif_impl.cpp.

References log_FUNC_m, and ipc_Corba::Shutdown().

00118                                                   {
00119     log_FUNC_m(~i_ManagementInterface_i);
00120 
00121     ipc_Corba::Shutdown();
00122 
00123 } // i_ManagementInterface_i::~i_ManagementInterface_i()

Here is the call graph for this function:


Member Function Documentation

void i_ManagementInterface_i::EnableDebug ( CORBA::Char  a_level,
const char *  a_output,
const char *  a_flags,
CORBA::ULong  a_ivdfsFlags 
)

Definition at line 129 of file i_mif_impl.cpp.

References dbg_NORM, g_cmn, mif_PartMgr::GetAllPart(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_A_m, log_WRN_m, cmn_SysInfo::m_hostName, m_partMgr, m_rm, mps_Online, ipc_Corba::ResolveFSEvtMgr(), ipc_Corba::ResolveLA(), ipc_Corba::ResolveSvc(), cmn_Global::si, and i_Component_i::StartDebug().

00133                              {
00134 
00135     log_FUNC_A_m(EnableDebug, "level: " << a_level <<
00136                               " file: " << a_output <<
00137                               " flags: " << a_flags <<
00138                               " hsmfs: " << hex << a_ivdfsFlags);
00139 
00140     try {
00141         // MIF (myself)
00142         log_DBG_m(dbg_NORM, "StartDebug on MIF");
00143         try {
00144             StartDebug(a_level, a_output, a_flags, a_ivdfsFlags);
00145         }
00146         catch (...) {
00147             // ignore - try to do us much as possible
00148         }
00149 
00150         // RM
00151         log_DBG_m(dbg_NORM, "StartDebug on RM");
00152         try {
00153             m_rm->StartDebug(a_level, a_output, a_flags, a_ivdfsFlags);
00154         }
00155         catch (...) {
00156             // ignore - try to do us much as possible
00157         }
00158 
00159         // LA
00160         i_LibrarySeq_t_var libSeq;
00161         try {
00162             libSeq = m_rm->SelectAllLibraries();
00163         }
00164         catch (...) {
00165             // ignore - try to do us much as possible
00166         }
00167 
00168         for (UInt32_t i = 0; i < libSeq->length(); i++) {
00169             i_LibraryAgent_var iLA;
00170 
00171             try {
00172                 CORBA::Object_var obj = ipc_Corba::ResolveLA(
00173                                            string(libSeq[i].host),
00174                                            string(libSeq[i].libraryName),
00175                                            false);
00176                 iLA = i_LibraryAgent::_narrow(obj);
00177             }
00178             catch (...) {
00179                 // ignore error and check next one...
00180                 log_DBG_m(dbg_NORM, "Warning: cannot resolve LM: " <<
00181                           libSeq[i].libraryName);
00182                 iLA = i_LibraryAgent::_nil();
00183             }
00184 
00185             if (!CORBA::is_nil(iLA)) {
00186                 log_DBG_m(dbg_NORM, "StartDebug on LM: " <<
00187                           libSeq[i].libraryName);
00188                 try {
00189                     iLA->StartDebug(a_level, a_output, a_flags, a_ivdfsFlags);
00190                 }
00191                 catch (...) {
00192                     // ignore - try to do us much as possible
00193                 }
00194             }
00195         }
00196 
00197         // get through list of partitions to get client list & update PM
00198         map<string, bool> clientList;
00199         clientList[g_cmn.si.m_hostName] = true; // add myself
00200 
00201         vector<mif_PartEntry> allPart = m_partMgr.GetAllPart();
00202         for (UInt32_t i=0; i < allPart.size(); ++i) {
00203             clientList[allPart[i].m_partHost] = true;
00204 
00205             // PM
00206             if (allPart[i].m_partStatus == mps_Online) {
00207                 log_DBG_m(dbg_NORM, "StartDebug on PM: " <<
00208                           allPart[i].m_partName);
00209                 try {
00210                     allPart[i].m_iPM->StartDebug(a_level, a_output, a_flags,
00211                                                  a_ivdfsFlags);
00212                 }
00213                 catch (...) {
00214                     // ignore - try to do us much as possible
00215                 }
00216 
00217                 // HSM (if running)
00218                 ipc_EXEC_m(
00219                     i_HSM_var iHSM;
00220                     try {
00221                         iHSM = allPart[i].m_iPM->GetHSM();
00222                     }
00223                     catch(...) {
00224                         iHSM = i_HSM::_nil();
00225                     }
00226 
00227                     if (!CORBA::is_nil(iHSM)) {
00228                         log_DBG_m(dbg_NORM, "StartDebug on HSM: " <<
00229                                   allPart[i].m_partName);
00230                         try {
00231                             iHSM->StartDebug(a_level, a_output, a_flags,
00232                                              a_ivdfsFlags);
00233                         }
00234                         catch (...) {
00235                             // ignore - try to do us much as possible
00236                         }
00237                     }
00238                 );
00239             }
00240         }
00241 
00242         // now go through all clients that have partition configured
00243         for (map<string, bool>::iterator iter = clientList.begin();
00244              iter != clientList.end();
00245              ++iter) {
00246 
00247             // - SVC
00248             i_Service_var iSVC;
00249             try {
00250                 CORBA::Object_var obj = ipc_Corba::ResolveSvc(iter->first, false);
00251                 iSVC = i_Service::_narrow(obj);
00252             }
00253             catch (...) {
00254                 // ignore error and check next one...
00255                 log_DBG_m(dbg_NORM, "Warning: cannot resolve SVC: " <<
00256                           iter->first);
00257                 iSVC = i_Service::_nil();
00258             }
00259 
00260             if (!CORBA::is_nil(iSVC)) {
00261                 log_DBG_m(dbg_NORM, "StartDebug on SVC: " << iter->first);
00262                 try {
00263                     iSVC->StartDebug(a_level, a_output, a_flags, a_ivdfsFlags);
00264                 }
00265                 catch(...) {
00266                     // ignore - try to do us much as possible
00267                 }
00268             }
00269 
00270             // - FSE (all clients)
00271             i_FsEvMgr_var iFSE;
00272             try {
00273                 CORBA::Object_var obj = ipc_Corba::ResolveFSEvtMgr(iter->first,
00274                                                                 false);
00275                 iFSE = i_FsEvMgr::_narrow(obj);
00276             }
00277             catch (...) {
00278                 // ignore error and check next one...
00279                 log_DBG_m(dbg_NORM, "Warning: cannot resolve FSE: " <<
00280                           iter->first);
00281                 iFSE = i_FsEvMgr::_nil();
00282             }
00283 
00284             if (!CORBA::is_nil(iFSE)) {
00285                 log_DBG_m(dbg_NORM, "StartDebug on FSE: " << iter->first);
00286                 try {
00287                     iFSE->StartDebug(a_level, a_output, a_flags, a_ivdfsFlags);
00288                 }
00289                 catch(...) {
00290                     // ignore - try to do us much as possible
00291                 }
00292             }
00293         }
00294 
00295     }
00296     catch (const ivd_Exception& ie) {
00297         log_WRN_m("Can't start debugging: " << ie.GetFriendly() );
00298     }
00299 
00300 }

Here is the call graph for this function:

void i_ManagementInterface_i::DisableDebug (  ) 

Definition at line 306 of file i_mif_impl.cpp.

References dbg_NORM, g_cmn, mif_PartMgr::GetAllPart(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WRN_m, cmn_SysInfo::m_hostName, m_partMgr, m_rm, mps_Online, ipc_Corba::ResolveFSEvtMgr(), ipc_Corba::ResolveLA(), ipc_Corba::ResolveSvc(), cmn_Global::si, and i_Component_i::StopDebug().

00306                                            {
00307     log_FUNC_m(DisableDebug);
00308 
00309     try {
00310         // MIF (myself)
00311         log_DBG_m(dbg_NORM, "StopDebug on MIF");
00312         try {
00313             StopDebug();
00314         }
00315         catch(...) {
00316             // ignore - try to do us much as possible
00317         }
00318 
00319         // RM
00320         log_DBG_m(dbg_NORM, "StopDebug on RM");
00321         try {
00322             m_rm->StopDebug();
00323         }
00324         catch(...) {
00325             // ignore - try to do us much as possible
00326         }
00327 
00328 
00329         // LA
00330         i_LibrarySeq_t_var libSeq;
00331         try {
00332             libSeq = m_rm->SelectAllLibraries();
00333         }
00334         catch (...) {
00335             // ignore - try to do us much as possible
00336         }
00337 
00338         for (UInt32_t i = 0; i < libSeq->length(); i++) {
00339             i_LibraryAgent_var iLA;
00340 
00341             try {
00342                 CORBA::Object_var obj = ipc_Corba::ResolveLA(
00343                                            string(libSeq[i].host),
00344                                            string(libSeq[i].libraryName),
00345                                            false);
00346                 iLA = i_LibraryAgent::_narrow(obj);
00347             }
00348             catch (...) {
00349                 // ignore error and check next one...
00350                 log_DBG_m(dbg_NORM, "Warning: cannot resolve LM: " <<
00351                           libSeq[i].libraryName);
00352                 iLA = i_LibraryAgent::_nil();
00353             }
00354 
00355             if (!CORBA::is_nil(iLA)) {
00356                 log_DBG_m(dbg_NORM, "StopDebug on LM: " <<
00357                           libSeq[i].libraryName);
00358                 try {
00359                     iLA->StopDebug();
00360                 }
00361                 catch(...) {
00362                     // ignore - try to do us much as possible
00363                 }
00364             }
00365         }
00366 
00367         // get through list of partitions to get client list & update PM
00368         map<string, bool> clientList;
00369         clientList[g_cmn.si.m_hostName] = true; // add myself
00370 
00371         vector<mif_PartEntry> allPart = m_partMgr.GetAllPart();
00372         for (UInt32_t i=0; i < allPart.size(); ++i) {
00373             clientList[allPart[i].m_partHost] = true;
00374 
00375             // PM
00376             if (allPart[i].m_partStatus == mps_Online) {
00377                 log_DBG_m(dbg_NORM, "StopDebug on PM: " <<
00378                           allPart[i].m_partName);
00379                 try {
00380                     allPart[i].m_iPM->StopDebug();
00381                 }
00382                 catch(...) {
00383                     // ignore - try to do us much as possible
00384                 }
00385 
00386                 // HSM (if running)
00387                 ipc_EXEC_m(
00388                     i_HSM_var iHSM;
00389                     try {
00390                         iHSM = allPart[i].m_iPM->GetHSM();
00391                     }
00392                     catch(...) {
00393                         iHSM = i_HSM::_nil();
00394                     }
00395 
00396                     if (!CORBA::is_nil(iHSM)) {
00397                         log_DBG_m(dbg_NORM, "StopDebug on HSM: " <<
00398                                   allPart[i].m_partName);
00399                         try {
00400                             iHSM->StopDebug();
00401                         }
00402                         catch(...) {
00403                             // ignore - try to do us much as possible
00404                         }
00405                     }
00406                 );
00407             }
00408         }
00409 
00410         // now go through all clients that have partition configured
00411         for (map<string, bool>::iterator iter = clientList.begin();
00412              iter != clientList.end();
00413              ++iter) {
00414 
00415             // - SVC
00416             i_Service_var iSVC;
00417             try {
00418                 CORBA::Object_var obj = ipc_Corba::ResolveSvc(iter->first, false);
00419                 iSVC = i_Service::_narrow(obj);
00420             }
00421             catch (...) {
00422                 // ignore error and check next one...
00423                 log_DBG_m(dbg_NORM, "Warning: cannot resolve SVC: " <<
00424                           iter->first);
00425                 iSVC = i_Service::_nil();
00426             }
00427 
00428             if (!CORBA::is_nil(iSVC)) {
00429                 log_DBG_m(dbg_NORM, "StopDebug on SVC: " << iter->first);
00430                 try {
00431                     iSVC->StopDebug();
00432                 }
00433                 catch(...) {
00434                     // ignore - try to do us much as possible
00435                 }
00436             }
00437 
00438             // - FSE (all clients)
00439             i_FsEvMgr_var iFSE;
00440             try {
00441                 CORBA::Object_var obj = ipc_Corba::ResolveFSEvtMgr(iter->first,
00442                                                                 false);
00443                 iFSE = i_FsEvMgr::_narrow(obj);
00444             }
00445             catch (...) {
00446                 // ignore error and check next one...
00447                 log_DBG_m(dbg_NORM, "Warning: cannot resolve FSE: " <<
00448                           iter->first);
00449                 iFSE = i_FsEvMgr::_nil();
00450             }
00451 
00452             if (!CORBA::is_nil(iFSE)) {
00453                 log_DBG_m(dbg_NORM, "StopDebug on FSE: " << iter->first);
00454                 try {
00455                     iFSE->StopDebug();
00456                 }
00457                 catch(...) {
00458                     // ignore - try to do us much as possible
00459                 }
00460             }
00461         }
00462 
00463     }
00464     catch (const ivd_Exception& ie) {
00465         log_WRN_m("Can't stop debugging: " << ie.GetFriendly() );
00466     }
00467 }

Here is the call graph for this function:

void i_ManagementInterface_i::Remove (  )  [virtual]

Reimplemented from i_Component_i.

Definition at line 485 of file i_mif_impl.cpp.

References dbg_LOW, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_partMgr, i_Component_i::Remove(), and mif_PartMgr::StopAllPart().

00485                                      {
00486     log_FUNC_m(Remove);
00487 
00488     try {
00489         try {
00490             ipc_EXEC_m(
00491                 m_partMgr.StopAllPart();
00492             )
00493         }
00494         catch (ivd_Exception& e) {
00495             log_DBG_m(dbg_LOW,"Error when deactivating partition" << e);
00496         }
00497 
00498         //
00499         // Do generic cleanup.
00500         i_Component_i::Remove();
00501     }
00502     ipc_CATCH_IVD_THROW_CORBA_m;
00503 
00504 } // i_ManagementInterface_i::Remove()

Here is the call graph for this function:

void i_ManagementInterface_i::UpdateSystemCfg ( const char *  a_userAtDomain,
const i_DataBlock_t a_cfgFile,
i_Index_t a_newRevNo 
)

Definition at line 34 of file i_mif_system.cpp.

References dbg_DETAIL, dbg_NORM, ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, log_WriteEvent(), MIF_CFG_SYSTEM, mif_SYSTEM, mif_CfgRep::ParseToFile(), and mif_CfgRep::Upload().

00037                                                            {
00038 
00039     log_FUNC_m(UpdateSystemCfg);
00040 
00041     try {
00042         // parse config buffer
00043         pf_File pFile;
00044         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_SYSTEM, a_userAtDomain);
00045         cfg_Server systemCfg(pFile);
00046 
00047         mif_CfgRep cfg(mif_SYSTEM, "");
00048         a_newRevNo = cfg.Upload(pFile);
00049         
00050         log_DBG_m(dbg_DETAIL, 
00051             "MIF: System configuration stream is: \n" << pFile);
00052 
00053         log_DBG_m(dbg_NORM, 
00054             "MIF: New system configuration revision added to CfgDB repository.");
00055 
00056 
00057         ostringstream eventText; 
00058         eventText << "Updated (rev. " << a_newRevNo << ").";
00059         log_WriteEvent(eventText.str(), "SYSTEM", 0);
00060     }
00061     ipc_CATCH_IVD_THROW_CORBA_m
00062 } // i_ManagementInterface_i::UpdateSystemCfg()

Here is the call graph for this function:

i_DataBlock_t * i_ManagementInterface_i::ShowSystemCfg ( i_Index_t  a_revNo  ) 

Definition at line 65 of file i_mif_system.cpp.

References mif_CfgRep::GetCfg(), ipc_ReadFromFile(), log_FUNC_m, and mif_SYSTEM.

00065                                                                        {
00066     log_FUNC_m(ShowSystemCfg);
00067 
00068     mif_CfgRep cfgRev(mif_SYSTEM, "");
00069     cmn_File cfgFile = cfgRev.GetCfg(a_revNo);
00070     return ipc_ReadFromFile(cfgFile);
00071 } // i_ManagementInterface_i::ShowSystemCfg()

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::ShowSystemCfgRevs (  ) 

Definition at line 74 of file i_mif_system.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, mif_CfgRep::LastRev(), log_FUNC_m, and mif_SYSTEM.

00074                                                      {
00075     log_FUNC_m(ShowSystemCfgRevs);
00076 
00077     try {
00078 
00079         mif_CfgRep cfgObj(mif_SYSTEM, "");
00080         return cfgObj.LastRev();
00081     }
00082     ipc_CATCH_IVD_THROW_CORBA_m
00083 
00084 } // i_ManagementInterface_i::ShowSystemCfgRevs()

Here is the call graph for this function:

void i_ManagementInterface_i::SystemStatus ( i_UIMessageServer_ptr  a_uims  ) 

Definition at line 87 of file i_mif_system.cpp.

References mif_PartMgr::GetAllPart(), job_Manager::GetJobCount(), GetPartitionStatus(), ui_ResultPacker::GetUIResults(), ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_jobMgr, m_partMgr, mps_Online, ui_ResultPacker::NewRow(), and uires_PARTITIONSTATUS.

00087                                                                        {
00088     log_FUNC_m(SystemStatus);
00089 
00090     try {
00091         // get list of all partition in IVD system 
00092         vector<mif_PartEntry> allPart = m_partMgr.GetAllPart();
00093 
00094         {
00095             ui_ResultPacker uires;
00096             uires.NewRow();
00097 
00098             uires.Insert("# of Partitions:");
00099             uires.Insert(static_cast<UInt32_t>(allPart.size()));
00100             uires.NewRow();
00101 
00102             uires.Insert("# of Admin Jobs:");
00103             uires.Insert(m_jobMgr.GetJobCount());
00104             uires.NewRow();
00105 
00106             // send results
00107             vector<i_UIResult_t> result = uires.GetUIResults();
00108             for (UInt32_t i = 0; i < result.size(); i++){
00109                 a_uims->DisplayResult(result[i]);
00110             }
00111         }
00112 
00113         if (allPart.size() > 0) {
00114             ui_ResultPacker uires;
00115             uires.NewRow(true); // header
00116             uires.Insert("Partition");
00117             uires.Insert("Status");
00118             uires.Insert("#Jobs");
00119             uires.Insert("Host");
00120             uires.Insert("Mountpoint");
00121 
00122             for (UInt32_t i=0; i < allPart.size(); ++i) {
00123                 string partMntPoint;
00124                 ivd_PartitionStatus_e  partStatus = GetPartitionStatus(allPart[i], partMntPoint);
00125 
00126                 UInt32_t runJobs = 0;
00127                 if (allPart[i].m_partStatus == mps_Online) {
00128                     try {
00129                         i_JobList_t_var jobListI;
00130                         jobListI = allPart[i].m_iPM->GetAllJobs();
00131 
00132                         runJobs = jobListI->length();
00133                     }
00134                     catch (...) {
00135                     }
00136                 }
00137 
00138                 uires.NewRow();
00139                 uires.Insert(allPart[i].m_partName);
00140                 uires.Insert(uires_PARTITIONSTATUS, partStatus);
00141                 uires.Insert(runJobs);
00142                 uires.Insert(allPart[i].m_partHost);
00143                 uires.Insert(partMntPoint);
00144             }
00145 
00146             // send results
00147             vector<i_UIResult_t> result = uires.GetUIResults();
00148             for (UInt32_t i = 0; i < result.size(); i++){
00149                 a_uims->DisplayResult(result[i]);
00150             }
00151         }
00152     }
00153     ipc_CATCH_IVD_THROW_CORBA_m
00154 } // i_ManagementInterface_i::SystemStatus()

Here is the call graph for this function:

char * i_ManagementInterface_i::AddLibrary ( const char *  a_userAtDomain,
const i_DataBlock_t a_cfgFile,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 469 of file i_mif_library.cpp.

References cfg_RMLibrary::auditTime, i_Library_t::auditTime, i_Library_t::capabilities, cfg_RMLibrary::controlDevice, i_Library_t::controlDevice, dbg_DETAIL, dbg_NORM, i_Library_t::firmwareRev, ivd_BaseException::GetError(), i_Library_t::host, cfg_RMLibrary::host, ie_MIF_LA_PROBLEM, ie_PRECONDITION, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, ivd_Error, i_Slot_t::libraryName, i_Library_t::libraryName, i_Library_t::libraryType, cfg_RMLibrary::libType, i_Library_t::loadNr, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_rm, cfg_RMLibrary::mailSlots, cfg_RMLibrary::mediaAccessTime, i_Library_t::mediaAccessTime, cfg_RMLibrary::mediaExchangeTime, cfg_RMLibrary::mediaFamily, i_Library_t::mediaFamily, i_Library_t::mediaXChgTime, MIF_CFG_LIBRARY, mif_LIBRARY, cfg_RMLibrary::name, i_Library_t::options, mif_CfgRep::ParseToFile(), mif_CfgRep::ReplaceHosts(), ipc_Corba::ResolveLA(), rmdb_LIBRARY_ERROR, rmdb_MAIL_SLOT_TYPE_ID, rmdb_REP_SLOT_TYPE_ID, rmdb_SLOT_FREE, i_Library_t::scsiID, i_Slot_t::slotAddr, cfg_RMLibrary::slotList, i_Slot_t::slotType, ss_UNKNOWN, i_Slot_t::status, i_Library_t::status, i_Library_t::unloadNr, and mif_CfgRep::Upload().

00471                                                                         {
00472 
00473     log_FUNC_m(AddLibrary);
00474     try {
00475 
00476         pf_File pFile;
00477         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_LIBRARY, a_userAtDomain);
00478         mif_CfgRep::ReplaceHosts(pFile);
00479         
00480         cfg_RMLibrary libraryCfg(pFile);
00481         
00482         log_DBG_m(dbg_NORM, "libraryCfg.host: " << libraryCfg.host);
00483         
00484         //check if slot overlap
00485         for (UInt32_t k(0); k+1 < libraryCfg.slotList.size(); k++){
00486             for (UInt32_t l(k+1); l < libraryCfg.slotList.size(); l++){
00487                 if (libraryCfg.slotList[l].Val() == libraryCfg.slotList[k].Val())
00488                     throw ivd_Error(ie_PRECONDITION, "Overlapping slots.");
00489             }
00490         } 
00491         
00492         //
00493         // copy configuration data
00494         i_Library_t libraryI;
00495         libraryI.libraryName     = CORBA::string_dup(libraryCfg.name.c_str());
00496         libraryI.controlDevice   = CORBA::string_dup(libraryCfg.controlDevice.c_str());
00497         libraryI.host            = CORBA::string_dup(libraryCfg.host.c_str());
00498         
00499         libraryI.libraryType     = libraryCfg.libType;
00500         libraryI.mediaFamily     = libraryCfg.mediaFamily;   
00501         log_DBG_m(dbg_DETAIL,"MIF: libraryCfg.libType: " << libraryCfg.libType);
00502 
00503         libraryI.options         = 0;   // int <- vector<val_Element> ?! (libraryCfg.options) 
00504         libraryI.capabilities    = 0;   // int <- vector<val_Element> ?! (libraryCfg.capabilities)
00505 
00506         libraryI.auditTime       = libraryCfg.auditTime;       
00507         libraryI.mediaXChgTime   = libraryCfg.mediaExchangeTime;
00508         libraryI.mediaAccessTime = libraryCfg.mediaAccessTime;
00509 
00510         libraryI.status          = 0;   // initial status.
00511         libraryI.loadNr          = 0;   // new library!
00512         libraryI.unloadNr        = 0;   // new library!
00513         libraryI.firmwareRev     = CORBA::string_dup(ipc_nilStr);   // new library!
00514         libraryI.scsiID          = CORBA::string_dup(ipc_nilStr);   // new library!
00515         log_DBG_m(dbg_NORM, "MIF: i_Library_t structure filled.");
00516 
00517         //
00518         // check if library is configured.
00519         try {
00520             i_Library_t_var libI;
00521             ipc_EXEC_m(libI = m_rm->SelectLibrary( libraryI.libraryName));
00522             log_DBG_m(dbg_NORM, "MIF: Library is configured.");
00523             throw ivd_Error(ie_PRECONDITION, 
00524                 "Library already configured: " + string(libraryI.libraryName));
00525            
00526         } catch (ivd_Exception &e) {
00527             log_DBG_m(dbg_NORM, e);
00528             if (e.GetError() == ie_RMDB_NOTFOUND) {
00529                 //continue
00530             } else 
00531                 throw;
00532         }
00533         
00534         //
00535         // add library entry to RMDB
00536         try {
00537             ipc_EXEC_m(
00538                 m_rm->AddLibrary(libraryI);
00539                 log_DBG_m(dbg_NORM, 
00540                     "MIF: library " << libraryCfg.name << " added into RMDB");
00541             );
00542         } catch (ivd_Error& e){
00543             if (e.GetError() == ie_RMDB_NOTFOUND)
00544                 throw ivd_Error(ie_RMDB_NOTFOUND, 
00545                 "Adding of Library failed. " + libraryCfg.name);
00546             else 
00547                 throw;
00548         }
00549 
00550         //
00551         // add this library's repository slot entries to RMDB.
00552 
00553         for (UInt32_t ct=0; ct<libraryCfg.slotList.size(); ct++) {
00554             {
00555                 i_Slot_t repSlotI;
00556 
00557                 repSlotI.libraryName = libraryI.libraryName;
00558                 repSlotI.slotAddr    = CORBA::string_dup(libraryCfg.slotList[ct].Val().c_str());
00559                 repSlotI.slotType    = rmdb_REP_SLOT_TYPE_ID;
00560                 //repSlotI.slotKey   = generated!
00561                 
00562                 //slot status will be set to proper value by inventory
00563                 repSlotI.status      = ss_UNKNOWN;
00564 
00565                 ipc_EXEC_m(
00566                     m_rm->AddSlot(repSlotI);
00567                 );
00568             }
00569         }
00570 
00571 
00572         //
00573         // add this library's mail slot entries to RMDB.
00574 
00575         for (UInt32_t ct=0; ct<libraryCfg.mailSlots.size(); ct++) {
00576             {
00577                 i_Slot_t mailSlotI;
00578 
00579                 mailSlotI.libraryName = libraryI.libraryName;
00580                 mailSlotI.slotAddr    = CORBA::string_dup(libraryCfg.mailSlots[ct].Val().c_str());
00581                 mailSlotI.slotType    = rmdb_MAIL_SLOT_TYPE_ID;
00582                 //mailSlotI.slotKey   = generated!
00583                 mailSlotI.status      = rmdb_SLOT_FREE;
00584 
00585                 ipc_EXEC_m(
00586                     m_rm->AddSlot(mailSlotI);
00587                 );
00588             }
00589         }
00590         
00591         //
00592         // notify jobs in job list about new resource
00593         ipc_EXEC_m(
00594             m_rm->UseNewResource();
00595         );
00596         log_DBG_m(dbg_NORM, "MIF: after UseNewResource()");
00597 
00598         //
00599         // save first revision of library cfg file to configuration repository.
00600         log_DBG_m(dbg_DETAIL, 
00601             "MIF: configuration stream is: \n" << pFile);
00602 
00603         mif_CfgRep cfg(mif_LIBRARY, libraryCfg.name);
00604         cfg.Upload(pFile);
00605 
00606         log_DBG_m(dbg_NORM, 
00607             "MIF: library configuration added to CfgDB repository.");
00608 
00609         ostringstream eventText;
00610         eventText << "Added new.";
00611 
00612         log_WriteEvent(eventText.str(), "LIBRARY", 0, libraryCfg.name);
00613         
00614         //
00615         // start new LA.
00616         try {
00617             i_LibraryAgent_var la;
00618             eventText.str("");
00619             ipc_EXEC_m(
00620                 m_rm->StartLA(CORBA::string_dup(libraryCfg.name.c_str()));
00621             );
00622             
00624             ipc_EXEC_m(
00625                 CORBA::Object_var obj =
00626                 ipc_Corba::ResolveLA(
00627                     libraryCfg.host, libraryCfg.name, true);
00628                 la = i_LibraryAgent::_narrow(obj);
00629             );
00630             if (la->_is_nil() || la->_non_existent()) {
00631                 //Set status of library to "ERROR" because LA is not running
00632                 UInt32_t status(rmdb_LIBRARY_ERROR);
00633                 m_rm->LibraryStatusSet(libraryI.libraryName, status);
00634                 throw ivd_Error(
00635                     ie_MIF_LA_PROBLEM, "Library agent not accessible.");
00636             }
00637             eventText << "Library " << libraryCfg.name 
00638                       << " added successfully.";
00639         }
00640         catch (ivd_Error& e) {
00641             log_ERR_m(
00642                 "MIF: Library Agent for this library can't be started " <<
00643                 "after adding it. Reported error: " << e);
00644                 
00645             eventText << "Library " << libraryCfg.name 
00646                       << " added, but could not be started.";
00647             
00648             //Set status of library to "ERROR": Library is enabled, but LA is not running for some reason
00649             UInt32_t status(rmdb_LIBRARY_ERROR);
00650             m_rm->LibraryStatusSet(libraryI.libraryName, status);
00651         }
00652         a_uims->DisplayMessage(eventText.str().c_str());
00653 
00654         return CORBA::string_dup(libraryCfg.name.c_str());
00655 
00656     } ipc_CATCH_IVD_THROW_CORBA_m
00657 } // i_ManagementInterface_i::AddLibrary()

Here is the call graph for this function:

void i_ManagementInterface_i::RemoveLibrary ( const char *  a_name  ) 

Definition at line 1153 of file i_mif_library.cpp.

References dbg_NORM, ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, ivd_Error, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_rm, mif_LIBRARY, and mif_CfgRep::RemoveCfg().

01153                                                               {
01154     log_FUNC_m(RemoveLibrary);
01155 
01156     try {
01157         i_Library_t_var lib;
01158         ipc_EXEC_m(
01159             lib = m_rm->SelectLibrary(CORBA::string_dup(a_name));
01160         );
01161         log_DBG_m(dbg_NORM, "MIF: Library is configured.");       
01162 
01163         //
01164         // check if some drives for this library exist.
01165         i_DriveSeq_t_var driveSeq;
01166         ipc_EXEC_m(
01167             driveSeq = m_rm->SelectAllDrives();
01168         );
01169 
01170         for (UInt32_t i(0); i < driveSeq->length(); i++) {
01171             if (strcmp(driveSeq[i].libraryName, a_name) == 0) {
01172                 throw ivd_Error(ie_PRECONDITION, 
01173                                 "There are some configured drives, that belong "
01174                                 "to this library.");
01175             }
01176         }
01177 
01178         //
01179         // check if some media have slots from this library assigned.
01180         i_MediumSeq_t_var mediaSeq;
01181         ipc_EXEC_m(
01182             mediaSeq = m_rm->SelectAllMedia();
01183         );
01184 
01185         log_DBG_m(dbg_NORM, "MIF: Before check.");
01186 
01187         //check if library contains any medium
01188         for (UInt32_t m(0); m < mediaSeq->length(); m++) {
01189             if (strcmp(mediaSeq[m].libraryName, a_name) == 0){
01190                 mediaSeq[m].libraryName = CORBA::string_dup(ipc_nilStr);
01191                 mediaSeq[m].slotAddr = CORBA::string_dup(ipc_nilStr);
01192                 ipc_EXEC_m(
01193                     m_rm->UpdateMedium(mediaSeq[m]);
01194                 );
01195             }
01196         }
01197         
01198         
01199         //
01200         // stop LA for this library.
01201         try {
01202             ipc_EXEC_m(
01203                 m_rm->StopLA(CORBA::string_dup(a_name));
01204             );
01205         }
01206         catch (ivd_Exception &e) {
01207             log_DBG_m(dbg_NORM, 
01208                     "MIF: Library Agent for this library can't be stopped." << e);
01209         }
01210 
01211 
01212         //
01213         // delete slots
01214         i_SlotSeq_t_var slotSeq;
01215         ipc_EXEC_m (
01216             slotSeq = m_rm->SelectAllSlots();
01217         );
01218 
01219         for (UInt32_t ct=0; ct<slotSeq->length(); ct++) {
01220 
01221             if (strcmp(slotSeq[ct].libraryName, a_name) == 0) {
01222                 log_DBG_m(dbg_NORM, "MIF: Removing slot " << slotSeq[ct].slotAddr <<
01223                         " from library " << a_name);
01224 
01225                 try {
01226                     ipc_EXEC_m(
01227                         m_rm->RemoveSlot(
01228                             CORBA::string_dup(slotSeq[ct].slotAddr),
01229                             CORBA::string_dup(a_name),
01230                             slotSeq[ct].slotType);
01231                     );
01232                 } catch (ivd_Error& e){
01233                     ostringstream msg;
01234                     msg << "Error while removing slot addr: " << 
01235                         slotSeq[ct].slotAddr << " type: " << slotSeq[ct].slotType << 
01236                         " for library" << a_name << endl << e;
01237                     log_ERR_m(msg.str());
01238                 }
01239             }
01240         }
01241         log_DBG_m(dbg_NORM, "MIF: All slots successfully removed.");
01242 
01243         //
01244         // remove library entry from RMDB
01245         try {
01246             ipc_EXEC_m(
01247                 m_rm->RemoveLibrary(CORBA::string_dup(a_name));
01248                 log_DBG_m(dbg_NORM, "MIF: Library removed from RMDB");
01249             );
01250         } catch (ivd_Error&e){
01251             ostringstream msg;
01252             msg << "Error while removing library: " << a_name << endl << e;
01253             log_ERR_m(msg.str());
01254         }
01255 
01256         //
01257         // remove named library subdir from configuration repository
01258         try {
01259             mif_CfgRep cfgHelp(mif_LIBRARY, a_name);
01260             cfgHelp.RemoveCfg();
01261             log_DBG_m(dbg_NORM, 
01262                 "MIF: Library configuration removed from CfgDB repository");
01263         
01264         } catch (ivd_Error&e){
01265             ostringstream msg;
01266             msg << "Error while removing cfg files for library: " << a_name << endl << e;
01267             log_ERR_m(msg.str());
01268         }
01269 
01270         ostringstream eventText;
01271         eventText << "Removed.";
01272         
01273         log_WriteEvent(eventText.str(), "LIBRARY", 0, a_name);
01274 
01275     }
01276     ipc_CATCH_IVD_THROW_CORBA_m
01277 
01278 } // i_ManagementInterface_i::RemoveLibrary()

Here is the call graph for this function:

char * i_ManagementInterface_i::UpdateLibrary ( const char *  a_userAtDomain,
const char *  a_name,
const i_DataBlock_t a_cfgFile,
i_Index_t a_newRevNo 
)

Definition at line 660 of file i_mif_library.cpp.

References cfg_RMLibrary::auditTime, cfg_RMLibrary::controlDevice, dbg_DETAIL, dbg_NORM, evt_WARNING, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), GetLibrary(), cfg_RMLibrary::host, ie_MIF_LA_PROBLEM, ie_PRECONDITION, ie_RMDB_NOTFOUND, ie_SCSI_OPEN, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, i_Slot_t::libraryName, cfg_RMLibrary::libType, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, cfg_RMLibrary::mailSlots, cfg_RMLibrary::mediaAccessTime, cfg_RMLibrary::mediaExchangeTime, cfg_RMLibrary::mediaFamily, MIF_CFG_LIBRARY, mif_LIBRARY, cfg_RMLibrary::name, mif_CfgRep::ParseToFile(), mif_CfgRep::ReplaceHosts(), ipc_Corba::ResolveLA(), rmdb_INIT_LIBRARY_STATUS, rmdb_LIBRARY_ERROR, rmdb_MAIL_SLOT_TYPE_ID, rmdb_REP_SLOT_TYPE_ID, i_Slot_t::slotAddr, cfg_RMLibrary::slotList, i_Slot_t::slotType, ss_UNKNOWN, and i_Slot_t::status.

00664                                            {
00665 
00666     log_FUNC_m(UpdateLibrary);
00667 
00668     try {
00669         //
00670         // check if library is configured.
00671         i_Library_t_var libI;
00672         try {
00673             ipc_EXEC_m(
00674                 libI = m_rm->SelectLibrary( CORBA::string_dup(a_name));
00675                 log_DBG_m(dbg_NORM, "MIF: Library is configured.");
00676             );
00677         }
00678         catch (ivd_Exception) {
00679             // TODO: RMDB could return specific error for not found
00680             throw ivd_Error(ie_RMDB_NOTFOUND, 
00681                             "Library not configured: " + string(a_name));
00682         }
00683         
00684         //
00685         // parse config buffer
00686         pf_File pFile;
00687         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_LIBRARY, a_userAtDomain);
00688         mif_CfgRep::ReplaceHosts(pFile);
00689         
00690         cfg_RMLibrary libraryCfg(pFile);
00691 
00692         // rename is not allowed yet
00693         if (libraryCfg.name != string(libI->libraryName)) {
00694             throw ivd_Error(ie_PRECONDITION, "Rename not allowed.");
00695         }
00696 
00697         if (libraryCfg.host != string(libI->host)) {
00698             throw ivd_Error(ie_PRECONDITION, "Changing host not allowed.");
00699         }
00700 
00701         // check if slots overlap
00702         for (UInt32_t k(0); k+1 < libraryCfg.slotList.size(); k++){
00703             for (UInt32_t l(k+1); l < libraryCfg.slotList.size(); l++){
00704                 if (libraryCfg.slotList[l].Val() == libraryCfg.slotList[k].Val())
00705                     throw ivd_Error(ie_PRECONDITION, "Overlapping slots.");
00706             }
00707         } 
00708 
00709         //
00710         // do not allow to change media family after the library is configured
00711         // (drives and slots/media may be already assigned)
00712         if (libI->mediaFamily != libraryCfg.mediaFamily) {
00713             throw ivd_Error(ie_PRECONDITION,
00714                             "Changing media family not allowed.");
00715         }
00716 
00717         if (libI->libraryType != libraryCfg.libType) {
00718             throw ivd_Error(ie_PRECONDITION,
00719                             "Changing library type not allowed.");
00720         }
00721 
00722         //
00723         // copy configuration data
00724         libI->libraryName     = CORBA::string_dup(libraryCfg.name.c_str());
00725         libI->capabilities    = 0;   // int <- vector<val_Element> ?! (libraryCfg.capabilities)
00726         libI->options         = 0;   // int <- vector<val_Element> ?! (libraryCfg.options) 
00727         libI->controlDevice   = CORBA::string_dup(libraryCfg.controlDevice.c_str());
00728         libI->host            = CORBA::string_dup(libraryCfg.host.c_str());
00729         
00730         libI->auditTime       = libraryCfg.auditTime;       
00731         libI->mediaAccessTime = libraryCfg.mediaAccessTime;
00732         libI->mediaXChgTime   = libraryCfg.mediaExchangeTime;
00733 
00734         log_DBG_m(dbg_NORM, "MIF: i_Library_t structure filled.");
00735 
00736         {
00737             //
00738             // add/remove repository slot RMDB entries for this library.
00739             mif_ResourceList_t repSlot_existingList;
00740             mif_ResourceList_t repSlot_newConfigList;
00741             mif_ResourceList_t repSlot_addedList;
00742             mif_ResourceList_t repSlot_removedList;
00743         
00744             mif_ResourceList_t mailSlot_existingList;
00745             mif_ResourceList_t mailSlot_newConfigList;
00746             mif_ResourceList_t mailSlot_addedList;
00747             mif_ResourceList_t mailSlot_removedList;
00748         
00749             // TODO: add similar lists for cleaning slots.
00750 
00751             i_SlotSeq_t_var slotSeq;
00752             ipc_EXEC_m(
00753                 slotSeq = m_rm->SelectAllSlots();
00754             );
00755 
00756             for (UInt32_t ct=0; ct<slotSeq->length(); ct++)
00757 
00758                 if (strcmp(slotSeq[ct].libraryName, libI->libraryName) == 0) {
00759 
00760                     if (slotSeq[ct].slotType == rmdb_REP_SLOT_TYPE_ID)
00761                         repSlot_existingList.insert(repSlot_existingList.end(), 
00762                                                     string(slotSeq[ct].slotAddr));
00763                     else if (slotSeq[ct].slotType == rmdb_MAIL_SLOT_TYPE_ID)
00764                         mailSlot_existingList.insert(mailSlot_existingList.end(), 
00765                                                     string(slotSeq[ct].slotAddr));
00766                     //
00767                     //    TODO: add similar vector for cleaning slots.
00768                     //                
00769                 }
00770 
00771             // make copies of new configuration slot lists.
00772             for (UInt32_t ct=0; ct<libraryCfg.slotList.size(); ct++)
00773                 repSlot_newConfigList.insert(repSlot_newConfigList.end(), 
00774                                             libraryCfg.slotList[ct].Val());
00775             for (UInt32_t ct=0; ct<libraryCfg.mailSlots.size(); ct++)
00776                 mailSlot_newConfigList.insert(mailSlot_newConfigList.end(),
00777                                             libraryCfg.mailSlots[ct].Val());
00778             // TODO: add similar copy for cleaning slots.
00779         
00780             log_DBG_m(dbg_NORM, "MIF: existing rep slots " << repSlot_existingList.size());
00781             log_DBG_m(dbg_NORM, "MIF: existing mail slots " << mailSlot_existingList.size());
00782             log_DBG_m(dbg_NORM, "MIF: new config rep slots " << repSlot_newConfigList.size());
00783             log_DBG_m(dbg_NORM, "MIF: new config mail slots " << mailSlot_newConfigList.size());
00784 
00785 
00786             // create both vectors for repository slots.
00787             if (  (repSlot_existingList.size() != 0)
00788                 &&(repSlot_newConfigList.size() != 0)) {
00789 
00790                 // determine removed repository slots.
00791                 for (UInt32_t ct1=0; ct1<repSlot_existingList.size(); ct1++) {
00792         
00793                     string slotAddr;
00794                     UInt32_t ct2 = 0;
00795                     bool found = false;
00796         
00797                     slotAddr = repSlot_existingList[ct1];
00798         
00799                     while (  (ct2 < repSlot_newConfigList.size())
00800                         &&(found != true)                  ) {
00801         
00802                         if (slotAddr == repSlot_newConfigList[ct2])
00803                             found = true;
00804 
00805                         ct2++;
00806                     }
00807         
00808                     if (!found)
00809                         repSlot_removedList.insert(repSlot_removedList.end(), 
00810                                                 repSlot_existingList[ct1]);
00811                 }
00812 
00813                 // determine added repository slots.
00814                 for (UInt32_t ct2=0; ct2<repSlot_newConfigList.size(); ct2++) {
00815         
00816                     string slotAddr;
00817                     UInt32_t ct1 = 0;
00818                     bool found = false;
00819         
00820                     slotAddr = repSlot_newConfigList[ct2];
00821         
00822                     while (  (ct1 < repSlot_existingList.size())
00823                         &&(found != true)                  ) {
00824         
00825                         if (slotAddr == repSlot_existingList[ct1])
00826                             found = true;
00827         
00828                         ct1++;
00829                     }
00830         
00831                     if (!found)
00832                         repSlot_addedList.insert(repSlot_addedList.end(), 
00833                                                 repSlot_newConfigList[ct2]);
00834                 }
00835             }
00836             else if (repSlot_existingList.size() == 0) {
00837         
00838                 // add all in new config.
00839                 repSlot_addedList = repSlot_newConfigList;
00840             }
00841             else if (repSlot_newConfigList.size() == 0) {
00842         
00843                 // remove all existing.
00844                 repSlot_removedList = repSlot_existingList;
00845             }
00846             else {
00847         
00848                 // do nothing (lists remain empty).
00849             }
00850             log_DBG_m(dbg_NORM, "MIF: vectors with added and removed repository slots generated.");
00851         
00852             // create both vectors for mail slots.
00853             if (  (mailSlot_existingList.size() != 0)
00854                 &&(mailSlot_newConfigList.size() != 0)) {
00855 
00856                 // determine removed mail slots.
00857                 for (UInt32_t ct1=0; ct1<mailSlot_existingList.size(); ct1++) {
00858         
00859                     string slotAddr;
00860                     UInt32_t ct2 = 0;
00861                     bool found = false;
00862         
00863                     slotAddr = mailSlot_existingList[ct1];
00864         
00865                     while (  (ct2 < mailSlot_newConfigList.size())
00866                         &&(found != true)                  ) {
00867         
00868                         if (slotAddr == mailSlot_newConfigList[ct2])
00869                             found = true;
00870 
00871                         ct2++;
00872                     }
00873         
00874                     if (!found)
00875                         mailSlot_removedList.insert(mailSlot_removedList.end(), 
00876                                                     mailSlot_existingList[ct1]);
00877                 }
00878 
00879                 // determine added mail slots.
00880                 for (UInt32_t ct2=0; ct2<mailSlot_newConfigList.size(); ct2++) {
00881         
00882                     string slotAddr;
00883                     UInt32_t ct1 = 0;
00884                     bool found = false;
00885         
00886                     slotAddr = mailSlot_newConfigList[ct2];
00887         
00888                     while (  (ct1 < mailSlot_existingList.size())
00889                         &&(found != true)                  ) {
00890         
00891                         if (slotAddr == mailSlot_existingList[ct1])
00892                             found = true;
00893         
00894                         ct1++;
00895                     }
00896         
00897                     if (!found)
00898                         mailSlot_addedList.insert(mailSlot_addedList.end(), 
00899                                                 mailSlot_newConfigList[ct2]);
00900                 }
00901             }
00902             else if (mailSlot_existingList.size() == 0) {
00903         
00904                 // add all in new config.
00905                 mailSlot_addedList = mailSlot_newConfigList;
00906             }
00907             else if (mailSlot_newConfigList.size() == 0) {
00908         
00909                 // remove all existing.
00910                 mailSlot_removedList = mailSlot_existingList;
00911             }
00912             else {
00913 
00914                 // do nothing (lists remain empty).
00915             }
00916             log_DBG_m(dbg_NORM, 
00917                 "MIF: vectors with added and removed mail slots generated.");
00918 
00919             
00920             log_DBG_m(dbg_NORM, "MIF: rep slots to add " << repSlot_addedList.size());
00921             log_DBG_m(dbg_NORM, "MIF: mail slots to add " << mailSlot_addedList.size());
00922             log_DBG_m(dbg_NORM, "MIF: rep slots to delete " << repSlot_removedList.size());
00923             log_DBG_m(dbg_NORM, "MIF: mail slots to delete " << mailSlot_removedList.size());
00924         
00925 
00926             //
00927             // generate sequence of media.
00928             i_MediumSeq_t_var mediaSeqI;
00929             ipc_EXEC_m(
00930                 mediaSeqI = m_rm->SelectAllMedia();
00931             );
00932 
00933             // check if repository slots can be deleted.
00934             for (UInt32_t ct=0; ct<repSlot_removedList.size(); ct++) {
00935                 for (UInt32_t ctm=0; ctm<mediaSeqI->length(); ctm++) {
00936 
00937                     if ((strcmp(mediaSeqI[ctm].slotAddr, 
00938                                 repSlot_removedList[ct].c_str()) == 0)
00939                         && (mediaSeqI[ctm].slotType == rmdb_REP_SLOT_TYPE_ID)) {
00940                         throw ivd_Error(ie_PRECONDITION, "Slot is in use.");
00941                     }
00942                 }
00943             }
00944 
00945             // check if mail slots can be deleted.
00946             for (UInt32_t ct=0; ct<mailSlot_removedList.size(); ct++) {
00947 
00948                 for (UInt32_t ctm=0; ctm<mediaSeqI->length(); ctm++) {
00949 
00950                     if ((strcmp(mediaSeqI[ctm].slotAddr, 
00951                                 mailSlot_removedList[ct].c_str()) == 0)
00952                         && (mediaSeqI[ctm].slotType == rmdb_MAIL_SLOT_TYPE_ID)) {
00953                         throw ivd_Error(ie_PRECONDITION, "Slot is in use.");
00954                     }
00955                 }
00956             }
00957             // TODO: add similar loop for checking cleaning slots.
00958 
00959             //
00960             // remove removed repository slots.
00961             for (UInt32_t ct=0; ct<repSlot_removedList.size(); ct++) {
00962                 ipc_EXEC_m(
00963                     m_rm->RemoveSlot(
00964                         CORBA::string_dup(repSlot_removedList[ct].c_str()),
00965                         CORBA::string_dup(libraryCfg.name.c_str()),
00966                         rmdb_REP_SLOT_TYPE_ID);
00967                 );
00968                 log_DBG_m(dbg_NORM,
00969                     "MIF: removed repository slot "
00970                     << repSlot_removedList[ct]
00971                     << " from library " << a_name << ".");
00972             }
00973 
00974             // remove removed mail slots.
00975             for (UInt32_t ct=0; ct<mailSlot_removedList.size(); ct++) {
00976                 ipc_EXEC_m(
00977                     m_rm->RemoveSlot(
00978                         CORBA::string_dup(mailSlot_removedList[ct].c_str()),
00979                         CORBA::string_dup(libraryCfg.name.c_str()),
00980                         rmdb_MAIL_SLOT_TYPE_ID);
00981                 );
00982                 log_DBG_m(dbg_NORM,
00983                     "MIF: removed mail slot "
00984                     << mailSlot_removedList[ct]
00985                     << " from library " << a_name << ".");
00986             }
00987             // TODO: add similar loop for removing cleaning slots.
00988 
00989             //
00990             // add added repository slots.
00991             for (UInt32_t ct=0; ct<repSlot_addedList.size(); ct++) {
00992                 i_Slot_t repSlotI;
00993 
00994                 repSlotI.libraryName = libI->libraryName;
00995                 repSlotI.slotAddr    = CORBA::string_dup(repSlot_addedList[ct].c_str());
00996                 repSlotI.slotType    = rmdb_REP_SLOT_TYPE_ID;
00997                 //repSlotI.slotKey   = generated!
00998                 
00999                 //slot status will be set to proper value by inventory
01000                 repSlotI.status      = ss_UNKNOWN;
01001 
01002                 ipc_EXEC_m(
01003                     m_rm->AddSlot(repSlotI);
01004                 );
01005                 log_DBG_m(dbg_NORM,
01006                     "MIF: added repository slot "
01007                     << repSlot_addedList[ct]
01008                     << " to library " << a_name << ".");
01009             }
01010 
01011             // add added mail slots.
01012             for (UInt32_t ct=0; ct<mailSlot_addedList.size(); ct++) {
01013                 i_Slot_t mailSlotI;
01014 
01015                 mailSlotI.libraryName = libI->libraryName;
01016                 mailSlotI.slotAddr    = CORBA::string_dup(mailSlot_addedList[ct].c_str());
01017                 mailSlotI.slotType    = rmdb_MAIL_SLOT_TYPE_ID;
01018                 //mailSlotI.slotKey   = generated!
01019                 //mailSlotI.status    = generated! (initialized to some value in rm_operator!)
01020 
01021                 ipc_EXEC_m(
01022                     m_rm->AddSlot(mailSlotI);
01023                 );
01024                 log_DBG_m(dbg_NORM,
01025                     "MIF: added mail slot "
01026                     << mailSlot_addedList[ct]
01027                     << " to library " << a_name << ".");
01028             }
01029             // TODO: add similar loop for adding cleaning slots.
01030             
01031             //
01032             // update library entry in RMDB
01033             ipc_EXEC_m(
01034                 m_rm->UpdateLibrary(libI);
01035                 log_DBG_m(dbg_NORM,
01036                     "MIF: library entry for library "
01037                     << libI->libraryName << " updated in RMDB.");
01038             );
01039 
01040             //
01041             // notify jobs in job list about changed resource.
01042             ipc_EXEC_m(
01043                 m_rm->UseNewResource();
01044             );
01045 
01046             mif_CfgRep cfg(mif_LIBRARY, libraryCfg.name);
01047             a_newRevNo = cfg.Upload(pFile);
01048             log_DBG_m(dbg_NORM,
01049                 "MIF: new library configuration revision added to CfgDB repository.");
01050         }
01051         
01052         if (libI->status == rmdb_INIT_LIBRARY_STATUS){
01053             try {                             
01054                 ipc_EXEC_m(
01055                         m_rm->ReconfigureLibrary(
01056                         CORBA::string_dup(a_name) );
01057                 );
01058             }
01059             catch (const ivd_Exception& ie) {
01060                 ostringstream eventText;
01061                 eventText << "Can't reconfigure library: " << ie.GetFriendly();
01062                 if (ie.GetError()== ie_SCSI_OPEN){
01063                     log_DBG_m(dbg_DETAIL, "SCSI device not correct, LA should be stopped, status set to ERROR");
01064                     m_rm->StopLA(a_name);
01065                     m_rm->LibraryStatusSet(a_name, rmdb_LIBRARY_ERROR);
01066                 }
01067                 log_WriteEvent(evt_WARNING, eventText.str(), "LIBRARY", 0, a_name);
01068             }
01069         }
01070         else{
01071             if (libI->status == rmdb_LIBRARY_ERROR){
01072                 i_Library_t_var lib = GetLibrary(a_name);
01073                 i_LibraryAgent_var la;
01074 
01075                 //Try to start LA
01076                 try {
01077                     log_DBG_m(dbg_DETAIL, "Starting LA for library " << a_name);
01078                     ipc_EXEC_m(
01079                         m_rm->StartLA(CORBA::string_dup(a_name));
01080                         CORBA::Object_var obj = 
01081                         ipc_Corba::ResolveLA(string(lib->host), a_name, true);
01082 
01083                         la = i_LibraryAgent::_narrow(obj);
01084                         if (la->_is_nil() || la->_non_existent()) {
01085                         //Set status of library to "ERROR" because LA is not running
01086                             UInt32_t status(rmdb_LIBRARY_ERROR);
01087                             m_rm->LibraryStatusSet(a_name, status);
01088                             throw ivd_Error(
01089                                 ie_MIF_LA_PROBLEM, "Library agent not accessible.");
01090                         }
01091                         else{
01092                             //Set library status to ONLINE, since LA is started
01093                             log_DBG_m(dbg_DETAIL, "Setting library: " << a_name << " status to ONLINE");
01094                             m_rm->LibraryStatusClear(a_name, libI->status);
01095                             UInt32_t status(rmdb_INIT_LIBRARY_STATUS);
01096                             m_rm->LibraryStatusSet(a_name, status);
01097                             log_DBG_m(dbg_DETAIL, "Status for library: " << a_name << " set to: " << libI->status);
01098                         }
01099                     );
01100                 }
01101                 catch(ivd_Exception){
01102                     log_DBG_m(dbg_DETAIL, 
01103                         "LA for library " << a_name << " not accessible.");
01104                 }
01105             }
01106             else{
01107                 //To start LA enable library using ivdlibrary --enable libName
01108                 log_DBG_m(dbg_DETAIL, "Run ivdlibrary --enable libName to start LA");
01109                 ostringstream eventText;
01110                 eventText
01111                     << "Enable library to start LA";
01112                 log_WriteEvent(eventText.str());
01113             }
01114         }
01115         
01116         ostringstream eventText;
01117         eventText
01118             << "Updated (rev. " << a_newRevNo << ").";
01119 
01120         log_WriteEvent(eventText.str(), "LIBRARY", 0, a_name);
01121         return CORBA::string_dup(a_name);
01122     }
01123     ipc_CATCH_IVD_THROW_CORBA_m
01124 } // i_ManagementInterface_i::UpdateLibrary()

Here is the call graph for this function:

i_DataBlock_t * i_ManagementInterface_i::ShowLibrary ( const char *  a_name,
i_Index_t  a_revNo 
)

Definition at line 1127 of file i_mif_library.cpp.

References dbg_NORM, mif_CfgRep::GetCfg(), ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_ReadFromFile(), ivd_Error, log_DBG_m, log_FUNC_m, m_rm, and mif_LIBRARY.

01127                                                                                          {
01128     
01129     log_FUNC_m(ShowLibrary);
01130     try {
01131         //
01132         // check if library is configured.
01133         i_Library_t_var libI;
01134         try {
01135             ipc_EXEC_m(
01136                 libI = m_rm->SelectLibrary( CORBA::string_dup(a_name));
01137             log_DBG_m(dbg_NORM, "MIF: Library is configured.");
01138             );
01139         }
01140         catch (ivd_Exception) {
01141             // TODO: RMDB could return specific error for not found
01142             throw ivd_Error(ie_RMDB_NOTFOUND, 
01143                 "Library not configured: " + string(a_name));
01144         }
01145         mif_CfgRep cfgRev(mif_LIBRARY, a_name);
01146         cmn_File cfgFile = cfgRev.GetCfg(a_revNo);
01147         return ipc_ReadFromFile(cfgFile);
01148     } ipc_CATCH_IVD_THROW_CORBA_m
01149 
01150 } // i_ManagementInterface_i::ShowLibrary()

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::ShowLibraryRevs ( const char *  a_name  ) 

Definition at line 1329 of file i_mif_library.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, mif_CfgRep::LastRev(), log_FUNC_m, and mif_LIBRARY.

01329                                                                      {
01330     log_FUNC_m(ShowLibraryRevs);
01331 
01332     try {
01333 
01334         mif_CfgRep cfgObj(mif_LIBRARY, a_name);
01335         return cfgObj.LastRev();
01336     }
01337     ipc_CATCH_IVD_THROW_CORBA_m
01338 }

Here is the call graph for this function:

void i_ManagementInterface_i::UpdateLibraryInventory ( const char *  a_name,
CORBA::Boolean  a_physicalInv 
)

void i_ManagementInterface_i::ListLibraries ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 210 of file i_mif_library.cpp.

References i_Library_t::auditTime, bf_LibAuditTime, bf_LibCapabilities, bf_LibControlDevice, bf_LibFirmwareRev, bf_LibHost, bf_LibKey, bf_LibLoadNr, bf_LibMediaAccessTime, bf_LibMediaFamily, bf_LibMediaXChgTime, bf_LibName, bf_LibOptions, bf_LibProductID, bf_LibraryToText(), bf_LibScsiID, bf_LibSerialNo, bf_LibStatus, bf_LibType, bf_LibUnloadNr, bf_LibVendorID, cmn_Time::c_Time2YMDhms(), i_Library_t::capabilities, i_Library_t::controlDevice, i_Library_t::firmwareRev, g_libraryTable, i_Library_t::host, ie_MIF_LA_PROBLEM, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), ivd_Error, i_Library_t::libraryKey, i_Library_t::libraryName, i_Library_t::libraryType, i_Library_t::loadNr, log_FUNC_m, ls_ERROR, ls_ONLINE, m_rm, i_Library_t::mediaAccessTime, i_Library_t::mediaFamily, i_Library_t::mediaXChgTime, i_Library_t::options, i_Library_t::productID, ipc_Corba::ResolveLA(), rmdb_INIT_LIBRARY_STATUS, i_Library_t::scsiID, i_Library_t::serialNo, i_Library_t::status, uires_LIBRARYSTATUS, uires_LIBRARYTYPE, uires_MEDIAFAMILYTYPE, i_Library_t::unloadNr, cmn_BitFlag_t::val, and i_Library_t::vendorID.

00212                                                     {
00213     log_FUNC_m(ListLibraries);
00214 
00215     ui_BitFlag flags(a_filter);
00216 
00217     try {
00218         i_LibrarySeq_t_var librarySeq;
00219         ipc_EXEC_m(librarySeq = m_rm->SelectAllLibraries(););
00220         
00221         ui_ResultPacker result;
00222 
00223         if (librarySeq->length() > 0) {
00224             result.NewRow(true);
00225 
00226             UInt32_t i = 0;
00227             while ( g_libraryTable[i].val != -1) { 
00228                 if (flags.IsFlagSet(g_libraryTable[i].val)) {
00229                     result.Insert(bf_LibraryToText(
00230                          static_cast<bf_Library_e>(g_libraryTable[i].val)
00231                                                   ));
00232                 }
00233                 i++;
00234             }
00235         }
00236 
00237         for (UInt32_t i = 0; i < librarySeq->length(); i++) {
00238             i_Library_t & lib = librarySeq[i];
00239             
00240             result.NewRow();
00241             
00242             if (flags.IsFlagSet(bf_LibName)) {
00243                 result.Insert(lib.libraryName);
00244             }
00245             
00246             if (flags.IsFlagSet(bf_LibMediaFamily)) {
00247                 result.Insert(uires_MEDIAFAMILYTYPE, lib.mediaFamily);
00248             }
00249 
00250             if (flags.IsFlagSet(bf_LibType)) {
00251                 result.Insert(uires_LIBRARYTYPE, lib.libraryType);
00252             }
00253 
00254             if (flags.IsFlagSet(bf_LibHost)) {
00255                 result.Insert(lib.host);
00256             }
00257 
00258             if (flags.IsFlagSet(bf_LibControlDevice)) {
00259                 result.Insert(lib.controlDevice);
00260             }
00261 
00262             if (flags.IsFlagSet(bf_LibStatus)) {
00263                 if (lib.status & rmdb_INIT_LIBRARY_STATUS) {
00264                     try {
00265                         i_LibraryAgent_var la;
00266                         ipc_EXEC_m(
00267                             CORBA::Object_var obj = 
00268                             ipc_Corba::ResolveLA(string(lib.host),
00269                                                     string(lib.libraryName),
00270                                                     false);
00271                             la = i_LibraryAgent::_narrow(obj);
00272                         );
00273                         if (la->_is_nil() || la->_non_existent()) {
00274                             throw ivd_Error(ie_MIF_LA_PROBLEM);
00275                         }
00276                         result.Insert(uires_LIBRARYSTATUS, ls_ONLINE);
00277                     } 
00278                     catch(ivd_Exception) {
00279                         result.Insert(uires_LIBRARYSTATUS, ls_ERROR);
00280                     }
00281                 }
00282                 else {
00283                     result.Insert(uires_LIBRARYSTATUS, lib.status);
00284                 }
00285             }
00286 
00287             if (flags.IsFlagSet(bf_LibProductID)) {
00288                 result.Insert(lib.productID);
00289             }
00290 
00291             if (flags.IsFlagSet(bf_LibSerialNo)) {
00292                 result.Insert(lib.serialNo);
00293             }
00294 
00295             if (flags.IsFlagSet(bf_LibVendorID)) {
00296                 result.Insert(lib.vendorID);
00297             }
00298 
00299             if (flags.IsFlagSet(bf_LibFirmwareRev)) {
00300                 result.Insert(lib.firmwareRev);
00301             }
00302 
00303             if (flags.IsFlagSet(bf_LibScsiID)) {
00304                 result.Insert(lib.scsiID);
00305             }
00306 
00307             if (flags.IsFlagSet(bf_LibAuditTime)) {
00308                 cmn_Time timeInfo(lib.auditTime);
00309 
00310                 result.Insert(timeInfo.c_Time2YMDhms());
00311             }
00312 
00313             if (flags.IsFlagSet(bf_LibMediaAccessTime)) {
00314                 cmn_Time timeInfo(lib.mediaAccessTime);
00315 
00316                 result.Insert(timeInfo.c_Time2YMDhms());
00317             }
00318 
00319             if (flags.IsFlagSet(bf_LibMediaXChgTime)) {
00320                 cmn_Time timeInfo(lib.mediaXChgTime);
00321 
00322                 result.Insert(timeInfo.c_Time2YMDhms());
00323             }
00324 
00325             if (flags.IsFlagSet(bf_LibLoadNr)) {
00326                 result.Insert(lib.loadNr);
00327             }
00328 
00329             if (flags.IsFlagSet(bf_LibUnloadNr)) {
00330                 result.Insert(lib.unloadNr);
00331             }
00332 
00333             if (flags.IsFlagSet(bf_LibCapabilities)) {
00334                 result.Insert(lib.capabilities);
00335             }
00336 
00337             if (flags.IsFlagSet(bf_LibOptions)) {
00338                 result.Insert(lib.options);
00339             }
00340 
00341             if (flags.IsFlagSet(bf_LibKey)) {
00342                 result.Insert(lib.libraryKey);
00343             }
00344 
00345         } //for
00346         result.SendResults(a_uims);
00347     } ipc_CATCH_IVD_THROW_CORBA_m
00348 }

Here is the call graph for this function:

void i_ManagementInterface_i::ShowLibraryInventory ( const char *  a_name,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 39 of file i_mif_library.cpp.

References i_Medium_t::barcode, dbg_DETAIL, dbg_LOW, dbg_NORM, i_Medium_t::driveName, i_Drive_t::driveName, ivd_BaseException::GetError(), GetMediumBySlot(), ie_RMDB_NOTFOUND, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_rm, MakeInventoryHeader(), ui_ResultPacker::NewRow(), rmdb_SLOT_FREE, rmdb_SLOT_IN_USE, ui_ResultPacker::SendResults(), i_Slot_t::slotAddr, i_Slot_t::slotKey, i_Slot_t::slotType, ss_FREE, ss_FULL, ss_RESERVED, ss_UNKNOWN, i_Slot_t::status, i_Drive_t::status, uires_DRIVESTATUS, uires_SLOTSTATUS, and uires_SLOTTYPE.

00041                                                                        {
00042 
00043     log_FUNC_m(ShowLibraryInventory);
00044     try {
00045 
00046         //select library
00047         i_Library_t_var lib;
00048         try {
00049             ipc_EXEC_m(    
00050                 lib = m_rm->SelectLibrary(CORBA::string_dup(a_name));
00051                 log_DBG_m(dbg_NORM, "MIF: Library is configured.");       
00052             );
00053         } catch (ivd_Exception &e) {
00054             log_DBG_m(dbg_NORM, e);
00055             if (e.GetError() == ie_RMDB_NOTFOUND) {
00056                 ostringstream msg;
00057                 msg << "Library does not exist. Show Inventory failed";
00058                 log_DBG_m(dbg_LOW,msg.str());
00059                 a_uims->DisplayError(msg.str().c_str());
00060                 return;            
00061             } else 
00062                 throw;
00063         }
00064         
00065     
00066         //select all drives
00067         i_DriveSeq_t_var driveSeq;
00068 
00069         ipc_EXEC_m(driveSeq = m_rm->SelectAllDrives(););
00070     
00071         bool header(false);
00072 
00073         ui_ResultPacker uires;
00074     
00075         for (UInt32_t i(0); i < driveSeq->length(); i++) {
00076 
00077             if (strcmp(driveSeq[i].libraryName, a_name) == 0) {
00078                 i_Drive_t& drv = driveSeq[i];
00079 
00080                 if (!header) {
00081                     MakeInventoryHeader(uires);
00082                     header = true;
00083                 }
00084                 uires.NewRow();
00085                 uires.Insert(drv.driveName);
00086                 uires.Insert("drive");
00087                 uires.Insert(uires_DRIVESTATUS, drv.status);
00088 
00089                 i_Medium_t_var med;
00090                 try {
00091                 
00092                     ipc_EXEC_m (
00093                         med = m_rm->SelectMediumByDrive(
00094                                         CORBA::string_dup(drv.driveName));
00095                     );
00096                     uires.Insert(med->barcode);
00097                 }
00098                 catch (ivd_Error) {
00099                     uires.Insert("<empty>");
00100                 }
00101             } //if
00102         } //for all drives
00103 
00104     
00105         //
00106         // list slots.
00107         i_SlotSeq_t_var slotSeq;
00108         ipc_EXEC_m(slotSeq = m_rm->SelectAllSlots();)
00109 
00110         i_MediumSeq_t_var medSeq;
00111         ipc_EXEC_m(medSeq = m_rm->SelectAllMedia();)
00112 
00113 
00114         log_DBG_m(dbg_NORM, "Slots found: " << slotSeq->length());
00115 
00116         for (UInt32_t i(0); i < slotSeq->length(); i++) {
00117 
00118             if (strcmp(slotSeq[i].libraryName, a_name) == 0) {
00119         
00120                 log_DBG_m(dbg_DETAIL, "MIF: Found match for slot");
00121                 i_Slot_t& slot = slotSeq[i];
00122 
00123                 if (!header) {
00124                     MakeInventoryHeader(uires);
00125                     header = true;
00126                 }
00127                 uires.NewRow();
00128                 //name
00129                 uires.Insert(slot.slotAddr);
00130 
00131                 //type            
00132                 uires.Insert(uires_SLOTTYPE, slot.slotType);
00133 
00134                 //status
00135                 if (slot.status & rmdb_SLOT_IN_USE) {
00136                     //check for medium
00137                     try {
00138                         i_Medium_t& med = GetMediumBySlot(slot, medSeq);
00139                         if (strlen(med.driveName) > 0){
00140                             //medium is in drive
00141                             uires.Insert(uires_SLOTSTATUS, ss_RESERVED);
00142                             uires.Insert(med.barcode);
00143                         } 
00144                         else {
00145                             //medium is in slot
00146                             uires.Insert(uires_SLOTSTATUS, ss_FULL);
00147                             uires.Insert(med.barcode);
00148                         }
00149                     }
00150                     catch (ivd_Error &e){
00151                         log_DBG_m(dbg_NORM, e);
00152                         uires.Insert(uires_SLOTSTATUS, ss_FULL);
00153                         uires.Insert("<unreadable>");
00154                     } 
00155                 }
00156                 else if (slot.status == rmdb_SLOT_FREE) {
00157                     uires.Insert(uires_SLOTSTATUS, ss_FREE);
00158                     uires.Insert("<empty>");
00159                 }
00160                 else {
00161                     log_DBG_m(   dbg_LOW, "Slot (key:" << slot.slotKey 
00162                               << ") status in RMDB is unknown (" 
00163                               << slot.status << ").");
00164                     uires.Insert(uires_SLOTSTATUS, ss_UNKNOWN);
00165                     uires.Insert("<unreadable>");
00166                 }
00167             
00168             }//if
00169         } //for all slots
00170         uires.SendResults(a_uims);
00171     } 
00172     ipc_CATCH_IVD_THROW_CORBA_m
00173 }

Here is the call graph for this function:

void i_ManagementInterface_i::EnableLibrary ( const char *  a_name,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 351 of file i_mif_library.cpp.

References dbg_DETAIL, dbg_LOW, dbg_NORM, ivd_BaseException::GetError(), GetLibrary(), ie_MIF_LA_PROBLEM, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, ipc_Corba::ResolveLA(), rmdb_LIBRARY_DISABLED, and rmdb_LIBRARY_ERROR.

00353                                   {
00354     
00355     log_FUNC_m(EnableLibrary);
00356     
00357     UInt32_t status(0);
00358     status = rmdb_LIBRARY_ERROR | rmdb_LIBRARY_DISABLED;
00359     
00360     try {
00361         // clear disabled and error flags
00362         ostringstream msg;
00363         try {
00364             ipc_EXEC_m(
00365                 m_rm->LibraryStatusClear(a_name, status);
00366             );
00367         } catch (ivd_Exception &e) {
00368             log_DBG_m(dbg_NORM, e);
00369             if (e.GetError() == ie_RMDB_NOTFOUND) {
00370                 msg << "Library does not exist. Enable failed";
00371                 log_DBG_m(dbg_LOW,msg.str());
00372                 a_uims->DisplayError(msg.str().c_str());
00373                 return;            
00374             } else 
00375                 throw;
00376         }
00377         //
00378         // check whether LA is started - if not try to start it
00379         try {
00380             i_Library_t_var lib = GetLibrary(a_name);
00381             try {
00382                 ipc_EXEC_m(
00383                     CORBA::Object_var obj = 
00384                         ipc_Corba::ResolveLA(string(lib->host), a_name, false);
00385                 );
00386             } 
00387             catch(ivd_Exception) {
00388                 log_DBG_m(dbg_DETAIL, 
00389                           "LA for library " << a_name << " not accessible.");
00390                 try {
00391                     log_DBG_m(dbg_DETAIL, "Starting LA for library " << a_name);
00392                     ipc_EXEC_m(
00393                         m_rm->StartLA(CORBA::string_dup(a_name));
00394                     );
00395                     ipc_EXEC_m(
00396                         CORBA::Object_var obj = 
00397                         ipc_Corba::ResolveLA(string(lib->host), a_name, true);
00398                     );
00399                 }
00400                 catch(ivd_Exception) {
00401                     throw ivd_Error(ie_MIF_LA_PROBLEM, 
00402                         "LA for library " + string(a_name) + " not started.");
00403                 }
00404             }
00405         }
00406         catch(ivd_Exception) {
00407             m_rm->LibraryStatusSet(a_name, rmdb_LIBRARY_ERROR);
00408             throw ivd_Error(ie_MIF_LA_PROBLEM, "Library not enabled.");
00409         }
00410         
00411         msg << "Library enabled." ;
00412         log_WriteEvent(msg.str(), "LIBRARY", 0, string(a_name));
00413         a_uims->DisplayMessage(msg.str().c_str());
00414     }
00415     ipc_CATCH_IVD_THROW_CORBA_m
00416 }

Here is the call graph for this function:

void i_ManagementInterface_i::DisableLibrary ( const char *  a_mame,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 419 of file i_mif_library.cpp.

References dbg_LOW, dbg_NORM, ivd_BaseException::GetError(), ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, and rmdb_LIBRARY_DISABLED.

00421                                   {
00422     
00423     log_FUNC_m(DisableLibrary);
00424     
00425 
00426     UInt32_t status(rmdb_LIBRARY_DISABLED);
00427     try {
00428         // set disabled flag
00429         ostringstream msg;
00430         try {
00431             ipc_EXEC_m(
00432                 m_rm->LibraryStatusSet(a_name, status);
00433             );
00434         } catch (ivd_Exception &e) {
00435             log_DBG_m(dbg_NORM, e);
00436             if (e.GetError() == ie_RMDB_NOTFOUND) {
00437                 msg << "Library does not exist. Enable failed";
00438                 log_DBG_m(dbg_LOW,msg.str());
00439                 a_uims->DisplayError(msg.str().c_str());
00440                 return;            
00441             } else 
00442                 throw;
00443         }
00444         msg << "Library disabled." ;
00445         log_WriteEvent(msg.str(), "LIBRARY", 0, string(a_name));
00446         a_uims->DisplayMessage(msg.str().c_str());
00447     }
00448     ipc_CATCH_IVD_THROW_CORBA_m
00449     
00450     //stop LA for this library
00451     try {
00452         ipc_EXEC_m(
00453             m_rm->StopLA(CORBA::string_dup(a_name));
00454         );
00455     }
00456     catch (ivd_Exception &e) {
00457         log_DBG_m(dbg_NORM, 
00458             "MIF: Library Agent for this library can't be stopped." << e);
00459     }
00460 }

Here is the call graph for this function:

i_Library_t * i_ManagementInterface_i::GetLibrary ( const char *  a_name  ) 

Definition at line 463 of file i_mif_library.cpp.

References log_FUNC_A_m, and m_rm.

Referenced by EnableLibrary(), and UpdateLibrary().

00463                                                                   {
00464     log_FUNC_A_m(GetLibrary,"a_name:" << a_name);
00465     return m_rm->SelectLibrary(a_name);
00466 }

Here is the caller graph for this function:

void i_ManagementInterface_i::ListSlots ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 33 of file i_mif_slot.cpp.

References bf_SlotToText(), bf_SltAddr, bf_SltKey, bf_SltLibName, bf_SltStatus, bf_SltType, g_slotTable, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), i_Slot_t::libraryName, log_FUNC_m, m_rm, ui_ResultPacker::NewRow(), ui_ResultPacker::SendResults(), i_Slot_t::slotAddr, i_Slot_t::slotKey, i_Slot_t::slotType, i_Slot_t::status, uires_SLOTSTATUS, uires_SLOTTYPE, and cmn_BitFlag_t::val.

00033                                                                                         {
00034     log_FUNC_m(ListSlots);
00035     ui_BitFlag flags(a_filter);
00036 
00037     ui_ResultPacker result;
00038 
00039     try {
00040         result.NewRow(true);
00041 
00042         i_SlotSeq_t_var slotSeq;
00043         ipc_EXEC_m(slotSeq = m_rm->SelectAllSlots(););
00044 
00045         if (slotSeq->length() == 0)
00046             return;
00047 
00048         UInt32_t i = 0;
00049         while ( g_slotTable[i].val != -1) { 
00050             if (flags.IsFlagSet(g_slotTable[i].val)) {
00051                 result.Insert(
00052                     bf_SlotToText(static_cast<bf_Slot_e>(g_slotTable[i].val)));
00053             }
00054             i++;
00055         }
00056 
00057         for (UInt32_t i = 0; i < slotSeq->length(); i++) {
00058             i_Slot_t & slot = slotSeq[i];
00059 
00060             result.NewRow();
00061 
00062             if (flags.IsFlagSet(bf_SltKey)) {
00063                 result.Insert(slot.slotKey);
00064             }
00065 
00066             if (flags.IsFlagSet(bf_SltLibName)) {
00067                 result.Insert(slot.libraryName);
00068             }
00069 
00070             if (flags.IsFlagSet(bf_SltAddr)) {
00071                 result.Insert(slot.slotAddr);
00072             }
00073 
00074             if (flags.IsFlagSet(bf_SltType)) {
00075                 result.Insert(uires_SLOTTYPE, slot.slotType);
00076             }
00077 
00078             if (flags.IsFlagSet(bf_SltStatus)) {
00079                 result.Insert(uires_SLOTSTATUS, slot.status);
00080             }
00081 
00082         } //for
00083         result.SendResults(a_uims);
00084     } ipc_CATCH_IVD_THROW_CORBA_m
00085 }

Here is the call graph for this function:

i_Slot_t * i_ManagementInterface_i::GetSlot ( const char *  a_libraryName,
const char *  a_slotAddr,
CORBA::Long  a_type 
)

Definition at line 87 of file i_mif_slot.cpp.

References log_FUNC_A_m, and m_rm.

00089                                                              {
00090     log_FUNC_A_m(GetSlot,   "a_libraryName:" << a_libraryName <<
00091                             " a_slotAddr:" << a_slotAddr <<
00092                             " a_type:" << a_type);
00093     
00094     return m_rm->SelectSlot(a_slotAddr, a_libraryName, a_type);
00095 }

char * i_ManagementInterface_i::AddDrive ( const char *  a_userAtDomain,
const i_DataBlock_t a_cfgFile 
)

Definition at line 283 of file i_mif_drive.cpp.

References cfg_RMDrive::aveSeekTime, i_Drive_t::aveSeekTime, i_Drive_t::capabilities, cfg_RMDrive::capabilities, i_Drive_t::cleanNr, cmn_Num2Str(), i_DriveHost_t::controlDevice, cfg_RMDrive::dataThroughput, i_Drive_t::dataThroughput, dbg_DETAIL, dbg_NORM, cfg_RMDrive::driveIndex, i_Drive_t::driveIndex, i_DriveHost_t::driveName, i_Drive_t::driveName, i_Drive_t::firmwareRev, ivd_BaseException::GetError(), i_DriveHost_t::host, cfg_RMDrive::hosts, ie_PRECONDITION, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, ivd_Error, i_Drive_t::lastClean, cfg_RMDrive::library, i_Drive_t::libraryName, cfg_RMDrive::loadTime, i_Drive_t::loadTime, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_rm, i_Drive_t::mediaFamily, cfg_RMDrive::mediaFamily, MIF_CFG_DRIVE, mif_DRIVE, cfg_RMDrive::name, i_Drive_t::options, mif_CfgRep::ParseToFile(), mif_CfgRep::ReplaceHosts(), ipc_Corba::ResolveLA(), i_Drive_t::rewindTime, i_Drive_t::scsiID, i_Drive_t::status, cfg_RMDrive::unLoadTime, i_Drive_t::unloadTime, and i_Drive_t::usageCount.

00285                                                                     {
00286     
00287     log_FUNC_m(AddDrive);
00288     try {
00289         pf_File pFile;
00290         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_DRIVE, a_userAtDomain);
00291         mif_CfgRep::ReplaceHosts(pFile);
00292 
00293         cfg_RMDrive driveCfg(pFile);
00294 
00295         //
00296         // Check if drive's mediaFamily matches library
00297         if (!driveCfg.library.empty()) {
00298             i_Library_t_var lib;
00299             try {
00300                 ipc_EXEC_m(
00301                     lib = m_rm->SelectLibrary(
00302                                         CORBA::string_dup(driveCfg.library.c_str()));
00303                     log_DBG_m(dbg_NORM, "MIF: Library is configured.");       
00304                 );
00305             
00306                 if (lib->mediaFamily != driveCfg.mediaFamily) {
00307                     throw ivd_Error(ie_PRECONDITION,
00308                         "Medium family of drive does not match library.");
00309                 }
00310             } 
00311             catch (ivd_Error& e) {
00312                 if (e.GetError() == ie_RMDB_NOTFOUND) {
00313                     throw ivd_Error(ie_RMDB_NOTFOUND, 
00314                         "Library not configured: " + driveCfg.library);
00315                 }
00316                 else {
00317                     throw;
00318                 }
00319             }
00320         }
00321 
00322         //
00323         // copy configuration data
00324         i_Drive_t driveI;
00325         driveI.aveSeekTime      = driveCfg.aveSeekTime;
00326 
00327         UInt32_t capBitFlags(0);
00328         for (UInt32_t i(0); i < driveCfg.capabilities.size(); i++) {
00329             capBitFlags = capBitFlags | driveCfg.capabilities[i].Val();
00330             log_DBG_m(dbg_DETAIL,"capBitFlags = " << hex << capBitFlags);
00331         }
00332 
00333         driveI.capabilities     = capBitFlags;
00334         driveI.cleanNr          = 0;    // new drive.
00335         driveI.dataThroughput   = driveCfg.dataThroughput;
00336         driveI.driveIndex       = CORBA::string_dup(cmn_Num2Str(driveCfg.driveIndex).c_str()); // string[64] <- int ?! (driveCfg.driveIndex)
00337         driveI.driveName        = CORBA::string_dup(driveCfg.name.c_str());                    // string[50] <- string ?!
00338         driveI.lastClean        = 0;    // new drive. time_t(0)
00339         driveI.loadTime         = driveCfg.loadTime;
00340         driveI.mediaFamily      = driveCfg.mediaFamily;
00341         driveI.options          = 0; 
00342         driveI.rewindTime       = 0;
00343         driveI.aveSeekTime      = 0;
00344         driveI.status           = 0;    // initial status.
00345         driveI.unloadTime       = driveCfg.unLoadTime;
00346         driveI.usageCount       = 0;    // new drive. time_t(0)
00347         driveI.libraryName      = CORBA::string_dup(driveCfg.library.c_str());
00348         driveI.firmwareRev      = CORBA::string_dup(ipc_nilStr);
00349         driveI.scsiID           = CORBA::string_dup(ipc_nilStr);
00350         //
00351         // check if drive is configured.
00352         try {
00353             i_Drive_t_var tmp;
00354             ipc_EXEC_m(tmp = m_rm->SelectDrive(driveI.driveName));;
00355             log_DBG_m(dbg_NORM, "MIF: Drive is configured.");       
00356             
00357             throw ivd_Error(ie_PRECONDITION, 
00358                 "Drive already configured: " + string(driveI.driveName));
00359             
00360         }
00361         catch (ivd_Exception &e) {
00362             log_DBG_m(dbg_NORM, e);
00363             if (e.GetError() == ie_RMDB_NOTFOUND) {
00364                 // continue
00365             }
00366             else {
00367                 throw;
00368             }
00369         }
00370    
00371         //
00372         // add drive entry to RMDB.
00373         ipc_EXEC_m(
00374             m_rm->AddDrive(driveI);
00375             log_DBG_m(dbg_NORM, "MIF: Drive " 
00376                                 << driveCfg.name << " added into RMDB" << endl);
00377         );
00378 
00379         //
00380         // add this drive control device entries to RMDB.
00381         for (UInt32_t ct=0; ct<driveCfg.hosts.size(); ct++) {
00382             {
00383                 i_DriveHost_t driveHostI;
00384 
00385                 driveHostI.host          = CORBA::string_dup(driveCfg.hosts[ct].name.c_str());
00386                 driveHostI.driveName     = CORBA::string_dup(driveCfg.name.c_str());
00387                 driveHostI.controlDevice = CORBA::string_dup(driveCfg.hosts[ct].controlDevice.c_str());
00388 
00389                 ipc_EXEC_m(
00390                     m_rm->AddDriveHost(driveHostI);
00391                 );
00392             }
00393         }
00394 
00395         // Call LA->Reconfigure
00396         try {
00397             ipc_EXEC_m(
00398                 i_Library_t_var lib = m_rm->SelectLibrary(driveI.libraryName);
00399 
00400                 CORBA::Object_var objLA =
00401                     ipc_Corba::ResolveLA(string(lib->host), 
00402                 string(driveI.libraryName));
00403                 i_LibraryAgent_var iLA = i_LibraryAgent::_narrow(objLA);
00404 
00405                 iLA->Reconfigure(lib);
00406             );
00407         }
00408         catch (ivd_Exception &e) {
00409             log_ERR_m("Reconfiguring Library failed." << endl << e);
00410         }
00411 
00412         //
00413         // notify jobs in job list about new resource
00414         ipc_EXEC_m(
00415             m_rm->UseNewResource();
00416         );
00417 
00418         mif_CfgRep cfg(mif_DRIVE, driveCfg.name);
00419         cfg.Upload(pFile);
00420 
00421         log_DBG_m(dbg_NORM, 
00422             "MIF: drive configuration added to CfgDB repository." << endl);
00423 
00424         ostringstream eventText;
00425         eventText << "Added new.";
00426 
00427         log_WriteEvent(eventText.str(), "DRIVE", 0, driveCfg.name);
00428         return CORBA::string_dup(driveCfg.name.c_str());
00429         
00430     }
00431     ipc_CATCH_IVD_THROW_CORBA_m
00432 } // i_ManagementInterface_i::AddDrive()

Here is the call graph for this function:

void i_ManagementInterface_i::RemoveDrive ( const char *  a_name  ) 

Definition at line 750 of file i_mif_drive.cpp.

References dbg_LOW, dbg_NORM, ie_RMDB_ERROR, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_rm, mif_DRIVE, ipc_Corba::ResolveLA(), and rmdb_DRIVE_IN_USE.

00750                                                             {
00751     log_FUNC_m(RemoveDrive);
00752 
00753     try {
00754 
00755         //
00756         // check if drive is configured.
00757         i_Drive_t_var d;
00758         try {
00759             ipc_EXEC_m(        
00760                 d = m_rm->SelectDrive(CORBA::string_dup(a_name));
00761                 log_DBG_m(dbg_NORM, "MIF: Drive is configured.");
00762                 if (d->status & rmdb_DRIVE_IN_USE)
00763                     throw ivd_Error(ie_RMDB_ERROR, "Drive is in use. Can not remove.");
00764             );
00765         }
00766         catch (ivd_Exception) {
00767             // TODO: RMDB could return specific error for not found
00768             throw ivd_Error(ie_RMDB_NOTFOUND,
00769                             "Drive not configured: " + string(a_name));
00770         }
00771         
00772         // check if medium is in drive
00773         i_Medium_t_var med;
00774         bool driveFull(false);
00775         try {
00776             ipc_EXEC_m(
00777                 med = m_rm->SelectMediumByDrive(CORBA::string_dup(a_name) )
00778             );
00779             driveFull = true;
00780         } 
00781         catch (ivd_Exception) {
00782             log_DBG_m(dbg_NORM, "No medium in drive");
00783         }
00784 
00785         //
00786         // remove drive hosts that belong to this drive.
00787         i_DriveHostSeq_t_var driveHostSeq;
00788         ipc_EXEC_m(
00789             driveHostSeq = m_rm->SelectAllDriveHosts();
00790         );
00791 
00792         string host;
00793         if (driveHostSeq->length() > 0) {
00794             host = driveHostSeq[0].host;
00795         }
00796         else {
00797             log_ERR_m("Drive with no host defined");
00798             driveFull = false;
00799         }
00800 
00801         if (driveFull) {
00802             try {
00803                 ipc_EXEC_m(
00804 
00805                     // unload medium
00806                     CORBA::Object_var objLA =
00807                         ipc_Corba::ResolveLA(host, string(d->libraryName));
00808 
00809                     i_LibraryAgent_var iLA = i_LibraryAgent::_narrow(objLA);
00810 
00811                     log_DBG_m(dbg_LOW,"LA unload");
00812                     iLA->Unload(
00813                         d->driveIndex,
00814                         med->slotAddr,
00815                         med->barcode,
00816                         // This job ID is used to distinguish
00817                         // from manual operation by using ivd_la
00818                         1
00819                     );
00820                 );
00821             }
00822             catch (ivd_Exception &e) {
00823                 log_ERR_m("Medium could not be unloaded." << endl << e);
00824                 try {
00825                     ipc_EXEC_m(m_rm->MediumUnusable(med->mediumKey));
00826                     ipc_EXEC_m(m_rm->MediumUnLoaded(    d->libraryName,
00827                                                         med->barcode,
00828                                                         med->slotAddr,
00829                                                         med->slotType));
00830 
00831                     /*void MediumUnLoaded(
00832                         const char* a_libName, const char* a_medBarcode, 
00833                         const char* a_slotAddr, i_Type_t a_slotType);*/
00834                 }
00835                 catch (ivd_Error& e) {
00836                     log_ERR_m("Medium could not be marked unusable." << endl << e)
00837                 }
00838             }
00839         }
00840 
00841 
00842         for (UInt32_t ct=0; ct<driveHostSeq->length(); ct++) {
00843 
00844             if (strcmp(driveHostSeq[ct].driveName, a_name) == 0) {
00845                 host = driveHostSeq[ct].host;
00846                 try {
00847                     ipc_EXEC_m(
00848                         m_rm->RemoveDriveHost(
00849                             CORBA::string_dup(a_name),
00850                             CORBA::string_dup(driveHostSeq[ct].host));
00851                     );
00852                 }
00853                 catch (ivd_Error& e) {
00854                     log_ERR_m("Could not remove drive host." << endl << e);
00855                 }
00856             }
00857         }
00858 
00859         //
00860         // remove drive entry from RMDB.
00861         ipc_EXEC_m(
00862             m_rm->RemoveDrive(CORBA::string_dup(a_name));
00863             log_DBG_m(dbg_NORM, "MIF: Drive removed from RMDB");
00864         );
00865         //
00866         // remove named drive subdir from configuration repository.
00867         mif_CfgRep cfgHelp(mif_DRIVE, a_name);
00868         cfgHelp.RemoveCfg();
00869 
00870         log_DBG_m(dbg_NORM, "Drive configuration removed from CfgDB repository");
00871 
00872         ostringstream eventText;
00873         eventText << "Removed.";
00874         //
00875         // notify jobs in job list about changed resource
00876         ipc_EXEC_m(
00877             m_rm->UseNewResource();
00878         );
00879         log_WriteEvent(eventText.str(), "DRIVE", 0, a_name);
00880 
00881     }
00882     ipc_CATCH_IVD_THROW_CORBA_m
00883 
00884 } // i_ManagementInterface_i::RemoveDrive()

Here is the call graph for this function:

char * i_ManagementInterface_i::UpdateDrive ( const char *  a_userAtDomain,
const char *  a_name,
const i_DataBlock_t a_cfgFile,
i_Index_t a_newRevNo 
)

Definition at line 435 of file i_mif_drive.cpp.

References cfg_RMDrive::capabilities, cmn_Num2Str(), i_DriveHost_t::controlDevice, dbg_DETAIL, dbg_NORM, cfg_RMDrive::driveIndex, i_DriveHost_t::driveName, i_DriveHost_t::host, cfg_RMDrive::hosts, ie_MIF_CFG_RENAMING_NOT_ALLOWED_YET, ie_PRECONDITION, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, cfg_RMDrive::library, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_rm, cfg_RMDrive::mediaFamily, MIF_CFG_DRIVE, mif_DRIVE, cfg_RMDrive::name, mif_CfgRep::ParseToFile(), mif_CfgRep::ReplaceHosts(), and ipc_Corba::ResolveLA().

00439                                                            {
00440 
00441     log_FUNC_m(UpdateDrive);
00442     try {
00443         
00444         //
00445         // check if drive is configured.
00446         i_Drive_t_var driveI;
00447         try {
00448             ipc_EXEC_m(
00449                 driveI = m_rm->SelectDrive(CORBA::string_dup(a_name));
00450                 log_DBG_m(dbg_NORM, "MIF: Drive is configured.");       
00451             );
00452         }
00453         catch (ivd_Exception) {
00454             // TODO: RMDB could return specific error for not found
00455             throw ivd_Error(ie_RMDB_NOTFOUND, 
00456                             "Drive not configured: " + string(a_name));
00457         }
00458 
00459         //
00460         // parse config buffer
00461         pf_File pFile;
00462         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_DRIVE, a_userAtDomain);
00463         mif_CfgRep::ReplaceHosts(pFile);
00464 
00465         cfg_RMDrive driveCfg(pFile);
00466 
00467         // rename is not allowed yet
00468         if (driveCfg.name.compare(a_name) != 0) {
00469             throw ivd_Error(ie_MIF_CFG_RENAMING_NOT_ALLOWED_YET);
00470         }
00471 
00472         //
00473         // Check if drive's mediaFamily matches library
00474         if (!driveCfg.library.empty()) {
00475             i_Library_t_var lib;
00476             ipc_EXEC_m(
00477                 lib = m_rm->SelectLibrary(CORBA::string_dup(driveCfg.library.c_str()));
00478                 log_DBG_m(dbg_NORM, "MIF: Library is configured.");       
00479             );
00480             
00481             if (lib->mediaFamily != driveCfg.mediaFamily) {
00482                 throw ivd_Error(ie_PRECONDITION,
00483                     "Medium family of drive does not match library.");
00484             }
00485         }
00486        
00487         //
00488         // copy configuration data
00489         UInt32_t capBitFlags(0);
00490         for (UInt32_t i(0); i < driveCfg.capabilities.size(); i++) {
00491             capBitFlags = capBitFlags | driveCfg.capabilities[i].Val();
00492             log_DBG_m(dbg_DETAIL,"capBitFlags = " << hex << capBitFlags);
00493         }
00494         driveI->capabilities     = capBitFlags;
00495         driveI->driveIndex       = CORBA::string_dup(cmn_Num2Str(driveCfg.driveIndex).c_str());     // string[64] <- int ?! (driveCfg.driveIndex)
00496         driveI->driveName        = CORBA::string_dup(driveCfg.name.c_str());                        
00497         driveI->mediaFamily      = driveCfg.mediaFamily;
00498         driveI->libraryName      = CORBA::string_dup(driveCfg.library.c_str());
00499 
00500         log_DBG_m(dbg_NORM, "MIF: i_Drive_t structure filled.");
00501 
00502         {
00503             //
00504             // update drive entry in RMDB
00505             ipc_EXEC_m(
00506                 m_rm->UpdateDrive(driveI);
00507                 log_DBG_m(dbg_NORM, "MIF: Drive entry in RMDB updated.");
00508             );
00509 
00510             //
00511             // add/remove drive host RMDB entries for this drive.
00512            
00513             i_DriveHostSeq_t host_existingList; 
00514             i_DriveHostSeq_t host_newConfigList;
00515             i_DriveHostSeq_t host_addedList;
00516             i_DriveHostSeq_t host_removedList;
00517             i_DriveHostSeq_t host_updatedList;
00518 
00519             i_DriveHostSeq_t_var driveHostSeq;
00520             ipc_EXEC_m(
00521                 driveHostSeq = m_rm->SelectAllDriveHosts();
00522             );
00523 
00524             for (UInt32_t ct=0; ct<driveHostSeq->length(); ct++)
00525 
00526                 if (strcmp(driveHostSeq[ct].driveName, a_name) == 0) {
00527                     i_DriveHost_t tmp_host;
00528                     tmp_host.host          = driveHostSeq[ct].host;
00529                     tmp_host.controlDevice = driveHostSeq[ct].controlDevice;
00530 
00531                     host_existingList.length(host_existingList.length()+1);
00532                     host_existingList[host_existingList.length()-1] = tmp_host;
00533                 }
00534 
00535             //
00536             // make a copy of new configuration host list.
00537             for (UInt32_t ct=0; ct<driveCfg.hosts.size(); ct++) {
00538             
00539                 i_DriveHost_t tmp_host;
00540                 
00541                 tmp_host.host           = CORBA::string_dup(driveCfg.hosts[ct].name.c_str());
00542                 tmp_host.controlDevice  = CORBA::string_dup(driveCfg.hosts[ct].controlDevice.c_str());
00543         
00544                 host_newConfigList.length(host_newConfigList.length()+1);
00545                 host_newConfigList[host_newConfigList.length()-1] = tmp_host;
00546             }
00547         
00548             log_DBG_m(dbg_NORM, 
00549                 "MIF: existing drivehosts " << host_existingList.length());
00550             log_DBG_m(dbg_NORM, 
00551                 "MIF: new config drivehosts " << host_newConfigList.length());
00552         
00553             // create both vectors for hosts.
00554             if (   (host_existingList.length() != 0)
00555                 && (host_newConfigList.length() != 0)) {
00556         
00557                 // determine removed and updated hosts.
00558                 for (UInt32_t ct1=0; ct1<host_existingList.length(); ct1++) {
00559         
00560                     string tmp_hostName;
00561                     UInt32_t ct2 = 0;
00562                     bool found = false;
00563         
00564                     tmp_hostName = string(host_existingList[ct1].host);
00565                     log_DBG_m(dbg_NORM, "MIF: Selected " << ct1+1 << ". existing host, checking new config hosts...");
00566 
00567                     while ((ct2 < host_newConfigList.length())
00568                         && (!found)                          ) {
00569         
00570                         if (tmp_hostName == string(host_newConfigList[ct2].host)) {
00571                             found = true;
00572                             host_updatedList.length(host_updatedList.length()+1);
00573                             host_updatedList[host_updatedList.length()-1] = i_DriveHost_t(host_newConfigList[ct2]);
00574                         }    
00575                         ct2++;
00576                     }
00577                     
00578                     log_DBG_m(dbg_NORM, "MIF: Before adding to REMOVED HOSTS list.");
00579                     if (!found) {
00580                         host_removedList.length(host_removedList.length()+1);
00581                         host_removedList[host_removedList.length()-1] = host_existingList[ct1];
00582                     }
00583                     log_DBG_m(dbg_NORM, "MIF: After adding to REMOVED HOSTS list.");
00584                 }
00585 
00586                 // determine added hosts.
00587                 for (UInt32_t ct2=0; ct2<host_newConfigList.length(); ct2++) {
00588         
00589                     string tmp_hostName;
00590                     UInt32_t ct1 = 0;
00591                     bool found = false;
00592         
00593                     tmp_hostName = string(host_newConfigList[ct2].host);
00594                     log_DBG_m(dbg_NORM, "MIF: Selected " << ct2+1 << ". host in new config, checking existing hosts...");
00595 
00596                     while ((ct1 < host_existingList.length())
00597                         && (!found)                         ) {
00598         
00599                         if (tmp_hostName == string(host_existingList[ct1].host)) {
00600                             found = true;
00601                         }
00602         
00603                         ct1++;
00604                     }
00605         
00606                     log_DBG_m(dbg_NORM, "MIF: Before adding to ADDED HOSTS list.");
00607                     if (!found) {
00608                         host_addedList.length(host_addedList.length()+1);
00609                         host_addedList[host_addedList.length()-1] = i_DriveHost_t(host_newConfigList[ct2]);
00610                     }
00611                     log_DBG_m(dbg_NORM, "MIF: After adding to ADDED HOSTS list.");
00612                 }
00613 
00614             }
00615             else if (host_existingList.length() == 0) {
00616         
00617                 // add all in new config.
00618                 host_addedList = host_newConfigList;
00619                 log_DBG_m(dbg_NORM, "MIF: There are no existing hosts.");
00620             }
00621             else if (host_newConfigList.length() == 0) {
00622         
00623                 // remove all existing.
00624                 host_removedList = host_existingList;
00625                 log_DBG_m(dbg_NORM, "MIF: There are no hosts in new config.");
00626             }
00627             else {
00628         
00629                 // do nothing (lists remain empty).
00630                 log_DBG_m(dbg_NORM, "MIF: There are no existing hosts, nor hosts in new config.");
00631             }
00632 
00633             log_DBG_m(dbg_NORM, "MIF: added drivehosts " << host_addedList.length());
00634             log_DBG_m(dbg_NORM, "MIF: removed drivehosts " << host_removedList.length());
00635             log_DBG_m(dbg_NORM, "MIF: updated drivehosts " << host_updatedList.length());
00636 
00637             // remove removed hosts.
00638             for (UInt32_t ct=0; ct<host_removedList.length(); ct++) {
00639                 ipc_EXEC_m(
00640                     m_rm->RemoveDriveHost(
00641                                     CORBA::string_dup(driveCfg.name.c_str()),
00642                                     CORBA::string_dup(host_removedList[ct].host));
00643                 );
00644             }
00645 
00646             // add added hosts.
00647             for (UInt32_t ct=0; ct<host_addedList.length(); ct++) {
00648                 {
00649                     i_DriveHost_t driveHostI;
00650         
00651                     driveHostI.host          = host_addedList[ct].host;
00652                     driveHostI.driveName     = CORBA::string_dup(driveCfg.name.c_str());
00653                     driveHostI.controlDevice = host_addedList[ct].controlDevice;
00654         
00655                     ipc_EXEC_m(
00656                         m_rm->AddDriveHost(driveHostI);
00657                     );
00658                 }
00659             }
00660 
00661             // update updated hosts.
00662             for (UInt32_t ct=0; ct<host_updatedList.length(); ct++) {
00663                 {
00664                     i_DriveHost_t driveHostI;
00665         
00666                     driveHostI.host          = host_updatedList[ct].host;
00667                     driveHostI.driveName     = CORBA::string_dup(driveCfg.name.c_str());
00668                     driveHostI.controlDevice = host_updatedList[ct].controlDevice;
00669         
00670                     ipc_EXEC_m(
00671                         m_rm->UpdateDriveHost(driveHostI);
00672                     );
00673                 }
00674             }
00675             
00676             // Call LA->Reconfigure
00677             try {
00678                 ipc_EXEC_m(
00679                     i_Library_t_var lib = m_rm->SelectLibrary(driveI->libraryName);
00680 
00681                     CORBA::Object_var objLA =
00682                         ipc_Corba::ResolveLA(string(lib->host), 
00683                                              string(driveI->libraryName));
00684                     i_LibraryAgent_var iLA = i_LibraryAgent::_narrow(objLA);
00685 
00686                     iLA->Reconfigure(lib);
00687                 );
00688             }
00689             catch (ivd_Exception &e) {
00690                 log_ERR_m("Reconfiguring Library failed." << endl << e);
00691             }
00692 
00693             //
00694             // notify jobs in job list about changed resource
00695             ipc_EXEC_m(
00696                 m_rm->UseNewResource();
00697             );
00698 
00699             
00700             //
00701             // save revision of drive cfg file to configuration repository.
00702             mif_CfgRep cfg(mif_DRIVE, driveCfg.name);
00703             a_newRevNo = cfg.Upload(pFile);
00704 
00705             log_DBG_m(dbg_DETAIL, 
00706                 "MIF: drive configuration stream is: \n" << pFile);
00707 
00708             log_DBG_m(dbg_NORM, 
00709                 "MIF: new drive configuration revision added to CfgDB repository.");
00710         }
00711 
00712 
00713         ostringstream eventText;
00714         eventText << "Updated (rev. ";
00715         eventText << a_newRevNo;
00716         eventText << ").";
00717         
00718         log_WriteEvent(eventText.str(), "DRIVE", 0, a_name);
00719         return CORBA::string_dup(a_name);
00720     }
00721     ipc_CATCH_IVD_THROW_CORBA_m
00722 } // i_ManagementInterface_i::UpdateDrive()

Here is the call graph for this function:

i_DataBlock_t * i_ManagementInterface_i::ShowDrive ( const char *  a_name,
i_Index_t  a_revNo 
)

Definition at line 725 of file i_mif_drive.cpp.

References dbg_NORM, mif_CfgRep::GetCfg(), ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_ReadFromFile(), ivd_Error, log_DBG_m, log_FUNC_m, m_rm, and mif_DRIVE.

00726                                                                        {
00727     log_FUNC_m(ShowDrive);
00728     try {
00729         //
00730         // check if drive is configured.
00731         i_Drive_t_var driveI;
00732         try {
00733             ipc_EXEC_m(
00734                 driveI = m_rm->SelectDrive(CORBA::string_dup(a_name));
00735             log_DBG_m(dbg_NORM, "MIF: Drive is configured.");       
00736             );
00737         }
00738         catch (ivd_Exception) {
00739             // TODO: RMDB could return specific error for not found
00740             throw ivd_Error(ie_RMDB_NOTFOUND, 
00741                 "Drive not configured: " + string(a_name));
00742         }
00743         mif_CfgRep cfgRev(mif_DRIVE, a_name);
00744         cmn_File cfgFile = cfgRev.GetCfg(a_revNo);
00745         return ipc_ReadFromFile(cfgFile);
00746     } ipc_CATCH_IVD_THROW_CORBA_m
00747 } // i_ManagementInterface_i::ShowDrive()

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::ShowDriveRevs ( const char *  a_name  ) 

Definition at line 887 of file i_mif_drive.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, mif_CfgRep::LastRev(), log_FUNC_m, and mif_DRIVE.

00887                                                                    {
00888     log_FUNC_m(ShowDriveRevs);
00889 
00890     try {
00891         mif_CfgRep cfgObj(mif_DRIVE, a_name);
00892         return cfgObj.LastRev();
00893     }
00894     ipc_CATCH_IVD_THROW_CORBA_m
00895 } // i_ManagementInterface_i::ShowDriveRevs()

Here is the call graph for this function:

i_Drive_t * i_ManagementInterface_i::GetDrive ( const char *  a_name  ) 

Definition at line 278 of file i_mif_drive.cpp.

References log_FUNC_A_m, and m_rm.

00278                                                                {
00279     log_FUNC_A_m(GetDrive, "a_name:" << a_name);
00280     return m_rm->SelectDrive(a_name);
00281 }

void i_ManagementInterface_i::ListDrives ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 37 of file i_mif_drive.cpp.

References i_Drive_t::aveSeekTime, bf_DriveToText(), bf_DrvAveSeekTime, bf_DrvCapabilities, bf_DrvCleanNr, bf_DrvControlDevice, bf_DrvDataThroughput, bf_DrvFirmwareRev, bf_DrvHost, bf_DrvIndex, bf_DrvKey, bf_DrvLastClean, bf_DrvLibName, bf_DrvLoadTime, bf_DrvMediaFamily, bf_DrvMediumBarcode, bf_DrvName, bf_DrvOptions, bf_DrvProductID, bf_DrvRewindTime, bf_DrvScsiID, bf_DrvSerialNo, bf_DrvStatus, bf_DrvUnloadTime, bf_DrvUsageCount, bf_DrvVendorID, cmn_Time::c_Time2YMDhms(), i_Drive_t::capabilities, i_Drive_t::cleanNr, i_Drive_t::dataThroughput, dbg_LOW, i_Drive_t::driveIndex, i_Drive_t::driveKey, i_Drive_t::driveName, i_Drive_t::firmwareRev, g_cmn, g_driveTable, ivd_BaseException::GetError(), ie_RMDB_NOTFOUND, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), i_Drive_t::lastClean, i_Drive_t::libraryName, i_Drive_t::loadTime, log_DBG_m, log_FUNC_m, cmn_SysInfo::m_hostName, m_rm, i_Drive_t::mediaFamily, ui_ResultPacker::NewRow(), i_Drive_t::options, i_Drive_t::productID, i_Drive_t::rewindTime, i_Drive_t::scsiID, ui_ResultPacker::SendResults(), i_Drive_t::serialNo, cmn_Global::si, i_Drive_t::status, uires_DRIVESTATUS, uires_MEDIAFAMILYTYPE, i_Drive_t::unloadTime, i_Drive_t::usageCount, cmn_BitFlag_t::val, and i_Drive_t::vendorID.

00038                                                                 {
00039     log_FUNC_m(ListDrives);
00040 /*
00041 /mnt/ivdfs/ivddrive --list
00042 Drive      Family      Library  Host               CtrlDev  Status   Medium
00043 AIT_DRV1   AIT         GTL_AIT  myhost.domain.com  /dev/sg2 online   <empty>
00044 AIT_DRV2   AIT         GTL_AIT  myhost.domain.com  /dev/sg3 in use   000012
00045 LTO_DRV1   LTO-Ultrium GTL_LTO  myhost.domain.com  /dev/sg4 offline  <empty>
00046 VXA_DRV1   VXA         GTL_VXA  myhost.domain.com  /dev/sg5 offline  <empty>
00047 */
00048     ui_BitFlag flags(a_filter);
00049 
00050     ui_ResultPacker result;
00051 
00052     try {
00053         result.NewRow(true);
00054 
00055         i_DriveSeq_t_var driveSeq;
00056         ipc_EXEC_m(driveSeq = m_rm->SelectAllDrives(););
00057 
00058         if (driveSeq->length() == 0)
00059             return;
00060 
00061         UInt32_t i = 0;
00062         while ( g_driveTable[i].val != -1) { 
00063             if (flags.IsFlagSet(g_driveTable[i].val)) {
00064                 result.Insert(
00065                     bf_DriveToText(static_cast<bf_Drive_e>(g_driveTable[i].val)));
00066             }
00067             i++;
00068         }
00069     
00070         for (UInt32_t i = 0; i < driveSeq->length(); i++) {
00071             i_Drive_t & drv = driveSeq[i];
00072 
00073             result.NewRow();
00074 
00075             if (flags.IsFlagSet(bf_DrvName)) {
00076                 result.Insert(drv.driveName);
00077             }
00078 
00079             if (flags.IsFlagSet(bf_DrvMediaFamily)) {
00080                 result.Insert(uires_MEDIAFAMILYTYPE,
00081                               drv.mediaFamily);
00082             }
00083             if (flags.IsFlagSet(bf_DrvLibName)) {
00084                 result.Insert(drv.libraryName);
00085             }
00086 
00087             i_DriveHost_t_var driveHost;
00088             bool foundHost(false);
00089             try {
00090                 ipc_EXEC_m(
00091                     driveHost = m_rm->SelectDriveHost(
00092                     drv.driveName, 
00093                     CORBA::string_dup(g_cmn.si.m_hostName.c_str()));
00094                 );
00095                 foundHost = true;
00096             } 
00097             catch (ivd_Error &e) {
00098                 if (e.GetError() == ie_RMDB_NOTFOUND ) {
00099                     foundHost = false;
00100                 } 
00101                 else {
00102                     log_DBG_m(dbg_LOW, e);
00103                     throw;
00104                 }                
00105             }
00106             
00107             if (flags.IsFlagSet(bf_DrvHost)) {
00108                 if (foundHost) {
00109                     result.Insert(driveHost->host);
00110                 }
00111                 else {
00112                     result.Insert("n/a");
00113                 }
00114             }
00115 
00116             if (flags.IsFlagSet(bf_DrvControlDevice)) {
00117                 if (foundHost) {
00118                     result.Insert(driveHost->controlDevice);
00119                 }
00120                 else {
00121                     result.Insert("n/a");
00122                 }
00123             }        
00124 
00125             if (flags.IsFlagSet(bf_DrvStatus)) {
00126                 result.Insert(uires_DRIVESTATUS, drv.status);
00127             }
00128 
00129             if (flags.IsFlagSet(bf_DrvMediumBarcode)) {
00130                 i_Medium_t_var med;
00131                 try {
00132                     ipc_EXEC_m(med = m_rm->SelectMediumByDrive(drv.driveName););
00133                     result.Insert(med->barcode);
00134                 } catch (ivd_Error &e) {
00135                     if (e.GetError() == ie_RMDB_NOTFOUND ) {
00136                         result.Insert("<empty>");                    
00137                     } else {
00138                         log_DBG_m(dbg_LOW, e);
00139                         throw;
00140                     }                
00141                 }
00142             }
00143             
00144             if (flags.IsFlagSet(bf_DrvVendorID)) {
00145                 result.Insert(drv.vendorID);
00146             }
00147 
00148             if (flags.IsFlagSet(bf_DrvProductID)) {
00149                 result.Insert(drv.productID);
00150             }
00151 
00152             if (flags.IsFlagSet(bf_DrvSerialNo)) {
00153                 result.Insert(drv.serialNo);
00154             }
00155 
00156             if (flags.IsFlagSet(bf_DrvFirmwareRev)) {
00157                 result.Insert(drv.firmwareRev);
00158             }
00159 
00160             if (flags.IsFlagSet(bf_DrvScsiID)) {
00161                 result.Insert(drv.scsiID);
00162             }
00163 
00164             if (flags.IsFlagSet(bf_DrvIndex)) {
00165                 result.Insert(drv.driveIndex);
00166             }
00167 
00168             if (flags.IsFlagSet(bf_DrvLoadTime)) {
00169                 result.Insert(drv.loadTime);
00170             }
00171 
00172             if (flags.IsFlagSet(bf_DrvUnloadTime)) {
00173                 result.Insert(drv.unloadTime);
00174             }
00175 
00176             if (flags.IsFlagSet(bf_DrvAveSeekTime)) {
00177                 result.Insert(drv.aveSeekTime);
00178             }
00179 
00180             if (flags.IsFlagSet(bf_DrvRewindTime)) {
00181                 result.Insert(drv.rewindTime);
00182             }
00183 
00184             if (flags.IsFlagSet(bf_DrvLastClean)) {
00185                 cmn_Time timeInfo(drv.lastClean);
00186 
00187                 result.Insert(timeInfo.c_Time2YMDhms());
00188             }
00189 
00190             if (flags.IsFlagSet(bf_DrvDataThroughput)) {
00191                 result.Insert(drv.dataThroughput);
00192             }
00193 
00194             if (flags.IsFlagSet(bf_DrvUsageCount)) {
00195                 result.Insert(drv.usageCount);
00196             }
00197 
00198             if (flags.IsFlagSet(bf_DrvCleanNr)) {
00199                 result.Insert(drv.cleanNr);
00200             }
00201 
00202             if (flags.IsFlagSet(bf_DrvCapabilities)) {
00203                 result.Insert(drv.capabilities);
00204             }
00205 
00206             if (flags.IsFlagSet(bf_DrvOptions)) {
00207                 result.Insert(drv.options);
00208             }
00209 
00210             if (flags.IsFlagSet(bf_DrvKey)) {
00211                 result.Insert(drv.driveKey);
00212             }
00213             
00214         } // for
00215         result.SendResults(a_uims);
00216     } ipc_CATCH_IVD_THROW_CORBA_m
00217 
00218     
00219 }  // i_ManagementInterface_i::ListDrives()

Here is the call graph for this function:

void i_ManagementInterface_i::EnableDrive ( const char *  driveName,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 222 of file i_mif_drive.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), m_rm, rmdb_DRIVE_DISABLED, and rmdb_DRIVE_ERROR.

00223                                                       {
00224     
00225     log_FUNC_m(EnableDrive);
00226     
00227     UInt32_t status(0);
00228     status = rmdb_DRIVE_ERROR | rmdb_DRIVE_DISABLED;
00229     try {
00230         i_Drive_t_var d = m_rm->SelectDrive(a_name);
00231         if (d->status == 0) {
00232             ostringstream msg;
00233             msg << "Drive already enabled." ;
00234             log_WriteEvent(msg.str(), "DRIVE", 0, string(a_name));
00235             a_uims->DisplayWarning(msg.str().c_str());
00236         } 
00237         else {
00238             // clear disabled and error flags
00239             m_rm->DriveStatusClear(a_name, status);
00240             ostringstream msg;
00241             msg << "Drive enabled." ;
00242             log_WriteEvent(msg.str(), "DRIVE", 0, string(a_name));
00243             a_uims->DisplayMessage(msg.str().c_str());
00244         }
00245     }
00246     ipc_CATCH_IVD_THROW_CORBA_m;
00247 } // i_ManagementInterface_i::EnableDrive()

Here is the call graph for this function:

void i_ManagementInterface_i::DisableDrive ( const char *  driveName,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 250 of file i_mif_drive.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), m_rm, and rmdb_DRIVE_DISABLED.

00251                                                       {
00252     
00253     log_FUNC_m(DisableDrive);
00254 
00255     UInt32_t status(rmdb_DRIVE_DISABLED);
00256     try {
00257         i_Drive_t_var d = m_rm->SelectDrive(a_name);
00258         if (d->status & rmdb_DRIVE_DISABLED) {
00259             ostringstream msg;
00260             msg << "Drive already disabled." ;
00261             log_WriteEvent(msg.str(), "DRIVE", 0, string(a_name));
00262             a_uims->DisplayWarning(msg.str().c_str());
00263         } 
00264         else {
00265             // set disabled flag
00266             m_rm->DriveStatusSet(a_name, status);
00267             ostringstream msg;
00268             msg << "Drive disabled." ;
00269             log_WriteEvent(msg.str(), "DRIVE", 0, string(a_name));
00270             a_uims->DisplayMessage(msg.str().c_str());
00271         }
00272     }
00273     ipc_CATCH_IVD_THROW_CORBA_m;
00274 
00275 } // i_ManagementInterface_i::DisableDrive

Here is the call graph for this function:

i_MediaInfoSeq_t * i_ManagementInterface_i::GetMediaInfo ( const char *  a_partName  ) 

Definition at line 30 of file i_mif_collocation.cpp.

References log_FUNC_m, and m_rm.

00030                                                                               {
00031     log_FUNC_m(GetMediaInfo);
00032     return m_rm->GetMediaInfo(a_partName);
00033 }

i_MinorColSeq_t * i_ManagementInterface_i::EnumMinorCollocationId ( i_ColID_t  a_majColId  ) 

Definition at line 35 of file i_mif_collocation.cpp.

References log_FUNC_m, and m_rm.

00035                                                                                            {
00036     log_FUNC_m(EnumMinorCollocationId);
00037     return m_rm->SelectAllMinorColByMajCol(a_majColId);
00038 }

i_MajorColSeq_t * i_ManagementInterface_i::EnumMajorCollocationId (  ) 

Definition at line 40 of file i_mif_collocation.cpp.

References log_FUNC_m, and m_rm.

00040                                                                  {
00041     log_FUNC_m(EnumMajorCollocationId);
00042     return m_rm->SelectAllMajorCol();
00043 }

void i_ManagementInterface_i::ListDriveHosts ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 35 of file i_mif_drivehost.cpp.

References bf_DHControlDevice, bf_DHDriveName, bf_DHHost, bf_DriveHostToText(), i_DriveHost_t::controlDevice, i_DriveHost_t::driveName, g_driveHostTable, i_DriveHost_t::host, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), log_FUNC_m, m_rm, ui_ResultPacker::NewRow(), ui_ResultPacker::SendResults(), and cmn_BitFlag_t::val.

00036                                                                 {
00037     log_FUNC_m(ListDriveHosts);
00038     ui_BitFlag flags(a_filter);
00039 
00040     ui_ResultPacker result;
00041 
00042     try {
00043         result.NewRow(true);
00044 
00045         i_DriveHostSeq_t_var driveHostSeq;
00046         ipc_EXEC_m(driveHostSeq = m_rm->SelectAllDriveHosts(););
00047 
00048         if (driveHostSeq->length() == 0)
00049             return;
00050 
00051         UInt32_t i = 0;
00052         while ( g_driveHostTable[i].val != -1){ 
00053             if (flags.IsFlagSet(g_driveHostTable[i].val)){
00054                 result.Insert(
00055                     bf_DriveHostToText(static_cast<bf_DriveHost_e>(g_driveHostTable[i].val)));
00056             }
00057             i++;
00058         }
00059 
00060         for (UInt32_t i = 0; i < driveHostSeq->length(); i++) {
00061             i_DriveHost_t & dh = driveHostSeq[i];
00062 
00063             result.NewRow();
00064 
00065             if (flags.IsFlagSet(bf_DHHost)){
00066                 result.Insert(dh.host);
00067             }
00068 
00069             if (flags.IsFlagSet(bf_DHDriveName)){
00070                 result.Insert(dh.driveName);
00071             }
00072             if (flags.IsFlagSet(bf_DHControlDevice)){
00073                 result.Insert(dh.controlDevice);
00074             }
00075 
00076     } //for
00077     result.SendResults(a_uims);
00078     } ipc_CATCH_IVD_THROW_CORBA_m
00079 }

Here is the call graph for this function:

i_DriveHost_t * i_ManagementInterface_i::GetDriveHost ( const char *  a_driveName,
const char *  driveHost 
)

Definition at line 81 of file i_mif_drivehost.cpp.

References log_FUNC_A_m, and m_rm.

00083                                                                     {
00084     log_FUNC_A_m(GetDriveHost,  "a_driveName:" << a_driveName <<
00085                                 " a_driveHost:" << a_driveHost);
00086     
00087     return m_rm->SelectDriveHost(a_driveName, a_driveHost);
00088 }

char * i_ManagementInterface_i::AddPool ( const char *  a_userAtDomain,
const i_DataBlock_t a_cfgFile 
)

Definition at line 185 of file i_mif_pool.cpp.

References cfg_RMPool::blockSize, i_MediaPool_t::blockSize, cfg_MEGABYTE, dbg_DETAIL, dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ie_MIF_RM_PROBLEM, ie_PRECONDITION, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, cfg_RMPool::maxMediaAge, i_MediaPool_t::maxMediaAge, i_MediaPool_t::maxNrReadWrite, cfg_RMPool::maxReadWrite, cfg_RMPool::mediaFamily, i_MediaPool_t::mediaFamily, i_MediaPool_t::mediaPoolName, i_MediaPool_t::mediaPoolType, mf_DISK, MIF_CFG_POOL, mif_POOL, cfg_RMPool::name, cfg_RMPool::numOfVolumes, i_MediaPool_t::numOfVolumes, mif_CfgRep::ParseToFile(), i_MediaPool_t::partitionUUIDString, cfg_RMPool::poolType, cfg_RMPool::sizeOfSysVol, i_MediaPool_t::sizeOfSysVol, i_MediaPool_t::sizeOfVolume, cfg_RMPool::sysVolLocation, i_MediaPool_t::sysVolLocation, ValidatePoolConfig(), and cfg_RMPool::volumeSize.

00186                                                                         {
00187 
00188     log_FUNC_m(AddPool);
00189     try {
00190         pf_File pFile;
00191         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_POOL, a_userAtDomain);
00192 
00193         cfg_RMPool poolCfg(pFile);
00194         ValidatePoolConfig(poolCfg);
00195         //
00196         // copy configuration data
00197         i_MediaPool_t poolI;
00198         // poolI.mediaPoolKey         = generated!
00199         poolI.mediaPoolName         = CORBA::string_dup(poolCfg.name.c_str());
00200         poolI.mediaFamily           = poolCfg.mediaFamily;
00201         poolI.mediaPoolType         = poolCfg.poolType;
00202         poolI.partitionUUIDString   = CORBA::string_dup(ipc_nilStr);
00203         poolI.maxMediaAge           = poolCfg.maxMediaAge;
00204         poolI.maxNrReadWrite        = poolCfg.maxReadWrite;
00205         poolI.blockSize             = poolCfg.blockSize;
00206         poolI.sysVolLocation        = poolCfg.sysVolLocation;
00207         poolI.numOfVolumes          = poolCfg.numOfVolumes;
00208 
00209         // System volume size is in MB
00210         poolI.sizeOfSysVol          = poolCfg.sizeOfSysVol/cfg_MEGABYTE;
00211 
00212         if (poolI.mediaFamily == mf_DISK)
00213             poolI.sizeOfVolume      = poolCfg.volumeSize/cfg_MEGABYTE;
00214         else
00215             poolI.sizeOfVolume      = 0;
00216 
00217         log_DBG_m(dbg_NORM, "MIF: i_MediaPool_t structure filled.");
00218 
00219         try {
00220             i_MediaPool_t_var mp;
00221             ipc_EXEC_m(
00222                 mp = m_rm->SelectMediaPool(poolI.mediaPoolName);
00223                 log_DBG_m(dbg_NORM, "MIF: Media pool is configured.");
00224                 throw ivd_Error(ie_PRECONDITION,
00225                     "Pool already configured: " + string(poolI.mediaPoolName));
00226             );
00227         } catch (ivd_Exception &e) {
00228             log_DBG_m(dbg_NORM, e);
00229             if (e.GetError() == ie_RMDB_NOTFOUND) {
00230                 // continue
00231             } else
00232                 throw;
00233         }
00234 
00235         //
00236         // add media pool entry to RMDB
00237         try {
00238             ipc_EXEC_m(
00239                 m_rm->AddMediaPool(poolI);
00240                 log_DBG_m(dbg_NORM,
00241                         "MIF: Media pool " << poolCfg.name << " added into RMDB.");
00242             );
00243         } catch (ivd_Error& e) {
00244             ostringstream msg;
00245             msg << "Adding of pool failed. " << e.GetFriendly();
00246             throw ivd_Error(ie_MIF_RM_PROBLEM, msg.str() );
00247         }
00248 
00249         //
00250         // notify jobs in job list about new resource
00251         ipc_EXEC_m(
00252             m_rm->UseNewResource();
00253         );
00254 
00255         //
00256         // save first revision of drive cfg file to configuration repository.
00257         mif_CfgRep cfg(mif_POOL, poolCfg.name);
00258         cfg.Upload(pFile);
00259 
00260         log_DBG_m(dbg_DETAIL, "Media pool cfg is: \n" << pFile);
00261 
00262         ostringstream eventText;
00263         eventText << "Added new.";
00264 
00265         log_WriteEvent(eventText.str(), "POOL", 0, poolCfg.name);
00266         return CORBA::string_dup(poolCfg.name.c_str());
00267     }
00268     ipc_CATCH_IVD_THROW_CORBA_m;
00269 } // i_ManagementInterface_i::AddPool()

Here is the call graph for this function:

void i_ManagementInterface_i::RemovePool ( const char *  a_name  ) 

Definition at line 465 of file i_mif_pool.cpp.

References dbg_NORM, ie_REMOVE_ERROR, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, mif_POOL, and mif_CfgRep::RemoveCfg().

00465                                                            {
00466     log_FUNC_m(RemovePool);
00467 
00468     try {
00469         //
00470         // check if media pool is configured.
00471         i_MediaPool_t_var mp;
00472         try {
00473             ipc_EXEC_m(
00474                 mp = m_rm->SelectMediaPool(CORBA::string_dup(a_name));
00475                 log_DBG_m(dbg_NORM, "MIF: Media pool is configured.");
00476             );
00477         }
00478         catch (ivd_Exception) {
00479             // TODO: RMDB could return specific error for not found
00480             throw ivd_Error(ie_RMDB_NOTFOUND,
00481                             "Pool not configured: " + string(a_name));
00482         }
00483 
00484         //
00485         // if already assigned to partition - deny removal
00486         if (strlen(mp->partitionUUIDString) > 0) {
00487             throw ivd_Error(ie_REMOVE_ERROR,
00488                 "Media pool is assigned to HSM partition.");
00489         }
00490 
00491         //
00492         // check if some media are assigned to this media pool.
00493         i_MediumSeq_t_var mediumSeq;
00494         ipc_EXEC_m(mediumSeq = m_rm->SelectAllMedia();)
00495 
00496         for (UInt32_t i = 0; i < mediumSeq->length(); i++) {
00497             if (strcmp(mediumSeq[i].mediaPoolName, a_name) == 0)
00498                 throw ivd_Error(ie_REMOVE_ERROR,
00499                                 "Some medium are still assigned to media pool.");
00500         }
00501 
00502         //
00503         // remove media pool entry from RMDB
00504         ipc_EXEC_m(m_rm->RemoveMediaPool(CORBA::string_dup(a_name));)
00505         log_DBG_m(dbg_NORM, "MIF: Media pool removed from RMDB");
00506 
00507         //
00508         // remove named media pool subdir from configuration repository
00509         mif_CfgRep cfgHelp(mif_POOL, a_name);
00510         cfgHelp.RemoveCfg();
00511 
00512         log_DBG_m(dbg_NORM,
00513             "MIF: Media pool configuration removed from CfgDB repository");
00514 
00515 
00516         ostringstream eventText;
00517         eventText << "Removed.";
00518 
00519         log_WriteEvent(eventText.str(), "POOL", 0, a_name);
00520     }
00521     ipc_CATCH_IVD_THROW_CORBA_m
00522 } // i_ManagementInterface_i::RemovePool()

Here is the call graph for this function:

char * i_ManagementInterface_i::UpdatePool ( const char *  a_userAtDomain,
const char *  a_name,
const i_DataBlock_t a_cfgFile,
i_Index_t a_newRevNo 
)

Definition at line 272 of file i_mif_pool.cpp.

References cfg_RMPool::blockSize, cfg_MEGABYTE, dbg_DETAIL, dbg_NORM, g_cmn, ivd_BaseException::GetError(), ie_IPC_RESOLVE, ie_MIF_CFG_RENAMING_NOT_ALLOWED_YET, ie_RMDB_NOTFOUND, ie_SEMANTIC_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, cmn_SysInfo::m_serverHost, cfg_RMPool::maxMediaAge, cfg_RMPool::maxReadWrite, cfg_RMPool::mediaFamily, mf_DISK, MIF_CFG_POOL, mif_POOL, cfg_RMPool::name, cfg_RMPool::numOfVolumes, mif_CfgRep::ParseToFile(), cfg_RMPool::poolType, pt_Backup, ipc_Corba::ResolvePMByPartID(), cmn_Global::si, cfg_RMPool::sizeOfSysVol, cfg_RMPool::sysVolLocation, ValidatePoolConfig(), and cfg_RMPool::volumeSize.

00275                                                                    {
00276 
00277     log_FUNC_m(UpdatePool);
00278     try {
00279         //
00280         // check if media pool is configured.
00281         i_MediaPool_t_var poolI;
00282         try {
00283             ipc_EXEC_m(
00284                 poolI = m_rm->SelectMediaPool(CORBA::string_dup(a_name));
00285                 log_DBG_m(dbg_NORM, "MIF: Media pool is configured.");
00286             );
00287         }
00288         catch (ivd_Exception) {
00289             // TODO: RMDB could return specific error for not found
00290             throw ivd_Error(ie_RMDB_NOTFOUND,
00291                             "Pool not configured: " + string(a_name));
00292         }
00293 
00294         //
00295         // parse config buffer
00296         pf_File pFile;
00297         mif_CfgRep::ParseToFile( pFile, a_cfgFile, MIF_CFG_POOL, a_userAtDomain);
00298 
00299         cfg_RMPool poolCfg(pFile);
00300         ValidatePoolConfig(poolCfg);
00301 
00302         // rename is not allowed yet
00303         if (poolCfg.name.compare(a_name) != 0) {
00304             throw ivd_Error(ie_MIF_CFG_RENAMING_NOT_ALLOWED_YET);
00305         }
00306 
00307         //
00308         // validate specified pool data:
00309         // - cannot change media family if media already assigned
00310         // - cannot change pool type if media already assigned
00311         // - cannot change blkSize if pool assigned to part or has init media
00312         // - cannot change type if pool assigned to part or has init media
00313         //
00314         if (strlen(poolI->partitionUUIDString) > 0) {
00315             if (poolCfg.poolType == pt_Backup) {
00316                 throw ivd_Error(ie_SEMANTIC_ERROR,
00317                                 "Medium pool already assigned to HSM partition - "
00318                                 "cannot change PoolType to Backup.");
00319 
00320             }
00321 
00322             if (poolI->blockSize != poolCfg.blockSize) {
00323                 throw ivd_Error(ie_SEMANTIC_ERROR,
00324                                 "Medium pool already assigned to HSM partition - "
00325                                 "cannot change BlockSize.");
00326             }
00327         }
00328 
00329         //
00330         // will need to query media to validate other stuff
00331         // (do it only if validation required)
00332         if (poolI->mediaFamily != poolCfg.mediaFamily
00333             || poolI->mediaPoolType != poolCfg.poolType
00334             || poolI->blockSize != poolCfg.blockSize) {
00335 
00336             // generate media sequence.
00337             i_MediumSeq_t_var mediumSeq;
00338             ipc_EXEC_m(
00339                 mediumSeq = m_rm->SelectAllMedia();
00340             );
00341 
00342             // check for "pool <- medium <- volume" relations.
00343             for (UInt32_t ct=0; ct < mediumSeq->length(); ct++) {
00344 
00345                 if (strcmp(mediumSeq[ct].mediaPoolName, a_name) == 0) {
00346 
00347                     // medium belongs to pool: check mediumFamily and poolType
00348                     if (poolI->mediaFamily != poolCfg.mediaFamily) {
00349                         throw ivd_Error(ie_SEMANTIC_ERROR,
00350                                         "Medium pool has media assigned - "
00351                                         "cannot change MediaFamily.");
00352                     }
00353 
00354                     if (poolI->mediaPoolType != poolCfg.poolType) {
00355                         throw ivd_Error(ie_SEMANTIC_ERROR,
00356                                         "Medium pool has media assigned - "
00357                                         "cannot change PoolType.");
00358                     }
00359 
00360                     if (poolI->blockSize != poolCfg.blockSize) {
00361                         // get media volumes of medium
00362                         i_MediumVolSeq_t_var medVolSeq;
00363                         ipc_EXEC_m(
00364                             medVolSeq = m_rm->SelectAllMediumVolByBarcode(
00365                                                         mediumSeq[ct].barcode);
00366                         );
00367 
00368                         if (medVolSeq->length() > 0) {
00369                             throw ivd_Error(ie_SEMANTIC_ERROR,
00370                                 "Medium pool has initialized media - "
00371                                 "cannot change BlockSize.");
00372                         }
00373                     }
00374                 }
00375             }
00376         }
00377 
00378 
00379         //
00380         // copy configuration data
00381         poolI->mediaPoolName         = CORBA::string_dup(poolCfg.name.c_str());
00382         poolI->mediaFamily           = poolCfg.mediaFamily;
00383         poolI->mediaPoolType         = poolCfg.poolType;
00384         poolI->maxMediaAge           = poolCfg.maxMediaAge;
00385         poolI->maxNrReadWrite        = poolCfg.maxReadWrite;
00386         poolI->blockSize             = poolCfg.blockSize;
00387         poolI->sysVolLocation        = poolCfg.sysVolLocation;
00388         poolI->numOfVolumes          = poolCfg.numOfVolumes;
00389         poolI->sizeOfSysVol          = poolCfg.sizeOfSysVol/cfg_MEGABYTE;
00390         if (poolI->mediaFamily == mf_DISK)
00391             poolI->sizeOfVolume      = poolCfg.volumeSize/cfg_MEGABYTE;
00392         else
00393             poolI->sizeOfVolume      = 0;
00394         log_DBG_m(dbg_NORM, "MIF: i_MediaPool_t structure filled.");
00395 
00396         //
00397         // update media pool entry in RMDB
00398         ipc_EXEC_m(
00399             m_rm->UpdateMediaPool(poolI);
00400         );
00401         log_DBG_m(dbg_NORM, "MIF: Media pool entry in RMDB updated.");
00402 
00403         //
00404         // notify jobs in job list about updated resource
00405         ipc_EXEC_m(
00406             m_rm->UseNewResource();
00407         );
00408 
00409         //
00410         // save first revision of media pool cfg file to configuration repository.
00411         mif_CfgRep cfg(mif_POOL, poolCfg.name);
00412         a_newRevNo = cfg.Upload(pFile);
00413         log_DBG_m(dbg_DETAIL, "Media pool cfg is: " << endl << pFile);
00414 
00415         //
00416         // trigger RefreshCfg in PM, if necessary.
00417         if (strlen(poolI->partitionUUIDString) > 0) {
00418             i_PartSeq_t_var partSeqI;
00419 
00420             ipc_EXEC_m(
00421                 partSeqI = m_rm->SelectAllPartition();
00422             );
00423 
00424             for (UInt32_t ct=0; ct < partSeqI->length(); ct++) {
00425                 if (strcmp(partSeqI[ct].partitionUUIDString,
00426                             poolI->partitionUUIDString) == 0) {
00427 
00428                     try {
00429                         ipc_EXEC_m(
00430                             i_PartitionManager_var pm;
00431 
00432                             CORBA::Object_var obj = ipc_Corba::ResolvePMByPartID(
00433                                 g_cmn.si.m_serverHost,
00434                                 string(partSeqI[ct].partitionName),
00435                                 false);
00436 
00437                             pm = i_PartitionManager::_narrow(obj);
00438                             pm->RefreshCfg();
00439                             log_DBG_m(dbg_NORM,
00440                                 "MIF: HSM-PM refreshed partition config.");
00441                         );
00442                     }
00443                     catch (ivd_Error &e) {
00444                         if (e.GetError() == ie_IPC_RESOLVE)
00445                             log_DBG_m(dbg_NORM, "MIF: Error resolving HSM-PM.");
00446                     }
00447 
00448                     break;
00449                 }
00450             }
00451         }
00452 
00453         ostringstream eventText;
00454         eventText << "Updated (rev. ";
00455         eventText << a_newRevNo;
00456         eventText << ").";
00457 
00458         log_WriteEvent(eventText.str(), "POOL", 0, a_name);
00459         return CORBA::string_dup(a_name);
00460     }
00461     ipc_CATCH_IVD_THROW_CORBA_m;
00462 } // i_ManagementInterface_i::UpdatePool()

Here is the call graph for this function:

i_DataBlock_t * i_ManagementInterface_i::ShowPool ( const char *  a_name,
i_Index_t  a_revNo 
)

Definition at line 160 of file i_mif_pool.cpp.

References dbg_NORM, mif_CfgRep::GetCfg(), ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_ReadFromFile(), ivd_Error, log_DBG_m, log_FUNC_m, m_rm, and mif_POOL.

00161                                                                        {
00162     log_FUNC_m(ShowPool);
00163     try {
00164         //
00165         // check if drive is configured.
00166         i_MediaPool_t_var p;
00167         try {
00168             ipc_EXEC_m(
00169                 p = m_rm->SelectMediaPool(CORBA::string_dup(a_name));
00170                 log_DBG_m(dbg_NORM, "MIF: Drive is configured.");
00171             );
00172         }
00173         catch (ivd_Exception) {
00174             // TODO: RMDB could return specific error for not found
00175             throw ivd_Error(ie_RMDB_NOTFOUND,
00176                 "Pool not configured: " + string(a_name));
00177         }
00178         mif_CfgRep cfgRev(mif_POOL, a_name);
00179         cmn_File cfgFile = cfgRev.GetCfg(a_revNo);
00180         return ipc_ReadFromFile(cfgFile);
00181     } ipc_CATCH_IVD_THROW_CORBA_m
00182 } // i_ManagementInterface_i::ShowPool()

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::ShowPoolRevs ( const char *  a_name  ) 

Definition at line 525 of file i_mif_pool.cpp.

References dbg_NORM, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, mif_CfgRep::LastRev(), log_DBG_m, log_FUNC_m, m_rm, and mif_POOL.

00525                                                                   {
00526     log_FUNC_m(ShowPoolRevs);
00527 
00528     try {
00529         i_MediaPool_t_var mp;
00530         try {
00531             ipc_EXEC_m(
00532                 mp = m_rm->SelectMediaPool(CORBA::string_dup(a_name));
00533             log_DBG_m(dbg_NORM, "MIF: Media pool is configured.");
00534             );
00535         }
00536         catch (ivd_Exception) {
00537             // TODO: RMDB could return specific error for not found
00538             throw ivd_Error(ie_RMDB_NOTFOUND,
00539                 "Pool not configured: " + string(a_name));
00540         }
00541         mif_CfgRep cfgObj(mif_POOL, a_name);
00542         return cfgObj.LastRev();
00543     }
00544     ipc_CATCH_IVD_THROW_CORBA_m;
00545 
00546 }

Here is the call graph for this function:

void i_ManagementInterface_i::ListPools ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 37 of file i_mif_pool.cpp.

References bf_MediaPoolToText(), bf_MPBlockSize, bf_MPKey, bf_MPMaxMediaAge, bf_MPMaxNrReadWrite, bf_MPMediaFamily, bf_MPName, bf_MPNumOfVolumes, bf_MPPartitionName, bf_MPPartUUID, bf_MPSizeOfSysVol, bf_MPSizeOfVolume, bf_MPSysVolLocation, bf_MPType, bf_MPUUID, i_MediaPool_t::blockSize, g_mediaPoolTable, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), log_FUNC_m, m_rm, i_MediaPool_t::maxMediaAge, i_MediaPool_t::maxNrReadWrite, i_MediaPool_t::mediaFamily, i_MediaPool_t::mediaPoolKey, i_MediaPool_t::mediaPoolName, i_MediaPool_t::mediaPoolType, mf_DISK, i_MediaPool_t::numOfVolumes, i_MediaPool_t::partitionUUIDString, i_MediaPool_t::poolUUIDString, i_MediaPool_t::sizeOfSysVol, i_MediaPool_t::sizeOfVolume, svl_NONE, i_MediaPool_t::sysVolLocation, uialign_LEFT, uialign_RIGHT, uires_MEDIAFAMILYTYPE, uires_MEDIAPOOLTYPE, uires_NA, uires_SYSVOLLOCATION, and cmn_BitFlag_t::val.

00038                                                             {
00039     log_FUNC_m(ListPools);
00040 
00041     ui_BitFlag  flags(a_filter);
00042 
00043     try {
00044         i_MediaPoolSeq_t_var poolSeq;
00045         ipc_EXEC_m(poolSeq = m_rm->SelectAllMediaPools(););
00046 
00047         ui_ResultPacker result;
00048 
00049         // write a header
00050         if (poolSeq->length() > 0) {
00051             result.NewRow(true);
00052 
00053             UInt32_t i = 0;
00054             while ( g_mediaPoolTable[i].val != -1 ) {
00055                 if (flags.IsFlagSet(g_mediaPoolTable[i].val)) {
00056                     result.Insert(bf_MediaPoolToText(static_cast<bf_MediaPool_e>(g_mediaPoolTable[i].val)));
00057                 }
00058                 i++;
00059             }
00060         }
00061 
00062         for (UInt32_t i = 0; i < poolSeq->length(); i++) {
00063             i_MediaPool_t & pool = poolSeq[i];
00064 
00065             result.NewRow();
00066 
00067             if (flags.IsFlagSet(bf_MPName))
00068                 result.Insert(pool.mediaPoolName);
00069 
00070             if (flags.IsFlagSet(bf_MPUUID))
00071                 result.Insert(pool.poolUUIDString);
00072 
00073             if (flags.IsFlagSet(bf_MPMediaFamily))
00074                 result.Insert(uires_MEDIAFAMILYTYPE,
00075                               pool.mediaFamily);
00076 
00077             if (flags.IsFlagSet(bf_MPType))
00078                 result.Insert(uires_MEDIAPOOLTYPE,
00079                               static_cast<ivd_PoolType_e>(pool.mediaPoolType));
00080 
00081             if (flags.IsFlagSet(bf_MPPartitionName)) {
00082 
00083                 i_PartSeq_t_var partSeq;
00084                 string partUUID(pool.partitionUUIDString);
00085                 string partName("n/a");
00086                 partSeq = m_rm->SelectAllPartition();
00087                 for (UInt32_t i = 0; i < partSeq->length(); i++) {
00088                     if (partUUID.compare(partSeq[i].partitionUUIDString) == 0) {
00089                         partName = partSeq[i].partitionName;
00090                         break;
00091                     }
00092                 }
00093 
00094                 result.Insert(partName, uialign_LEFT);
00095             }
00096 
00097             if (flags.IsFlagSet(bf_MPPartUUID))
00098                 result.Insert(pool.partitionUUIDString);
00099 
00100             if (flags.IsFlagSet(bf_MPMaxMediaAge))
00101                 result.Insert(pool.maxMediaAge);
00102 
00103             if (flags.IsFlagSet(bf_MPMaxNrReadWrite))
00104                 result.Insert(pool.maxNrReadWrite);
00105 
00106             if (flags.IsFlagSet(bf_MPBlockSize))
00107                 result.Insert(pool.blockSize/1024);
00108 
00109             if (flags.IsFlagSet(bf_MPNumOfVolumes))
00110                 result.Insert(pool.numOfVolumes);
00111 
00112             if (flags.IsFlagSet(bf_MPSizeOfVolume)) {
00113                 if (pool.mediaFamily == mf_DISK) {
00114                     result.Insert(pool.sizeOfVolume);
00115                 }
00116                 else {
00117                     result.Insert(uires_NA,
00118                                   0,
00119                                   uialign_RIGHT);
00120                 }
00121             }
00122 
00123 
00124             if (flags.IsFlagSet(bf_MPSysVolLocation))
00125                 result.Insert(uires_SYSVOLLOCATION,
00126                               pool.sysVolLocation);
00127 
00128             if (flags.IsFlagSet(bf_MPSizeOfSysVol)) {
00129                 if (static_cast<ivd_SysVolLocation_e>(pool.sysVolLocation) ==
00130                     svl_NONE)
00131                     result.Insert(uires_NA,
00132                                    0,
00133                                    uialign_RIGHT);
00134                 else
00135                     result.Insert(pool.sizeOfSysVol);
00136             }
00137 
00138             if (flags.IsFlagSet(bf_MPKey))
00139                 result.Insert(pool.mediaPoolKey);
00140 
00141         } // for
00142         result.SendResults(a_uims);
00143     } ipc_CATCH_IVD_THROW_CORBA_m
00144 
00145 }  // i_ManagementInterface_i::ListPools()

Here is the call graph for this function:

void i_ManagementInterface_i::PoolReorgStat ( i_UIMessageServer_ptr  a_uims  ) 

Definition at line 549 of file i_mif_pool.cpp.

References ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_FUNC_m, m_rm, ui_ResultPacker::NewRow(), rmdb_MEDVOL_REORG_SCANNED, rmdb_SYSTEM_VOLUME, ui_ResultPacker::SendResults(), and uialign_RIGHT.

00549                                                                         {
00550     log_FUNC_m(PoolReorgStat);
00551 
00552     try {
00553         ui_ResultPacker      result;
00554         i_MediumSeq_t_var    allMedia;
00555         i_MediaPoolSeq_t_var allPools;
00556 
00557         ipc_EXEC_m( allPools = m_rm->SelectAllMediaPools(); );
00558         ipc_EXEC_m( allMedia = m_rm->SelectAllMedia(); );
00559 
00560         // write a header
00561         if (allPools->length() > 0) {
00562             result.NewRow(true);
00563             result.Insert("Name");
00564             result.Insert("NumOfMedia");
00565             result.Insert("ValidData[MB]");
00566             result.Insert("Total[MB]");
00567             result.Insert("SlackSpace[%]");
00568         }
00569 
00570         i_MediumVolSeq_t_var medVols;
00571 
00572         for (UInt32_t i = 0; i < allPools->length(); i++) {
00573 
00574             UInt32_t validData(0);
00575             UInt32_t totalData(0);
00576             UInt32_t numOfMedia(0);
00577 
00578             // insert a new row
00579             result.NewRow();
00580             result.Insert(allPools[i].mediaPoolName);
00581 
00582             for (UInt32_t j = 0; j < allMedia->length(); j++) {
00583                 if (strcmp(allPools[i].mediaPoolName, allMedia[j].mediaPoolName)) {
00584                     // media isn't in current pool
00585                     continue;
00586                 }
00587                 numOfMedia++;
00588 
00589                 ipc_EXEC_m(
00590                     medVols =
00591                         m_rm->SelectAllMediumVolByBarcode(allMedia[j].barcode);
00592                 );
00593 
00594                 // calculate valid and total data
00595                 for (UInt32_t k = 0; k < medVols->length(); k++) {
00596 
00597                     if (medVols[k].volType == rmdb_SYSTEM_VOLUME) {
00598                         // skip system volume
00599                         continue;
00600                     }
00601 
00602                     if (medVols[k].status & rmdb_MEDVOL_REORG_SCANNED) {
00603                         validData += medVols[k].validData;
00604                         totalData += medVols[k].totalData;
00605                     } else { // for volumes that are not scanned validData = totalData
00606                         validData += medVols[k].totalData;
00607                         totalData += medVols[k].totalData;
00608                     }
00609                 }
00610             }
00611 
00612             result.Insert(numOfMedia); // NumOfMedia
00613 
00614             // if any media volume scanned
00615             if (totalData > 0) {
00616                 result.Insert(validData);
00617                 result.Insert(totalData);
00618                 UInt32_t slack(0);
00619                 if (totalData != 0) {
00620                     double temp(validData);
00621                     slack = 100 - static_cast<UInt32_t>(((100 * temp)/totalData));
00622                 }
00623                 result.Insert(slack);
00624 
00625             } else {
00626                 result.Insert("n/a", uialign_RIGHT); // validData
00627                 result.Insert("n/a", uialign_RIGHT); // totalData
00628                 result.Insert("n/a", uialign_RIGHT); // slack space
00629             }
00630         }
00631         result.SendResults(a_uims);
00632     } ipc_CATCH_IVD_THROW_CORBA_m
00633 } // i_ManagementInterface_i::PoolReorgStat()

Here is the call graph for this function:

i_MediaPool_t * i_ManagementInterface_i::GetPool ( const char *  a_name  ) 

Definition at line 148 of file i_mif_pool.cpp.

References log_FUNC_A_m, and m_rm.

00148                                                                   {
00149     log_FUNC_A_m(GetPool, "a_name:" << a_name);
00150     return m_rm->SelectMediaPool(a_name);
00151 }

i_MediaPoolSeq_t * i_ManagementInterface_i::GetAllPools (  ) 

Definition at line 154 of file i_mif_pool.cpp.

References log_FUNC_m, and m_rm.

00154                                                        {
00155     log_FUNC_m(GetAllPools);
00156     return m_rm->SelectAllMediaPools();
00157 }

void i_ManagementInterface_i::RemoveMedium ( const char *  a_barcode,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 406 of file i_mif_medium.cpp.

References dbg_LOW, dbg_NORM, ivd_BaseException::GetError(), ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, m_rm, mvs_REORG_RECYCLED, ipc_Corba::ResolveLA(), rmdb_DRIVE_IN_USE, rmdb_MEDIUM_IN_USE, rmdb_MEDVOL_EMPTY, and rmdb_SLOT_FREE.

00406                                                                                               {
00407     log_FUNC_m(RemoveMedium);
00408 
00409     try {
00410         i_Medium_t_var medium;
00411         ostringstream  msg;
00412     
00413         try {
00414             ipc_EXEC_m(medium = m_rm->SelectMedium(a_barcode);)
00415         } catch (ivd_Exception &e) {
00416             log_DBG_m(dbg_NORM, e);
00417             if (e.GetError() == ie_RMDB_NOTFOUND) {
00418                 msg << "Medium does not exist. Remove failed";
00419                 log_DBG_m(dbg_LOW,msg.str());
00420                 a_uims->DisplayError(msg.str().c_str());
00421                 return;            
00422             }
00423             else {
00424                 throw;
00425             }
00426         }
00427         if (medium->status & rmdb_MEDIUM_IN_USE) {
00428             msg << "Medium is currently in use. Remove failed";
00429             log_DBG_m(dbg_LOW,msg.str());
00430             a_uims->DisplayError(msg.str().c_str());
00431             return;
00432         }
00433 
00434         try {
00435             string drvName(medium->driveName);
00436             string libName(medium->libraryName);
00437 
00438             ipc_EXEC_m(
00439         
00440                 if ( !drvName.empty() && !libName.empty() ) {
00441 
00442                     i_Drive_t_var drv = m_rm->SelectDrive(drvName.c_str());
00443                     if (drv->status & rmdb_DRIVE_IN_USE) {
00444                         msg << "Drive is currently in use. Remove failed";
00445                         log_DBG_m(dbg_LOW,msg.str());
00446                         a_uims->DisplayError(msg.str().c_str());
00447                         return;
00448                     }
00449                     i_Library_t_var lib = m_rm->SelectLibrary(libName.c_str());
00450 
00451                     CORBA::Object_var objLA = ipc_Corba::ResolveLA(
00452                                                         string(lib->host), 
00453                                                         libName);
00454                     i_LibraryAgent_var iLA = i_LibraryAgent::_narrow(objLA);
00455         
00456                     log_DBG_m(dbg_LOW,"LA unload");
00457                     iLA->Unload(
00458                             drv->driveIndex,
00459                             medium->slotAddr,
00460                             medium->barcode,
00461                             // This job ID is used to distinguish
00462                             // from manual operation by using ivd_la
00463                             1
00464                          );
00465                 }
00466             )
00467         } catch (ivd_Exception &e) {
00468             // just log that unload failed
00469             // continue removing medium
00470             log_ERR_m("Unload failed while removing medium:" << a_barcode << endl << e);
00471         }
00472 
00473         i_MediumVolSeq_t_var medVolSeq;
00474         ipc_EXEC_m(medVolSeq = m_rm->SelectAllMediumVolByBarcode(a_barcode);)
00475 
00476         //
00477         // check if volumes on medium can be deleted (=> are empty).
00478         for (UInt32_t i = 0; i < medVolSeq->length(); i++) {
00479             if ( (medVolSeq[i].volUsed != rmdb_MEDVOL_EMPTY) && 
00480                  ((medVolSeq[i].status & mvs_REORG_RECYCLED) != mvs_REORG_RECYCLED)) {
00481                 msg << "Medium contains data. Remove failed";
00482                 log_DBG_m(dbg_LOW,msg.str());
00483                 ipc_EXEC_m(a_uims->DisplayWarning(msg.str().c_str());)
00484                 return;            
00485             }
00486         }
00487 
00488         // set CurrentMediumVol parameter in medium record to NULL.
00489         medium->currentVolume = 0;
00490         ipc_EXEC_m(m_rm->UpdateMedium(medium);)
00491 
00492         // delete volumes.
00493         for (UInt32_t i = 0; i < medVolSeq->length(); i++) {
00494             m_rm->RemoveMediumVol(a_barcode, medVolSeq[i].medVolNr);        
00495         }
00496 
00497         // delete medium.
00498         m_rm->RemoveMedium(a_barcode);
00499 
00500         // set slot status to free
00501         try {
00502             string slotAddr(medium->slotAddr);
00503 
00504             if (!slotAddr.empty()) {
00505                 ipc_EXEC_m(
00506                     i_Slot_t_var slot(m_rm->SelectSlot(
00507                                                 medium->slotAddr, 
00508                                                 medium->libraryName, 
00509                                                 medium->slotType) );
00510                     slot->status = rmdb_SLOT_FREE;
00511                     m_rm->UpdateSlot(slot);
00512                 );
00513             };
00514         } catch (ivd_Exception &e) {
00515             log_WRN_m("Setting slot status to free failed." << e);
00516         }
00517 
00518         msg << "Medium " << a_barcode << " removed.";
00519         log_DBG_m(dbg_LOW, msg.str());
00520         a_uims->DisplayMessage(msg.str().c_str());
00521     
00522         log_WriteEvent(msg.str(), "MEDIUM", 0, string(a_barcode));
00523 
00524     }
00525     ipc_CATCH_IVD_THROW_CORBA_m
00526 } // i_ManagementInterface_i::RemoveMedium()

Here is the call graph for this function:

void i_ManagementInterface_i::AddMedium ( const char *  a_barcode  ) 

Definition at line 644 of file i_mif_medium.cpp.

References i_Medium_t::barcode, i_Medium_t::blockSize, i_Medium_t::currentVolume, dbg_NORM, i_Medium_t::diskSubsysName, i_Medium_t::driveName, i_Medium_t::idxOfSysVol, ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, ivd_Error, i_Medium_t::libraryName, i_Medium_t::location, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, i_Medium_t::mediaPoolName, i_Medium_t::mediumSerialNo, i_Medium_t::mediumType, i_Medium_t::numOfVolumes, i_Medium_t::partitionName, rmdb_INIT_MEDIUM_STATUS, i_Medium_t::sizeOfSysVol, i_Medium_t::slotAddr, i_Medium_t::slotType, and i_Medium_t::status.

00644                                                              {
00645     log_FUNC_m(AddMedium);
00646     try {
00647         i_Medium_t mediumI;
00648 
00649         string barcode(a_barcode);
00650         if ( barcode.find_first_of("/") != string::npos)
00651             throw ivd_Error(ie_PRECONDITION, "Barcode may not contain \"/\".");
00652 
00653         // mediumI.mediumKey -> generated!
00654         mediumI.mediaPoolName   = CORBA::string_dup(ipc_nilStr);        // -> added by ivdpool -A <mediaPool> -B <barcode>
00655         mediumI.libraryName     = CORBA::string_dup(ipc_nilStr);        // -> added by ivdlibrary --update-inventory
00656         mediumI.slotAddr        = CORBA::string_dup(ipc_nilStr);        // -> added by ivdlibrary --update-inventory
00657         mediumI.slotType        = 0;                                    // -> added by ivdlibrary --update-inventory
00658         mediumI.diskSubsysName  = CORBA::string_dup(ipc_nilStr);        // -> currently not used
00659         mediumI.driveName       = CORBA::string_dup(ipc_nilStr);        // ->  ?????
00660         mediumI.barcode         = CORBA::string_dup(a_barcode);
00661         mediumI.status          = rmdb_INIT_MEDIUM_STATUS;
00662         mediumI.location        = CORBA::string_dup(ipc_nilStr);        // [255] -> currently not used
00663         mediumI.mediumType      = 0;                                    // -> 
00664         mediumI.mediumSerialNo  = CORBA::string_dup(ipc_nilStr);    // -> added by ivdlibrary --update-inventory ?
00665         mediumI.blockSize       = 0;
00666         mediumI.numOfVolumes    = 0;
00667         mediumI.idxOfSysVol     = 0;
00668         mediumI.sizeOfSysVol    = 0;
00669         mediumI.currentVolume   = -1;
00670         mediumI.partitionName   = CORBA::string_dup(ipc_nilStr);
00671 
00672         //
00673         // add medium record to RMDB
00674         ipc_EXEC_m(
00675             m_rm->AddMedium(mediumI);
00676         log_DBG_m(dbg_NORM,
00677             "MIF: Medium with barcode " << a_barcode << " added into RMDB.");
00678 
00679         ostringstream eventText;
00680         eventText << "Added.";
00681 
00682         log_WriteEvent(eventText.str(), "MEDIUM", 0, a_barcode);
00683         );
00684     }
00685     ipc_CATCH_IVD_THROW_CORBA_m
00686 } // i_ManagementInterface_i::AddMedium()

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::FormatAndInitMedium ( i_UIMessageServer_ptr  a_uims,
CORBA::Boolean  a_doFormat,
CORBA::Boolean  a_doInit,
CORBA::Boolean  a_forced,
const char *  a_barcode,
const i_VolNumList_t a_volumes 
)

Definition at line 529 of file i_mif_medium.cpp.

References mif_JobManager::CreateFormatAndInitJob(), i_Job_i::GetJobId(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_jobMgr, and NULL.

00532                                      {
00533 
00534     log_FUNC_m(FormatAndInitMedium);
00535 
00536     try {
00537         i_AdminJob_i * iJob = m_jobMgr.CreateFormatAndInitJob(
00538                                             a_uims, 
00539                                             a_doFormat, 
00540                                             a_doInit, 
00541                                             a_forced, 
00542                                             a_barcode, 
00543                                             a_volumes );
00544 
00545         if (iJob != NULL) {
00546             return iJob->GetJobId();
00547         }
00548         else {
00549             return 0;
00550         }
00551     }    
00552     ipc_CATCH_IVD_THROW_CORBA_m
00553 }

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::RecreateFriAndMic ( i_UIMessageServer_ptr  a_uims,
CORBA::Boolean  a_fri,
CORBA::Boolean  a_mic,
CORBA::Boolean  a_forced,
const char *  a_barcode,
const i_VolNumList_t a_volumes,
CORBA::Boolean  a_into,
const char *  a_intoPath 
)

Definition at line 556 of file i_mif_medium.cpp.

References mif_JobManager::CreateRecreateFriAndMicJob(), i_Job_i::GetJobId(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_jobMgr, and NULL.

00564                                                                                {
00565 
00566     log_FUNC_m(RecreateFriAndMic);
00567     
00568     try {
00569         i_AdminJob_i * iJob = m_jobMgr.CreateRecreateFriAndMicJob(
00570                                             a_uims, 
00571                                             a_fri, 
00572                                             a_mic, 
00573                                             a_forced, 
00574                                             a_barcode, 
00575                                             a_volumes,
00576                                             a_into,
00577                                             a_intoPath );
00578 
00579         if (iJob != NULL) {
00580             return iJob->GetJobId();
00581         }
00582         else {
00583             return 0;
00584         }
00585     }    
00586     ipc_CATCH_IVD_THROW_CORBA_m;
00587 }

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::CloseVolume ( i_UIMessageServer_ptr  a_uims,
const char *  a_barcode,
const i_VolNumList_t a_volumes 
)

Definition at line 607 of file i_mif_medium.cpp.

References mif_JobManager::CreateCloseVolumeJob(), i_Job_i::GetJobId(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_jobMgr, and NULL.

00610                                                                          {
00611     log_FUNC_m(CloseVolume);
00612     try {
00613         i_AdminJob_i * iJob = m_jobMgr.CreateCloseVolumeJob(a_uims, 
00614                                                             a_barcode, 
00615                                                             a_volumes );
00616 
00617         if (iJob != NULL) {
00618             return iJob->GetJobId(); 
00619         }
00620         else {
00621             return 0;
00622         }
00623     }    
00624     ipc_CATCH_IVD_THROW_CORBA_m
00625 }

Here is the call graph for this function:

i_Job_ptr i_ManagementInterface_i::Backup ( const char *  a_barcode  ) 

Definition at line 471 of file i_mif_impl.cpp.

References mif_JobManager::CreateBackupJob(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and m_jobMgr.

00471                                                                {
00472     log_FUNC_m(Backup);
00473 
00474     try {
00475         return m_jobMgr.CreateBackupJob(a_barcode);
00476     }
00477     ipc_CATCH_IVD_THROW_CORBA_m
00478 
00479     return i_Job::_nil();
00480 }

Here is the call graph for this function:

void i_ManagementInterface_i::ListMedia ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 190 of file i_mif_medium.cpp.

References bf_MediumToText(), g_mediumTable, GetMediumInfo(), ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), log_FUNC_m, m_rm, ui_ResultPacker::NewRow(), ui_ResultPacker::SendResults(), and cmn_BitFlag_t::val.

00191                                                             {
00192     log_FUNC_m(ListMedia);
00193 
00194     ui_BitFlag  flags(a_filter);
00195 
00196     try {
00197         ui_ResultPacker result;
00198 
00199         i_MediumSeq_t_var medList;
00200         ipc_EXEC_m(medList = m_rm->SelectAllMedia();)
00201         
00202         // write a header
00203         if (medList->length() > 0) {
00204             result.NewRow(true);
00205 
00206             UInt32_t i = 0;
00207             while ( g_mediumTable[i].val != -1 ) {
00208                 if (flags.IsFlagSet(g_mediumTable[i].val)) {
00209                     result.Insert(bf_MediumToText(static_cast<bf_Medium_e>(g_mediumTable[i].val)));
00210                 }
00211                 i++;
00212             }
00213         }
00214 
00215         for (UInt32_t i = 0; i < medList->length(); ++i) {
00216             i_Medium_t& med = medList[i];
00217             result.NewRow();
00218 
00219             GetMediumInfo (med, result, flags);
00220         }
00221         result.SendResults(a_uims);
00222 
00223     } ipc_CATCH_IVD_THROW_CORBA_m
00224 } // ::ListMedia()

Here is the call graph for this function:

void i_ManagementInterface_i::ListSingleMedium ( const char *  a_barcode,
i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 226 of file i_mif_medium.cpp.

References bf_MediumToText(), dbg_LOW, dbg_NORM, g_mediumTable, ivd_BaseException::GetError(), GetMediumInfo(), ie_RMDB_NOTFOUND, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), log_DBG_m, log_FUNC_m, m_rm, ui_ResultPacker::NewRow(), ui_ResultPacker::SendResults(), and cmn_BitFlag_t::val.

00228                                                             {
00229     log_FUNC_m(ListSingleMedium);
00230 
00231     ui_BitFlag flags(a_filter);
00232 
00233     try {
00234         ui_ResultPacker result;
00235         i_Medium_t* medium;
00236         ostringstream  msg;
00237     
00238         try {
00239             ipc_EXEC_m(medium = m_rm->SelectMedium(a_barcode);)
00240         } catch (ivd_Exception &e) {
00241             log_DBG_m(dbg_NORM, e);
00242             if (e.GetError() == ie_RMDB_NOTFOUND) {
00243                 msg << "Medium does not exist.";
00244                 log_DBG_m(dbg_LOW,msg.str());
00245                 a_uims->DisplayError(msg.str().c_str());
00246                 return;            
00247             }
00248             else {
00249                 throw;
00250             }
00251         }
00252         // write a header
00253         result.NewRow(true);
00254 
00255         UInt32_t i = 0;
00256         while ( g_mediumTable[i].val != -1 ) {
00257             if (flags.IsFlagSet(g_mediumTable[i].val)) {
00258                 result.Insert(bf_MediumToText(static_cast<bf_Medium_e>(g_mediumTable[i].val)));
00259             }
00260             i++;
00261         }
00262             
00263         result.NewRow();
00264 
00265         GetMediumInfo (*medium, result, flags);
00266         result.SendResults(a_uims);
00267         
00268     } ipc_CATCH_IVD_THROW_CORBA_m
00269 } // ::ListSingleMedium()

Here is the call graph for this function:

void i_ManagementInterface_i::MarkMediumUnusable ( const char *  a_barcode  ) 

Definition at line 689 of file i_mif_medium.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), m_rm, rmdb_MEDIUM_UNRELIABLE, and rmdb_MEDIUM_UNUSABLE.

00689                                                                       {
00690     log_FUNC_m(MarkMediumUnusable);
00691 
00692     try {
00693         UInt32_t status(0);
00694         status = rmdb_MEDIUM_UNUSABLE;
00695         m_rm->MediumStatusSet(a_barcode, status);
00696         
00697         UInt32_t statusClear(0);
00698         statusClear = rmdb_MEDIUM_UNRELIABLE;
00699         m_rm->MediumStatusClear(a_barcode, statusClear);
00700 
00701         ostringstream msg;
00702         msg << "Medium marked unusable." ;
00703         log_WriteEvent(msg.str(), "MEDIUM", 0, string(a_barcode));
00704     } 
00705     ipc_CATCH_IVD_THROW_CORBA_m
00706 }

Here is the call graph for this function:

void i_ManagementInterface_i::MarkMediumUnreliable ( const char *  a_barcode  ) 

Definition at line 709 of file i_mif_medium.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), m_rm, rmdb_MEDIUM_UNRELIABLE, and rmdb_MEDIUM_UNUSABLE.

00709                                                                         {
00710     log_FUNC_m(MarkMediumUnreliable);
00711 
00712     try {
00713         UInt32_t status(0);
00714         status = rmdb_MEDIUM_UNRELIABLE;
00715 
00716         m_rm->MediumStatusSet(a_barcode, status);
00717 
00718         UInt32_t statusClear(0);
00719         statusClear = rmdb_MEDIUM_UNUSABLE;
00720         m_rm->MediumStatusClear(a_barcode, statusClear);
00721 
00722         ostringstream msg;
00723         msg << "Medium marked unreliable." ;
00724         log_WriteEvent(msg.str(), "MEDIUM", 0, string(a_barcode));
00725     } 
00726     ipc_CATCH_IVD_THROW_CORBA_m
00727 }

Here is the call graph for this function:

void i_ManagementInterface_i::MarkMediumGood ( const char *  a_barcode  ) 

Definition at line 730 of file i_mif_medium.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), m_rm, rmdb_MEDIUM_UNRELIABLE, and rmdb_MEDIUM_UNUSABLE.

00730                                                                   {
00731     log_FUNC_m(MarkMediumGood);
00732 
00733     try {
00734         UInt32_t status(0);
00735         status = rmdb_MEDIUM_UNUSABLE | rmdb_MEDIUM_UNRELIABLE;
00736         m_rm->MediumStatusClear(a_barcode, status);
00737 
00738         ostringstream msg;
00739         msg << "Medium marked good." ;
00740         log_WriteEvent(msg.str(), "MEDIUM", 0, string(a_barcode));
00741     } 
00742     ipc_CATCH_IVD_THROW_CORBA_m
00743 }

Here is the call graph for this function:

void i_ManagementInterface_i::DuplicateMedium ( i_UIMessageServer_ptr  a_uims,
const char *  a_sourceBarCode,
const char *  a_targetBarCode,
CORBA::Boolean  a_forced 
)

Definition at line 590 of file i_mif_medium.cpp.

References mif_JobManager::CreateDuplMedJob(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and m_jobMgr.

00593                                                                      {
00594     log_FUNC_m(DuplicateMedium);
00595     try {
00596         m_jobMgr.CreateDuplMedJob(
00597             a_uims, 
00598             a_sourceBarCode,
00599             a_targetBarCode,
00600             a_forced);
00601 
00602     }    
00603     ipc_CATCH_IVD_THROW_CORBA_m;
00604 }

Here is the call graph for this function:

void i_ManagementInterface_i::AddMediumToPool ( const char *  a_barcode,
const char *  a_poolName,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 272 of file i_mif_medium.cpp.

References i_Medium_t::barcode, i_Medium_t::blockSize, i_Medium_t::currentVolume, dbg_LOW, dbg_NORM, cmn_Global::dirs, i_Medium_t::diskSubsysName, ivd_Directories::dm, i_Medium_t::driveName, evt_ERROR, g_cmn, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), i_Medium_t::idxOfSysVol, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, i_Medium_t::libraryName, i_Medium_t::location, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_rm, i_Medium_t::mediaPoolName, i_Medium_t::mediumSerialNo, i_Medium_t::mediumType, mf_DISK, mf_UNKNOWN, mt_DISK, i_Medium_t::numOfVolumes, i_Medium_t::partitionName, i_Medium_t::sizeOfSysVol, i_Medium_t::slotAddr, i_Medium_t::slotType, and i_Medium_t::status.

00274                                                                               {
00275     log_FUNC_m(AddMediumToPool);
00276     try {
00277         i_Medium_t_var medium;
00278     
00279         ostringstream baseMsg;
00280         baseMsg << "Medium " << a_barcode;
00281         ostringstream msg;
00282         bool mediumInRMDB(false);
00283 
00284         // select medium from RMDB
00285         try {
00286             ipc_EXEC_m(
00287                 medium = m_rm->SelectMedium(CORBA::string_dup(a_barcode));
00288                 log_DBG_m(dbg_NORM, baseMsg.str() << " found.");
00289                 mediumInRMDB = true;
00290             )
00291         } catch (ivd_Exception &e) {
00292             log_DBG_m(dbg_NORM, e);
00293             if (e.GetError() == ie_RMDB_NOTFOUND) {
00294                 mediumInRMDB = false;
00295                 // continue
00296             } else 
00297                 throw;
00298         }
00299 
00300         // check if medium is assigned to a pool
00301         if (mediumInRMDB) {
00302             string mediaPoolName;
00303             mediaPoolName = medium->mediaPoolName;
00304             if (mediaPoolName.empty()) {
00305                 log_DBG_m(dbg_NORM, "MIF: Medium is currently not assigned to any media pool.");
00306             }
00307             else {
00308                 msg << baseMsg.str() << " already assigned to pool " 
00309                     << medium->mediaPoolName << ".";
00310                 log_DBG_m(dbg_LOW,msg.str());
00311                 ipc_EXEC_m(a_uims->DisplayError(msg.str().c_str());)
00312                 msg.str("");
00313                 return;
00314             }
00315         }
00316 
00317         i_MediaPool_t_var mediaPool;
00318         // select pool from RMDB
00319         try {
00320             ipc_EXEC_m(
00321                 mediaPool = m_rm->SelectMediaPool(CORBA::string_dup(a_poolName));
00322                 log_DBG_m(dbg_NORM, "MediaPool " << a_poolName << " found.");
00323             )
00324         } catch (ivd_Exception &e) {
00325             log_DBG_m(dbg_NORM, e);
00326             if (e.GetError() == ie_RMDB_NOTFOUND) {
00327                 msg << "Pool does not exist. Add to pool failed";
00328                 log_DBG_m(dbg_LOW,msg.str());
00329                 a_uims->DisplayError(msg.str().c_str());
00330                 return;            
00331             } else 
00332                 throw;
00333         }
00334         
00335         i_Medium_t med;
00336         if (mediumInRMDB) {    
00337             med = medium;
00338         } else {
00339             med.barcode         = CORBA::string_dup(a_barcode);
00340             med.currentVolume   = 0;
00341             med.diskSubsysName  = CORBA::string_dup(ipc_nilStr);
00342             med.driveName       = CORBA::string_dup(ipc_nilStr);
00343             med.idxOfSysVol     = 0;
00344             med.libraryName     = CORBA::string_dup(ipc_nilStr);
00345             med.location        = CORBA::string_dup(ipc_nilStr);
00346             med.mediumSerialNo  = CORBA::string_dup(ipc_nilStr);
00347             med.numOfVolumes    = 0;
00348             med.sizeOfSysVol    = 0;
00349             med.slotAddr        = CORBA::string_dup(ipc_nilStr);
00350             med.slotType        = 0;
00351             med.status          = 0;
00352             med.partitionName   = CORBA::string_dup(ipc_nilStr);
00353         }
00354 
00355         if (mediaPool->mediaFamily == mf_DISK) {
00356             med.mediumType = mt_DISK;
00357             log_DBG_m(dbg_NORM, "Disk Medium added to pool.");
00358 
00359             string dmBarcode(med.barcode);
00360             cmn_Path dmPath( g_cmn.dirs.dm + dmBarcode );
00361 #if TGT_OS_windows
00362             if (dmBarcode.substr(0, 2) == string("\\\\")) {
00363                 dmPath = dmBarcode;
00364             }
00365 #endif
00366 
00367 #if TGT_OS_linux
00368     #warning "Check if path exists."
00369 #elif TGT_OS_windows
00370     #pragma message ("WARNING: Check if path exists.")
00371 #endif
00372             log_DBG_m(dbg_NORM, "Disk medium directory should be: " << dmPath);
00373 
00374         } else {
00375             med.mediumType = mf_UNKNOWN;
00376             log_DBG_m(dbg_NORM, "Unknown Medium added to pool.");
00377         }
00378 
00379         med.mediaPoolName = mediaPool->mediaPoolName;
00380         med.blockSize = mediaPool->blockSize;
00381         try {
00382             ipc_EXEC_m(
00383                 if (mediumInRMDB)
00384                     m_rm->UpdateMedium(med);
00385                 else
00386                     m_rm->AddMedium(med);
00387 
00388                 msg << baseMsg.str() << " added to pool " << med.mediaPoolName 
00389                     << ".";
00390                 log_DBG_m(dbg_LOW,msg.str().c_str());
00391                 a_uims->DisplayMessage(msg.str().c_str());
00392                 log_WriteEvent(msg.str(), "MEDIUM", 0, string(med.barcode));
00393             )
00394         } catch (ivd_Exception &e) {
00395             msg << baseMsg.str() << " adding to pool " << 
00396                     med.mediaPoolName << " failed (" << e.GetFriendly() << ").";
00397             log_DBG_m(dbg_LOW,msg.str());
00398             a_uims->DisplayError(msg.str().c_str());
00399             log_WriteEvent(evt_ERROR, msg.str(), "MEDIUM", 0, string(med.barcode));
00400         }
00401     }
00402     ipc_CATCH_IVD_THROW_CORBA_m
00403 } // i_ManagementInterface_i::AddMediumToPool()

Here is the call graph for this function:

i_Medium_t * i_ManagementInterface_i::GetMedium ( const char *  a_barcode  ) 

Definition at line 628 of file i_mif_medium.cpp.

References log_FUNC_A_m, and m_rm.

Referenced by GetMediumByKey().

00628                                                                     {
00629     log_FUNC_A_m(GetMedium, "a_barcode:" << a_barcode);
00630     return m_rm->SelectMedium(a_barcode);
00631 }

Here is the caller graph for this function:

i_Medium_t * i_ManagementInterface_i::GetMediumByKey ( i_DBKey_t  a_mediumKey  ) 

Definition at line 633 of file i_mif_medium.cpp.

References GetMedium(), log_FUNC_A_m, and m_rm.

00633                                                                          {
00634     log_FUNC_A_m(GetMedium, "a_mediumKey:" << a_mediumKey);
00635     return m_rm->SelectMediumByKey(a_mediumKey);
00636 }

Here is the call graph for this function:

i_MediumSeq_t * i_ManagementInterface_i::GetAllMedia (  ) 

Definition at line 638 of file i_mif_medium.cpp.

References log_FUNC_m, and m_rm.

00638                                                     {
00639     log_FUNC_m(GetAllMedia);
00640     return m_rm->SelectAllMedia();
00641 }

void i_ManagementInterface_i::ListMediumVolumes ( const char *  a_barcode,
i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 31 of file i_mif_mediumvol.cpp.

References bf_MediaVolToText(), bf_MVAccessNr, bf_MVAccessTime, bf_MVAvailable, bf_MVBarcode, bf_MVInitTime, bf_MVLastVerification, bf_MVNr, bf_MVOwriteNr, bf_MVOwriteTime, bf_MVSize, bf_MVStatus, bf_MVTotalData, bf_MVType, bf_MVUsed, bf_MVUUID, bf_MVValidData, bf_MVWriteNr, bf_MVWriteTime, cmn_Time::c_Time2YMDhms(), dbg_DETAIL, g_mediaVolTable, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), log_DBG_m, log_FUNC_m, ipc_Log::LogMediumVol(), m_rm, ui_ResultPacker::NewRow(), rmdb_MEDVOL_FULL, ui_ResultPacker::SendResults(), uires_VOLTYPE, uires_VOLUMESTATUS, and cmn_BitFlag_t::val.

00033                                                                     {
00034     log_FUNC_m(ListMediumVolumes);
00035 
00036     ui_BitFlag  flags(a_filter);
00037 
00038     try {
00039         ui_ResultPacker result;
00040 
00041         i_MediumVolSeq_t_var medVolList;
00042         ipc_EXEC_m(
00043             if (string(a_barcode).empty()) {
00044                 medVolList = m_rm->SelectAllMediumVol();
00045             } else {
00046                 medVolList = m_rm->SelectAllMediumVolByBarcode(a_barcode);
00047             }
00048         )
00049 
00050         if (medVolList->length() == 0){
00051             ostringstream msg;
00052             
00053             if (string(a_barcode).empty()) {
00054                 msg << "No initialized volumes found.";
00055             } else {
00056                 msg << "No initialized volumes found for medium " << a_barcode << ".";
00057             }
00058             
00059             a_uims->DisplayError(msg.str().c_str());
00060             return;
00061         }
00062 
00063         // write a header
00064         if (medVolList->length() > 0) {
00065             
00066             result.NewRow(true);
00067 
00068             UInt32_t i = 0;
00069             while ( g_mediaVolTable[i].val != -1 ) {
00070                 if (flags.IsFlagSet(g_mediaVolTable[i].val)) {
00071                     result.Insert(bf_MediaVolToText(static_cast<bf_MediaVol_e>(g_mediaVolTable[i].val)));
00072                 }
00073                 i++;
00074             }
00075         }
00076 
00077         for (UInt32_t i = 0; i < medVolList->length(); i++) {
00078             log_DBG_m(dbg_DETAIL, "Volume: " << 
00079                 ipc_Log::LogMediumVol(medVolList[i]));
00080             result.NewRow();
00081 
00082             if (flags.IsFlagSet(bf_MVBarcode)) {
00083                 result.Insert(medVolList[i].mediumBarcode);
00084             }
00085 
00086             if (flags.IsFlagSet(bf_MVNr)) {
00087                 result.Insert(medVolList[i].medVolNr);
00088             }
00089 
00090             if (flags.IsFlagSet(bf_MVUUID)) {
00091                 result.Insert(medVolList[i].medVolId);
00092             }
00093 
00094             if (flags.IsFlagSet(bf_MVType)) {
00095                 result.Insert(uires_VOLTYPE,
00096                               medVolList[i].volType);
00097             }
00098 
00099             if (flags.IsFlagSet(bf_MVSize)) {
00100                 result.Insert(medVolList[i].volSize);
00101             }
00102 
00103             if (flags.IsFlagSet(bf_MVAvailable)) {
00104                 Int32_t avail(0);
00105 
00106                 if (!(medVolList[i].status & rmdb_MEDVOL_FULL)) {
00107                     avail = (medVolList[i].volSize * (100L - medVolList[i].volUsed)) / 100;
00108                 }
00109 
00110                 result.Insert(avail);
00111             }
00112 
00113             if (flags.IsFlagSet(bf_MVUsed)) {
00114                 result.Insert(medVolList[i].volUsed);
00115             }
00116 
00117             if (flags.IsFlagSet(bf_MVStatus)) {
00118                 result.Insert(uires_VOLUMESTATUS, medVolList[i].status);
00119             }
00120 
00121             if (flags.IsFlagSet(bf_MVAccessNr)) {
00122                 result.Insert(medVolList[i].accessNr);
00123             }
00124 
00125             if (flags.IsFlagSet(bf_MVWriteNr)) {
00126                 result.Insert(medVolList[i].writeNr);
00127             }
00128 
00129             if (flags.IsFlagSet(bf_MVOwriteNr)) {
00130                 result.Insert(medVolList[i].owriteNr);
00131             }
00132 
00133             if (flags.IsFlagSet(bf_MVInitTime)) {
00134                 cmn_Time timeInfo(medVolList[i].initTime);
00135 
00136                 result.Insert(timeInfo.c_Time2YMDhms());
00137             }
00138 
00139             if (flags.IsFlagSet(bf_MVAccessTime)) {
00140                 cmn_Time timeInfo(medVolList[i].accessTime);
00141 
00142                 result.Insert(timeInfo.c_Time2YMDhms());
00143             }
00144 
00145             if (flags.IsFlagSet(bf_MVWriteTime)) {
00146                 cmn_Time timeInfo(medVolList[i].writeTime);
00147 
00148                 result.Insert(timeInfo.c_Time2YMDhms());
00149             }
00150 
00151             if (flags.IsFlagSet(bf_MVOwriteTime)) {
00152                 cmn_Time timeInfo(medVolList[i].owriteTime);
00153 
00154                 result.Insert(timeInfo.c_Time2YMDhms());
00155             }
00156 
00157             if (flags.IsFlagSet(bf_MVLastVerification)) {
00158                 cmn_Time timeInfo(medVolList[i].lastVerification);
00159 
00160                 result.Insert(timeInfo.c_Time2YMDhms());
00161             }
00162             
00163             if (flags.IsFlagSet(bf_MVValidData)) {
00164                 result.Insert(medVolList[i].validData);
00165             }
00166             
00167             if (flags.IsFlagSet(bf_MVTotalData)) {
00168                 result.Insert(medVolList[i].totalData);
00169             }
00170         } // for (UInt32_t i = 0; ...)
00171 
00172         result.SendResults(a_uims);
00173 
00174     } ipc_CATCH_IVD_THROW_CORBA_m
00175 } // i_ManagementInterface_i::ListMediumVolumes()

Here is the call graph for this function:

i_MediumVol_t * i_ManagementInterface_i::GetMediumVolume ( const char *  a_barcode,
CORBA::Long  a_volNum 
)

Definition at line 178 of file i_mif_mediumvol.cpp.

References log_FUNC_A_m, and m_rm.

Referenced by GetMediumVolumeByUUID().

00180                                                                     {
00181     log_FUNC_A_m(GetMediumVolume, "a_barcode:" << a_barcode <<
00182                                   " a_volNum:" << a_volNum);
00183     return m_rm->SelectMediumVol(a_barcode, a_volNum);
00184 }

Here is the caller graph for this function:

i_MediumVol_t * i_ManagementInterface_i::GetMediumVolumeByUUID ( const char *  a_uuid  ) 

Definition at line 187 of file i_mif_mediumvol.cpp.

References GetMediumVolume(), log_FUNC_A_m, and m_rm.

00187                                                                                 {
00188 
00189     log_FUNC_A_m(GetMediumVolume, "a_uuid:" << a_uuid);
00190     return m_rm->SelectMediumVolByUUID(a_uuid);
00191 }

Here is the call graph for this function:

string i_ManagementInterface_i::WaitingForResStatus ( i_JobParams_var &  a_jobParam,
i_Resource_t a_jobResource,
UInt32_t  a_copyNum 
)

Definition at line 42 of file i_mif_job.cpp.

References i_Resource_t::barcode, dbg_NORM, i_MEDIUM_BUSY, i_MEDIUM_NOT_AVAILABLE, jt_ADMIN, jt_BACKUP, jt_MIGRATION, jt_RECALL, jt_REORG, log_DBG_m, log_FUNC_m, i_Resource_t::poolName, ipc_Log::ResourceBusy(), and i_Resource_t::resourceBusyStatus.

Referenced by ListJob(), and ListJobs().

00042                                                                                                                                {
00043     log_FUNC_m(WaitingForResStatus);
00044     ostringstream jobStatusMsg;
00045     jobStatusMsg << ipc_Log::ResourceBusy(a_jobResource.resourceBusyStatus);
00046     
00047     if (a_jobResource.resourceBusyStatus == i_MEDIUM_BUSY ||
00048         a_jobResource.resourceBusyStatus == i_MEDIUM_NOT_AVAILABLE){
00049         
00050         jobStatusMsg << " <";
00051         
00052         if ((a_jobParam->jobType == jt_MIGRATION) ||
00053             ((a_copyNum > 0) && (a_jobParam->jobType == jt_REORG)) ||
00054              a_jobParam->jobType == jt_BACKUP) {
00055             //waiting for medium <pool: pool1>
00056             jobStatusMsg << "pool: " << 
00057             a_jobResource.poolName << ">";
00058              
00059         } else if ( a_jobParam->jobType == jt_RECALL || 
00060                     a_jobParam->jobType == jt_ADMIN   ){
00061             //waiting for medium <bc: 000123>
00062             jobStatusMsg << "bc: " << 
00063             a_jobResource.barcode << ">";
00064         }
00065     } 
00066     log_DBG_m(dbg_NORM, jobStatusMsg.str());
00067     return jobStatusMsg.str();
00068 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_ManagementInterface_i::JobInfo ( const char *  a_partName,
i_BitFlag_t  a_jobTypeMask,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 875 of file i_mif_job.cpp.

References mif_PartMgr::GetAllPart(), ui_ResultPacker::GetUIResults(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, jt_ADMIN, ListJobs(), log_ERR_m, log_FUNC_m, m_partMgr, mps_Online, and ui_ResultPacker::SendResults().

00877                                   {
00878     
00879     log_FUNC_m(JobInfo);
00880 
00881     try {
00882         bool found(false);
00883     
00884         i_UIMessageServer_var ui = i_UIMessageServer::_duplicate(a_uims);
00885         string partName(a_partName);
00886         ui_ResultPacker uires;
00887         if (partName.empty()){
00888             vector <mif_PartEntry> allPart = m_partMgr.GetAllPart();
00889         
00890             for (UInt32_t i = 0 ; i < allPart.size(); i++ ) {
00891                 if (allPart[i].m_partStatus != mps_Online) 
00892                     continue; // PM not running -> no jobs
00893                 try {
00894                     ipc_EXEC_m(
00895                         ListJobs(   allPart[i].m_partName, 
00896                                     a_jobTypeMask, 
00897                                     uires, 
00898                                     !found);
00899                     )
00900                 }
00901                 catch (ivd_Exception &e){
00902                     log_ERR_m(e);
00903                 }
00904             }
00905             try {
00906                 ipc_EXEC_m(
00907                     if ((a_jobTypeMask == 0) || (a_jobTypeMask & jt_ADMIN) != 0 ){
00908                         string empty("");
00909                         ListJobs(empty, a_jobTypeMask, uires, !found);
00910                     }   
00911                 )
00912             }
00913             catch (ivd_Exception& e){
00914                 log_ERR_m(e);
00915             }
00916         } 
00917         else {
00918             ListJobs(partName, a_jobTypeMask, uires, !found);
00919         }
00920         
00921         if (uires.GetUIResults().size() == 0) {
00922             ui->DisplayMessage("No jobs running.");
00923         } else {
00924             uires.SendResults(ui);
00925         }
00926     } 
00927     ipc_CATCH_IVD_THROW_CORBA_m
00928 } //i_ManagementInterface_i::JobInfo

Here is the call graph for this function:

i_JobList_t * i_ManagementInterface_i::GetAllAdminJobs (  ) 

Definition at line 1054 of file i_mif_job.cpp.

References job_Manager::GetAllJobs(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and m_jobMgr.

Referenced by ListJobs().

01054                                                       {
01055     log_FUNC_m(GetAllAdminJobs);
01056 
01057     try {
01058         return m_jobMgr.GetAllJobs();
01059     }
01060     ipc_CATCH_IVD_THROW_CORBA_m;
01061 } // i_ManagementInterface_i::GetAllAdminJobs()

Here is the call graph for this function:

Here is the caller graph for this function:

void i_ManagementInterface_i::JobInfoDetail ( i_JobID_t  a_jobId,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 932 of file i_mif_job.cpp.

References ui_ResultPacker::GetUIResults(), ipc_CATCH_IVD_THROW_CORBA_m, ListJob(), and log_FUNC_m.

00933                                                      {
00934     
00935     log_FUNC_m(JobInfoDetail);
00936     try {
00937     
00938         ui_ResultPacker uires;
00939         ListJob(a_jobId, uires);
00940         const vector<i_UIResult_t> &result =  uires.GetUIResults();
00941     
00942         if (!CORBA::is_nil(a_uims)) {
00943             i_UIMessageServer_var ui = i_UIMessageServer::_duplicate(a_uims);
00944             for (UInt32_t i = 0; i < result.size(); i++){
00945                 ui->DisplayResult(result[i]);
00946             }
00947         }
00948     } 
00949     ipc_CATCH_IVD_THROW_CORBA_m
00950 }

Here is the call graph for this function:

void i_ManagementInterface_i::SetPriority ( i_JobID_t  a_jobId,
i_JobPriorityMod_e  a_chgType,
CORBA::Long  a_value,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 954 of file i_mif_job.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, and SetJobPriority().

00956                                                      {
00957     
00958     log_FUNC_m(SetPriority);
00959     
00960     try {  
00961         SetJobPriority(a_jobId, a_chgType, a_value, a_uims);
00962     } 
00963     ipc_CATCH_IVD_THROW_CORBA_m
00964 }

Here is the call graph for this function:

void i_ManagementInterface_i::AbortJob ( const i_JobIDList_t a_jobIds,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 968 of file i_mif_job.cpp.

References i_Job_i::AbortJob(), dbg_DETAIL, dbg_NORM, job_Manager::FindJob(), mif_PartMgr::GetAllPart(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_jobMgr, m_partMgr, and mps_Online.

00969                                                                 {
00970     
00971     log_FUNC_m(AbortJob);
00972     try {
00973         log_DBG_m(dbg_DETAIL,"will cancel " << a_jobIds.length() << " jobs");
00974         
00975         //i_UIMessageServer_var ui = a_uims;
00976         stringstream resMsg;
00977         vector<bool> found;
00978 
00979         found.resize(a_jobIds.length());
00980         for (UInt32_t numOfJob = 0; numOfJob < found.size(); numOfJob++){
00981             found[numOfJob] = false;
00982         }
00983 
00984         //
00985         // first try to abord all jobs in MIF (admin jobs)
00986         try {            
00987             for (UInt32_t jobIdx = 0 ; jobIdx < a_jobIds.length(); jobIdx++ ){
00988                 i_Job_i * iJob;
00989                 iJob = m_jobMgr.FindJob(a_jobIds[jobIdx]);
00990                 ipc_EXEC_m(iJob->AbortJob();)
00991                 resMsg << "Job " << a_jobIds[jobIdx] << " aborted.";
00992                 ipc_EXEC_m(a_uims->DisplayMessage(
00993                                 CORBA::string_dup(resMsg.str().c_str()));
00994                 );
00995                 resMsg.str("");
00996                 found[jobIdx] = true;
00997             }
00998         }
00999         catch (ivd_Exception){
01000             log_DBG_m(dbg_NORM, "could not find Job in  Mif:");
01001         }
01002         resMsg.str("");
01003 
01004         //
01005         // now try to abort all jobs on partitions (mig, recall)
01006         vector <mif_PartEntry> allPart = m_partMgr.GetAllPart();
01007         log_DBG_m(dbg_NORM," " << allPart.size() <<" partitions configured");
01008         
01009         for (UInt32_t jobIdx = 0 ; jobIdx < a_jobIds.length(); jobIdx++ ){
01010             if (found[jobIdx]) 
01011                 continue; // already aborted on MIF
01012             
01013             for (UInt32_t pmIdx = 0 ; pmIdx < allPart.size(); pmIdx++ ){
01014                 if (allPart[pmIdx].m_partStatus != mps_Online)
01015                     continue;
01016 
01017                 try {
01018                     ipc_EXEC_m(
01019                         allPart[pmIdx].m_iPM->AbortJob(a_jobIds[jobIdx]);
01020                        
01021                         found[jobIdx] = true;
01022                         resMsg << "Job " << a_jobIds[jobIdx] << " aborted";
01023 
01024                         a_uims->DisplayMessage(
01025                              CORBA::string_dup(resMsg.str().c_str()));
01026                         break;
01027                     )
01028                 }
01029                 catch (ivd_Exception){
01030                     log_DBG_m(dbg_DETAIL, "Did not find job in partition: " 
01031                               << allPart[pmIdx].m_partName);
01032                 }
01033             }
01034 
01035             if (!found[jobIdx]){
01036                 resMsg << "Could not find job " << a_jobIds[jobIdx];
01037                 ipc_EXEC_m(
01038                     a_uims->DisplayWarning(
01039                         CORBA::string_dup(resMsg.str().c_str()));
01040                 );
01041             } 
01042 
01043             log_DBG_m(dbg_DETAIL,"Clearing result");
01044             resMsg.str("");
01045         }
01046     } 
01047     ipc_CATCH_IVD_THROW_CORBA_m
01048     a_uims->Remove();
01049 } //i_ManagementInterface_i::AbortJob

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::CheckFSCvsIVDFS ( const char *  a_partName,
i_Count_t  a_numFilesPerBatch,
CORBA::Short  a_sysLoadPct,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 1277 of file i_mif_partition.cpp.

References mif_PartMgr::GetPart(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, and mps_Online.

Referenced by CheckFSCvsMedia().

01279                                                            {
01280 
01281     log_FUNC_m(CheckFSCvsIVDFS);
01282 
01283     try {
01284         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
01285         if (pe.m_partStatus != mps_Online) {
01286             throw ivd_Error(ie_PRECONDITION, "Partition not ready - cannot check HSMFS.");
01287         }
01288         return pe.m_iPM->CheckFSCvsIVDFS(a_numFilesPerBatch, a_sysLoadPct, a_uims);
01289     }
01290     ipc_CATCH_IVD_THROW_CORBA_m;
01291 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_JobID_t i_ManagementInterface_i::CheckFSCvsMedia ( const char *  a_partName,
const i_StringList_t a_volumes,
CORBA::Boolean  a_autoCorrect,
CORBA::Boolean  a_removeMissingOnMedia,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 1295 of file i_mif_partition.cpp.

References CheckFSCvsIVDFS(), mif_PartMgr::GetPart(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, and mps_Online.

01299                                   {
01300 
01301     log_FUNC_m(CheckFSCvsIVDFS);
01302 
01303     try {
01304         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
01305         if (pe.m_partStatus != mps_Online) {
01306             throw ivd_Error(ie_PRECONDITION, "Partition not ready - cannot check FSC.");
01307         }
01308         return pe.m_iPM->CheckFSCvsMedia(a_volumes, a_autoCorrect, a_removeMissingOnMedia, a_uims);
01309     }
01310     ipc_CATCH_IVD_THROW_CORBA_m;
01311 }

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::LimitedCheckFSCvsMedia ( const i_StringList_t a_barcodes,
const i_VolNumList_t a_volumes,
CORBA::Boolean  a_autoCorrect,
CORBA::Boolean  a_removeMissingOnMedia,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 1314 of file i_mif_partition.cpp.

References dbg_NORM, mif_PartMgr::GetPart(), ie_INVALID_ARG, ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, m_rm, and mps_Online.

01319                                   {
01320 
01321     log_FUNC_m(LimitedCheckFSCvsIVDFS);
01322 
01323     try {
01324         i_Medium_t_var firstMedium;
01325         string targetPartition;
01326         log_DBG_m(dbg_NORM, "List of barcodes: " << a_barcodes.length());
01327         for (UInt32_t i = 0; i < a_barcodes.length(); i++) {
01328             ipc_EXEC_m(
01329 
01330                 i_Medium_t_var medium = m_rm->SelectMedium(a_barcodes[i]);
01331                 if (string(medium->partitionName).empty()) {
01332                     ostringstream sstr;
01333                     sstr << "Medium: " << a_barcodes[i]
01334                          << " does not belong to any partition.";
01335                     throw ivd_Error(ie_INVALID_ARG, sstr.str());
01336                 }
01337                 if (targetPartition.empty()) {
01338                     targetPartition = string(medium->partitionName);
01339                     firstMedium = medium;
01340                 }
01341                 else if (targetPartition != string(medium->partitionName)) {
01342                     ostringstream sstr;
01343                     sstr << "Medium: " << a_barcodes[i]
01344                          << " belongs to different partition (" <<  medium->partitionName
01345                          << ") then precedents (" << targetPartition << ").";
01346                     throw ivd_Error(ie_INVALID_ARG, sstr.str());
01347                 }
01348             )
01349             log_DBG_m(dbg_NORM, setw(4) << i << ". " << a_barcodes[i]);
01350         }
01351 
01352         log_DBG_m(dbg_NORM, "List of volumes: " << a_volumes.length());
01353         for (UInt32_t i = 0; i < a_volumes.length(); i++) {
01354             Int32_t volNum = a_volumes[i];
01355             log_DBG_m(dbg_NORM, setw(4) << i << ". " << volNum);
01356             if (volNum > (Int32_t)firstMedium->numOfVolumes) {
01357                 ostringstream sstr;
01358                 sstr << "Volume number: " << volNum
01359                      << " is greater than number of all volumes on medium: " << firstMedium->barcode
01360                      << ". numOfVolumes: " << firstMedium->numOfVolumes;
01361                 throw ivd_Error(ie_INVALID_ARG, sstr.str());
01362             }
01363             if (volNum == firstMedium->idxOfSysVol) {
01364                 ostringstream sstr;
01365                 sstr << "Cannot check the System Volume: " << volNum
01366                      << " of medium: " << firstMedium->barcode;
01367                 throw ivd_Error(ie_INVALID_ARG, sstr.str());
01368             }
01369         }
01370         mif_PartEntry pe = m_partMgr.GetPart(string(firstMedium->partitionName));
01371         if (pe.m_partStatus != mps_Online) {
01372             throw ivd_Error(ie_PRECONDITION, "Partition not ready - cannot check FSC.");
01373         }
01374         return pe.m_iPM->LimitedCheckFSCvsMedia(a_barcodes, a_volumes, a_autoCorrect, a_removeMissingOnMedia, a_uims);
01375     }
01376     ipc_CATCH_IVD_THROW_CORBA_m;
01377 } // i_ManagementInterface_i::LimitedCheckFSCvsMedia()

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::FSCRecover ( const char *  a_partName,
const i_StringList_t a_volumes,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 1380 of file i_mif_partition.cpp.

References dbg_NORM, mif_PartMgr::GetPart(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, and mps_Online.

Referenced by IVDFSRecover().

01382                                   {
01383 
01384     log_FUNC_m(FSCRecover);
01385 
01386     try {
01387         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
01388         if (pe.m_partStatus != mps_Online) {
01389             throw ivd_Error(ie_PRECONDITION, "Partition not ready - cannot recover FSC.");
01390         }
01391 
01392         i_HSM_var iHSM;
01393         try {
01394            iHSM = pe.m_iPM->GetHSM();
01395         }
01396         catch (...) {
01397             // ignore
01398         }
01399 
01400         if ( !CORBA::is_nil(iHSM) ) {
01401             throw ivd_Error(ie_PRECONDITION, "HSMFS mounted - cannot recover FSC.");
01402         }
01403 
01404         log_DBG_m(dbg_NORM, "MIF: HSM for partition is not running.");
01405         try {
01406             a_uims->DisplayMessage("FSC recovery started.");
01407         } catch (...) {
01408             //just ignore
01409         }
01410         return pe.m_iPM->FSCRecovery(a_volumes, a_uims);
01411     }
01412     ipc_CATCH_IVD_THROW_CORBA_m;
01413 } // i_ManagementInterface_i::FSCRecover()

Here is the call graph for this function:

Here is the caller graph for this function:

i_JobID_t i_ManagementInterface_i::IVDFSRecover ( const char *  a_partName,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 1416 of file i_mif_partition.cpp.

References dbg_NORM, FSCRecover(), mif_PartMgr::GetPart(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, and mps_Online.

01418                                   {
01419 
01420     log_FUNC_m(FSCRecover);
01421 
01422     try {
01423         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
01424         if (pe.m_partStatus != mps_Online) {
01425             throw ivd_Error(ie_PRECONDITION, "Partition not ready - cannot recover HSMFS.");
01426         }
01427         log_DBG_m(dbg_NORM, "MIF: HSMFS recovery started.");
01428         try {
01429             a_uims->DisplayMessage("HSMFS recovery started.");
01430         } catch (...) {
01431             //ignore
01432         }
01433         return pe.m_iPM->IVDFSRecover(a_uims);
01434     }
01435     ipc_CATCH_IVD_THROW_CORBA_m;
01436 }

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::ReorgScan ( const char *  a_partName,
i_Time_t  a_date,
CORBA::Long  a_numOfGenerations,
i_UIMessageServer_ptr  a_uims 
)

Invokes a scan job on the partition manager.

Definition at line 1451 of file i_mif_partition.cpp.

References dbg_NORM, mif_PartMgr::GetPart(), ie_PRECONDITION, ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, and mps_Online.

Referenced by Reorg().

01454                                                                                 {
01455     log_FUNC_m(ReorgScan);
01456 
01457     try {
01458         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
01459 
01460         if (pe.m_partStatus != mps_Online) {
01461             throw ivd_Error(ie_PRECONDITION, "Partition not ready - cannot invoke reorg scan.");
01462         }
01463 
01464         log_DBG_m(dbg_NORM, "Starting reorg scan.");
01465         UInt64_t jobID = pe.m_iPM->ReorgScan(a_date, a_numOfGenerations, a_uims);
01466         if (CORBA::is_nil(a_uims) == false) {
01467             a_uims->DisplayMessage("Reorganization scan started.");
01468         }
01469         return jobID;
01470     }
01471     ipc_CATCH_IVD_THROW_CORBA_m;
01472 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_JobID_t i_ManagementInterface_i::Reorg ( const char *  a_barcode,
const i_VolNumList_t a_volumes,
i_UIMessageServer_ptr  a_uims 
)

Invokes a maintenance job for reorganization on the partition mgr.

Definition at line 746 of file i_mif_medium.cpp.

References dbg_NORM, mif_PartMgr::GetPart(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, m_rm, mps_Online, and ReorgScan().

00748                                                                          {
00749     log_FUNC_m(ReorgScan);
00750 
00751     try {
00752         i_Medium_t_var med = m_rm->SelectMedium(a_barcode);
00753 
00754         log_DBG_m(dbg_NORM, "Medium belogs to partition " << med->partitionName);
00755         mif_PartEntry pe = m_partMgr.GetPart(string(med->partitionName));
00756         if (pe.m_partStatus != mps_Online) {
00757             a_uims->DisplayError("Partition not ready - can not invoke reorg scan.");
00758             return 0;
00759         } 
00760         log_DBG_m(dbg_NORM, "Starting reorg for medium " << a_barcode);
00761         
00762         UInt64_t jobID = pe.m_iPM->Reorg(a_barcode, a_volumes, a_uims);
00763         if (CORBA::is_nil(a_uims) == false) {
00764             a_uims->DisplayMessage("Reorganization started.");
00765         }
00766         return jobID;
00767     }
00768     ipc_CATCH_IVD_THROW_CORBA_m;
00769 }

Here is the call graph for this function:

i_JobID_t i_ManagementInterface_i::CopyContentsPerVolume ( const char *  a_barcode,
const i_VolNumList_t a_volumes,
::CORBA::Boolean  a_best_effort,
i_UIMessageServer_ptr  a_uims 
)

Invokes a maintenance job for redundant copy on the partition mgr.

i_JobID_t i_ManagementInterface_i::CopyContents ( const char *  a_barcode,
i_UIMessageServer_ptr  a_uims 
)

Invokes a maintenance job for redundant copy on the partition mgr.

Definition at line 772 of file i_mif_medium.cpp.

References dbg_NORM, mif_PartMgr::GetPart(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, m_rm, and mps_Online.

00773                                                                                 {
00774     log_FUNC_m(CopyContents);
00775 
00776     try {
00777         i_Medium_t_var med = m_rm->SelectMedium(a_barcode);
00778 
00779         log_DBG_m(dbg_NORM, "Medium belogs to partition " << med->partitionName);
00780         mif_PartEntry pe = m_partMgr.GetPart(string(med->partitionName));
00781         if (pe.m_partStatus != mps_Online) {
00782             a_uims->DisplayError("Partition not ready - can not invoke copy-contents.");
00783             return 0;
00784         } 
00785         log_DBG_m(dbg_NORM, "Starting copy-contents for medium " << a_barcode);
00786         a_uims->DisplayMessage("Copy-contents Job started.");
00787         
00788         i_VolNumList_t volumes; //empty
00789                                 //a_best_effort = false because of old call
00790         return pe.m_iPM->CopyContents(a_barcode, volumes, false, a_uims);
00791     }
00792     ipc_CATCH_IVD_THROW_CORBA_m;
00793 
00794 } //i_ManagementInterface_i::CopyContents

Here is the call graph for this function:

void i_ManagementInterface_i::FileHistory ( const char *  a_clientHost,
const char *  a_fsID,
CORBA::Boolean  a_byFileName,
const i_FileList_t a_files,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 37 of file i_mif_file.cpp.

References cmn_GetMigFlags(), i_FileHistory_t::dataType, dbg_DETAIL, dbg_NORM, file, i_File_t::fileID, i_FileHistory_t::fileName, i_FileHistory_t::fileSize, g_cmn, ivd_MigrationID::GetTime(), ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, log_DBG_m, log_FUNC_A_m, cmn_SysInfo::m_serverHost, i_FileHistory_t::migrationID, i_File_t::name, ui_ResultPacker::NewRow(), ipc_Corba::ResolvePMByFSID(), ipc_Corba::ResolvePMByPartID(), ui_ResultPacker::SendResults(), cmn_Global::si, cmn_Time::Time2YMDhms(), uialign_LEFT, and uialign_RIGHT.

00040                                   {
00041     
00042     log_FUNC_A_m(FileHistory, 
00043         "Client: " << a_clientHost << ", FS/PartitionID:" << a_fsID <<
00044         " #files:" << a_files.length());
00045             
00046     try {
00047         i_PartitionManager_var iPM;
00048 
00049         if (a_byFileName) {
00050             // resolve by FS ID (request by fileName)
00051             ipc_EXEC_m(
00052                 CORBA::Object_var obj = ipc_Corba::ResolvePMByFSID(
00053                                  string(a_clientHost), string(a_fsID), false);
00054                 iPM = i_PartitionManager::_narrow(obj);
00055             );                
00056         }
00057         else {
00058             // resolve by partition name (request by fileID)
00059             ipc_EXEC_m(
00060                 CORBA::Object_var obj = ipc_Corba::ResolvePMByPartID(
00061                                 g_cmn.si.m_serverHost, string(a_fsID), false);
00062 
00063                 iPM = i_PartitionManager::_narrow(obj);
00064             );
00065         }
00066 
00067         i_FSC_var iFSC;
00068 
00069         ipc_EXEC_m(
00070             log_DBG_m(dbg_DETAIL,"Resolving FSC");
00071             iFSC = iPM->GetFSC();
00072         );
00073 
00074         bool header(true);
00075         ui_ResultPacker result;
00076 
00077         for (UInt32_t i(0); i < a_files.length(); i++) {
00078             log_DBG_m(dbg_NORM, "Filename:" << a_files[i].name << 
00079                                 " fileID:" << a_files[i].fileID);
00080             
00081             const i_File_t &file = a_files[i];
00082             i_FileHistoryList_t_var fileHistList;
00083             
00084             if (header) {
00085                 header = false;
00086                 result.NewRow(true);
00087                 result.Insert("FileID");
00088                 result.Insert("MigID");
00089                 result.Insert("Time");
00090                 result.Insert("Size[B]");
00091                 result.Insert("Data");
00092                 result.Insert("FileName");
00093             }
00094 
00095             // file has no fileid
00096             if (file.fileID == 0)  {
00097                 result.NewRow();
00098 
00099                 // field FileID
00100                 result.Insert("n/a", uialign_RIGHT);
00101 
00102                 // field MigID
00103                 result.Insert("n/a", uialign_RIGHT);
00104 
00105                 // field Time
00106                 result.Insert("n/a", uialign_RIGHT);
00107 
00108                 // field Size[KB]
00109                 result.Insert("n/a", uialign_RIGHT);
00110 
00111                 // field data type
00112                 result.Insert("n/a", uialign_LEFT);
00113 
00114                 if (a_byFileName) {
00115                     result.Insert(file.name);
00116                 }
00117                 else {
00118                     result.Insert("n/a", uialign_RIGHT);
00119                 }
00120                 continue;
00121             }
00122 
00123             ipc_EXEC_m (
00124                 fileHistList = iFSC->GetFileHistory(file.fileID);
00125             );
00126 
00127             // no valid generations for this file
00128             if (fileHistList->length() == 0) {
00129                 result.NewRow();
00130                 result.Insert(file.fileID);
00131 
00132                 // field MigID
00133                 result.Insert("n/a", uialign_RIGHT);
00134 
00135                 // field Time
00136                 result.Insert("n/a", uialign_RIGHT);
00137 
00138                 // field Size[KB]
00139                 result.Insert("n/a", uialign_RIGHT);
00140 
00141                 // field data type
00142                 result.Insert("n/a", uialign_LEFT);
00143                 
00144                 if (a_byFileName) {
00145                     result.Insert(file.name);
00146                 }
00147                 else {
00148                     result.Insert("n/a", uialign_RIGHT);
00149                 }
00150                 continue;
00151             }
00152             
00153             for (UInt32_t j(0); j < fileHistList->length(); j++) {
00154                 i_FileHistory_t &fileHis = fileHistList[j];
00155 
00156                 result.NewRow();
00157                 result.Insert(file.fileID);
00158                 result.Insert(fileHis.migrationID);
00159                 ivd_MigrationID migID(fileHis.migrationID);
00160                 result.Insert(migID.GetTime().Time2YMDhms());
00161                 result.Insert(fileHis.fileSize);
00162                 result.Insert(cmn_GetMigFlags((UInt32_t)fileHis.dataType), uialign_LEFT);
00163                 
00164                 result.Insert(fileHis.fileName);
00165             }            
00166         } //for
00167 
00168         log_DBG_m(dbg_NORM,"packing finished, sending results");
00169             
00170         result.SendResults(a_uims);        
00171 
00172     } ipc_CATCH_IVD_THROW_CORBA_m
00173 }

Here is the call graph for this function:

void i_ManagementInterface_i::RecallFile ( const char *  a_clientHost,
const char *  a_fsID,
CORBA::Boolean  a_byFileName,
const i_FileList_t a_files,
i_MigID_t  a_migID,
const char *  a_into,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 175 of file i_mif_file.cpp.

References dbg_DETAIL, g_cmn, ie_NO_HSM, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, ivd_Error, log_DBG_m, log_FUNC_A_m, cmn_SysInfo::m_serverHost, ipc_Corba::ResolvePMByFSID(), ipc_Corba::ResolvePMByPartID(), and cmn_Global::si.

00178                                                       {
00179 
00180     log_FUNC_A_m(RecallFile, 
00181         "Client: " << a_clientHost << ", FS/PartitionID:" << a_fsID <<
00182         " #files:" << a_files.length());
00183 
00184     try {
00185         i_PartitionManager_var iPM;
00186 
00187         if (a_byFileName) {
00188             // resolve by FS ID (request by fileName)
00189             ipc_EXEC_m(
00190                 CORBA::Object_var obj = ipc_Corba::ResolvePMByFSID(
00191                                  string(a_clientHost), string(a_fsID), false);
00192                 iPM = i_PartitionManager::_narrow(obj);
00193             );                
00194         }
00195         else {
00196             // resolve by partition name (request by fileID)
00197             ipc_EXEC_m(
00198                 CORBA::Object_var obj = ipc_Corba::ResolvePMByPartID(
00199                                 g_cmn.si.m_serverHost, string(a_fsID), false);
00200 
00201                 iPM = i_PartitionManager::_narrow(obj);
00202             );
00203         }
00204 
00205         ipc_EXEC_m (
00206              log_DBG_m(dbg_DETAIL,"Resolving HSM");
00207              i_HSM_var iHSM = iPM->GetHSM();
00208              if (CORBA::is_nil(iHSM))
00209                  throw ivd_Error(ie_NO_HSM, "Partition not mounted or no valid HSM reference.");
00210              iHSM->TrigRecall(a_files, a_byFileName, a_migID, a_into);
00211         );
00212 
00213     } ipc_CATCH_IVD_THROW_CORBA_m
00214 }

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::ReleaseFile ( const char *  a_clientHost,
const char *  a_fsID,
const i_StringList_t a_files,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 217 of file i_mif_file.cpp.

References dbg_DETAIL, ie_LOST_HSM, ie_NO_HSM, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, ivd_Error, log_DBG_m, log_FUNC_A_m, and ipc_Corba::ResolvePMByFSID().

00219                                   {
00220 
00221     log_FUNC_A_m(ReleaseFile, 
00222         "Client: " << a_clientHost << ", FSID:" << a_fsID <<
00223         " #files:" << a_files.length());
00224 
00225     try {
00226         i_PartitionManager_var iPM;
00227         try {
00228             CORBA::Object_var obj = ipc_Corba::ResolvePMByFSID(
00229                             string(a_clientHost), string(a_fsID), false);
00230             iPM = i_PartitionManager::_narrow(obj);
00231         }
00232         catch(ivd_Exception) {
00233             throw ivd_Error(ie_LOST_HSM, 
00234                             "Partition stopped or no valid HSM reference.");
00235         }
00236 
00237         ipc_EXEC_m (
00238             log_DBG_m(dbg_DETAIL,"Resolving HSM");
00239             i_HSM_var iHSM = iPM->GetHSM();
00240             if (CORBA::is_nil(iHSM) || iHSM->_non_existent())
00241                 throw ivd_Error(ie_NO_HSM, 
00242                         "Partition not mounted or no valid HSM reference.");
00243 
00244             return iHSM->ForceRelease(a_files);
00245         );
00246     } ipc_CATCH_IVD_THROW_CORBA_m
00247 }

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::MigrateFile ( const char *  a_clientHost,
const char *  a_fsID,
const i_StringList_t a_files,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 250 of file i_mif_file.cpp.

References dbg_DETAIL, ie_NO_HSM, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, ivd_Error, log_DBG_m, log_FUNC_A_m, and ipc_Corba::ResolvePMByFSID().

00252                                                                      {
00253 
00254     log_FUNC_A_m(MigrateFile, 
00255         "Client: " << a_clientHost << ", FSID:" << a_fsID <<
00256         " #files:" << a_files.length());
00257 
00258     try {
00259         i_PartitionManager_var iPM;
00260 
00261         CORBA::Object_var obj = ipc_Corba::ResolvePMByFSID(
00262                          string(a_clientHost), string(a_fsID), false);
00263         iPM = i_PartitionManager::_narrow(obj);
00264 
00265         ipc_EXEC_m (
00266             log_DBG_m(dbg_DETAIL,"Resolving HSM");
00267             i_HSM_var iHSM = iPM->GetHSM();
00268             if (CORBA::is_nil(iHSM))
00269                 throw ivd_Error(ie_NO_HSM, "Partition not mounted or no valid HSM reference.");
00270 
00271             return iHSM->ForceMigration(a_files);
00272         );
00273 
00274     } ipc_CATCH_IVD_THROW_CORBA_m
00275 }

Here is the call graph for this function:

i_ActivateResult_t i_ManagementInterface_i::ActivateFile ( const char *  a_clientHost,
const char *  a_fsID,
const i_StringList_t a_files,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 277 of file i_mif_file.cpp.

References dbg_DETAIL, ie_NO_HSM, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, ivd_Error, log_DBG_m, log_FUNC_A_m, and ipc_Corba::ResolvePMByFSID().

00279                                                                      {
00280 
00281     log_FUNC_A_m(ActivateFile, 
00282         "Client: " << a_clientHost << ", FSID:" << a_fsID <<
00283         " #files:" << a_files.length());
00284 
00285     try {
00286         i_PartitionManager_var iPM;
00287 
00288         CORBA::Object_var obj = ipc_Corba::ResolvePMByFSID(
00289                          string(a_clientHost), string(a_fsID), false);
00290         iPM = i_PartitionManager::_narrow(obj);
00291 
00292         ipc_EXEC_m (
00293             log_DBG_m(dbg_DETAIL,"Resolving HSM");
00294             i_HSM_var iHSM = iPM->GetHSM();
00295             if (CORBA::is_nil(iHSM))
00296                 throw ivd_Error(ie_NO_HSM, "Partition not mounted or no valid HSM reference.");
00297 
00298             return iHSM->ActivateFiles(a_files);
00299         );
00300 
00301     } ipc_CATCH_IVD_THROW_CORBA_m
00302 }

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::TrigMigration ( const char *  a_partName,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 304 of file i_mif_file.cpp.

References dbg_DETAIL, g_cmn, ie_NO_HSM, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, iPM, ivd_Error, log_DBG_m, log_FUNC_m, cmn_SysInfo::m_serverHost, ipc_Corba::ResolvePMByPartID(), and cmn_Global::si.

00306                                                                  {
00307     log_FUNC_m(TrigMigration);
00308 
00309     try {
00310         i_PartitionManager_var iPM;
00311         
00312         ipc_EXEC_m(
00313             CORBA::Object_var obj = ipc_Corba::ResolvePMByPartID(
00314                 g_cmn.si.m_serverHost,
00315                 string(a_partName), false);
00316 
00317             iPM = i_PartitionManager::_narrow(obj);
00318         );
00319         
00320         ipc_EXEC_m (
00321             log_DBG_m(dbg_DETAIL,"Resolving HSM");
00322             i_HSM_var iHSM = iPM->GetHSM();
00323             if (CORBA::is_nil(iHSM))
00324                 throw ivd_Error(ie_NO_HSM, "Partition not mounted or no valid HSM reference.");
00325 
00326             return iHSM->TrigMigration();
00327         );
00328 
00329     } ipc_CATCH_IVD_THROW_CORBA_m                                    
00330 }

Here is the call graph for this function:

void i_ManagementInterface_i::TrigDeletion ( const char *  a_partName,
i_UIMessageServer_ptr  a_uims,
bool &  a_noMonitor 
)

Definition at line 333 of file i_mif_file.cpp.

References mif_PartMgr::GetPart(), ie_HSM_NOTREADY, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_FUNC_m, mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, and mps_Online.

00335                                                                               {
00336     log_FUNC_m(TrigDeletion);
00337     
00338     try {
00339         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
00340         if (pe.m_partStatus != mps_Online) {
00341             a_uims->DisplayError(
00342                             "Partition not ready - could not start deletion.");
00343             a_noMonitor = true;
00344             return;
00345         }
00346         try {
00347             i_HSM_var iHSM = pe.m_iPM->GetHSM();
00348             if (CORBA::is_nil(iHSM)) {
00349                 ostringstream oss;
00350                 oss << "MIF: HSM for partition " << a_partName 
00351                     << " not running.";
00352                 throw ivd_Error(ie_HSM_NOTREADY, oss.str());
00353             }
00354             i_HsmInfo_t_var hsmInfo;
00355             ipc_EXEC_m(iHSM->GetInfo(hsmInfo););
00356             pe.m_iPM->TrigDeletion(
00357                             (a_noMonitor? i_UIMessageServer::_nil(): a_uims));
00358         } catch (...) {
00359             a_uims->DisplayError(
00360                         "Partition not mounted or no valid HSM reference.");
00361             a_noMonitor = true;
00362             return;
00363         }
00364     } ipc_CATCH_IVD_THROW_CORBA_m                                    
00365 }

Here is the call graph for this function:

void i_ManagementInterface_i::Mount ( const char *  host,
const char *  a_fileUUID,
const char *  a_mountPoint 
)

Definition at line 36 of file i_mif_fs.cpp.

References dbg_DETAIL, evt_ERROR, i_IVD, ie_EXECUTION_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), cmn_Path::RemoveTrailingPathSeparator(), and ipc_Corba::ResolveSvc().

00037                                                                {
00038 
00039     log_FUNC_m(Mount);
00040     
00041     try {
00042         i_Service_var svc;
00043 
00044     string host (a_host);
00045     cmn_Path mountPoint(a_mountPoint);
00046     cmn_Path fileUUID(a_fileUUID);
00047 
00048     mountPoint.RemoveTrailingPathSeparator();
00049     fileUUID.RemoveTrailingPathSeparator();
00050     
00051         try {
00052             CORBA::Object_var obj = ipc_Corba::ResolveSvc(host.c_str());
00053             svc = i_Service::_narrow(obj);
00054         }
00055         catch (...) {
00056             string sstr("Cannot resolve client " + host + ". Probably disconnected.");
00057             log_WriteEvent(evt_ERROR, sstr);
00058             throw;
00059         }
00060 
00061         i_StringList_t argSequence;
00062         argSequence.length(3);
00063         argSequence[0] = CORBA::string_dup("--mount");
00064 
00065 
00066         argSequence[1] = CORBA::string_dup(mountPoint.c_str());
00067         argSequence[2] = CORBA::string_dup(fileUUID.c_str());
00068 
00069 
00070         log_DBG_m(dbg_DETAIL, " Mounting hsmfs on host " << host
00071                         << " mount point " << mountPoint
00072                         << " fileSystem ID " << fileUUID);
00073         int ret(0);
00074         ipc_EXEC_m(
00075             ret = svc->Execute(i_IVD, argSequence);
00076         );
00077         
00078         if (ret != 0) {
00079             log_DBG_m(dbg_DETAIL, "Mount failed.");
00080             ostringstream msg;
00081             msg
00082                 << "Mount failed. Exit status was: " << ret << ".";
00083             throw ivd_Error(ie_EXECUTION_ERROR, msg.str(), true); 
00084         };
00085     }
00086     ipc_CATCH_IVD_THROW_CORBA_m;
00087 }

Here is the call graph for this function:

void i_ManagementInterface_i::Umount ( const char *  host,
const char *  a_fileUUID,
const char *  a_mountPoint 
)

Definition at line 89 of file i_mif_fs.cpp.

References dbg_DETAIL, evt_ERROR, i_IVD, ie_EXECUTION_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), cmn_Path::RemoveTrailingPathSeparator(), and ipc_Corba::ResolveSvc().

00090                                                                {
00091 
00092 
00093 
00094     log_FUNC_m(Umount);
00095     
00096     try {
00097         i_Service_var svc;
00098 
00099     string host (a_host);
00100         cmn_Path mountPoint(a_mountPoint);
00101         cmn_Path fileUUID(a_fileUUID);  
00102 
00103     mountPoint.RemoveTrailingPathSeparator();
00104         fileUUID.RemoveTrailingPathSeparator();
00105 
00106         try {
00107             CORBA::Object_var obj = ipc_Corba::ResolveSvc(host.c_str());
00108             svc = i_Service::_narrow(obj);
00109         }
00110         catch (...) {
00111             string sstr("Cannot resolve client " + host + ". Probably disconnected.");
00112             log_WriteEvent(evt_ERROR, sstr);
00113             throw; 
00114         }
00115 
00116         i_StringList_t argSequence;
00117         argSequence.length(3);
00118         argSequence[0] = CORBA::string_dup("--umount");
00119 
00120         argSequence[1] = CORBA::string_dup(mountPoint.c_str());
00121         argSequence[2] = CORBA::string_dup(fileUUID.c_str());
00122 
00123         log_DBG_m(dbg_DETAIL, " Unmounting  hsmfs on host " << host
00124                         << " mount point " << mountPoint
00125                             << " fileSystem ID " << fileUUID);
00126         int ret(0);
00127         ipc_EXEC_m(
00128             ret = svc->Execute(i_IVD, argSequence);
00129         );
00130         if (ret != 0) {
00131             log_DBG_m(dbg_DETAIL, "Umount failed.");
00132             ostringstream msg;
00133             msg
00134                 << "Umount failed. Exit status was: " << ret << ".";
00135             throw ivd_Error(ie_EXECUTION_ERROR, msg.str(), true); 
00136         };
00137     }
00138     ipc_CATCH_IVD_THROW_CORBA_m;
00139 }

Here is the call graph for this function:

i_PartInfoList_t * i_ManagementInterface_i::ReportAllPartitions (  ) 

Definition at line 1558 of file i_mif_partition.cpp.

References dbg_NORM, i_PartitionInfo_t::fsHost, i_PartitionInfo_t::fsID, i_PartitionInfo_t::fsMountPoint, mif_PartMgr::GetAllPart(), GetPartitionStatus(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, mif_PartEntry::m_partFSID, mif_PartEntry::m_partFSMountPoint, mif_PartEntry::m_partHost, m_partMgr, mif_PartEntry::m_partName, and i_PartitionInfo_t::partName.

01558                                                                {
01559     log_FUNC_m(ReportAllPartitions);
01560 
01561     try {
01562         i_PartInfoList_t* partInfoList = new i_PartInfoList_t();
01563 
01564         vector<mif_PartEntry> mifPartList = m_partMgr.GetAllPart();
01565         partInfoList->length(mifPartList.size());
01566 
01567         for (UInt32_t i(0); i < mifPartList.size(); i++) {
01568 
01569             mif_PartEntry & part = mifPartList[i];
01570 
01571             ivd_PartitionStatus_e   partStatus = GetPartitionStatus(part, part.m_partFSMountPoint);
01572 
01573             i_PartitionInfo_t &partInfo = (*partInfoList)[i];
01574             partInfo.partName       = CORBA::string_dup(part.m_partName.c_str());
01575             partInfo.fsHost         = CORBA::string_dup(part.m_partHost.c_str());
01576             partInfo.fsMountPoint   = CORBA::string_dup(part.m_partFSMountPoint.c_str());
01577             partInfo.fsID           = CORBA::string_dup(part.m_partFSID.c_str());
01578 
01579             log_DBG_m(dbg_NORM, "PartInfo partInfo.partName: " <<
01580                                 partInfo.partName <<
01581                                 ", partInfo.fsHost: " << partInfo.fsHost <<
01582                                 ", partInfo.fsID: " << partInfo.fsID <<
01583                                 ", partInfo.fsMountPoint: " <<
01584                                 partInfo.fsMountPoint);
01585 
01586         }
01587 
01588         return partInfoList;
01589     }
01590     ipc_CATCH_IVD_THROW_CORBA_m
01591 } // i_ManagementInterface_i::ReportAllPartitions()

Here is the call graph for this function:

char * i_ManagementInterface_i::AddPartition ( const char *  a_userAtDomain,
const i_DataBlock_t a_cfgFile 
)

Definition at line 945 of file i_mif_partition.cpp.

References mif_PartMgr::AddPart(), cfg_PMCfg::clients, dbg_DETAIL, dbg_NORM, i_Partition_t::fsHost, i_Partition_t::fsID, i_Partition_t::fsMountpoint, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), GetFSType(), cfg_PMCfg::globalTreeOptions, ie_MIF_CFG_ALREADY_CONFIGURED, ie_MIF_RM_PROBLEM, ie_PRECONDITION, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_partMgr, m_rm, MIF_CFG_PARTITION, mif_PARTITION, cfg_PMCfg::name, i_Partition_t::options, mif_CfgRep::ParseToFile(), i_Partition_t::partitionName, cfg_PMTree::pools, mif_CfgRep::ReplaceClients(), rmdb_PARTITION_ENABLED, i_Partition_t::status, mif_CfgRep::Upload(), and ValidatePMConfig().

00947                                                                     {
00948 
00949     log_FUNC_m(AddPartition);
00950     try {
00951 
00952         string userStr(a_userAtDomain);
00953         pf_File pFile;
00954         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_PARTITION, userStr);
00955         mif_CfgRep::ReplaceClients(pFile);
00956 
00957         cfg_PMCfg partCfg(pFile);
00958 
00959         try {
00960             i_Partition_t_var partI;
00961             ipc_EXEC_m(partI =  m_rm->SelectPartition(partCfg.name.c_str()));;
00962             log_DBG_m(dbg_NORM, "MIF: Partition is configured.");
00963             throw ivd_Error(ie_PRECONDITION,
00964                 "Partition already configured: " + string(partCfg.name));
00965 
00966         } catch (ivd_Exception &e) {
00967             log_DBG_m(dbg_NORM, e);
00968             if (e.GetError() == ie_RMDB_NOTFOUND) {
00969                 // continue
00970             } else
00971                 throw;
00972         }
00973 
00974         // validate specified configuration options
00975         ValidatePMConfig(partCfg, "", partCfg.name);
00976 
00977         //
00978         // add partition tables into RMDB.
00979         string partUUID;
00980         try {
00981             i_Partition_t iPart;
00982             iPart.status = rmdb_PARTITION_ENABLED;
00983             iPart.partitionName = CORBA::string_dup(partCfg.name.c_str());
00984 
00985             // i_Part UUID & MigIDTime & MgID Count is generated by RM!!
00986             // Note: only one client supported today
00987             iPart.fsHost = CORBA::string_dup(partCfg.clients[0].name.c_str());
00988             iPart.fsMountpoint = CORBA::string_dup("NYI");
00989             iPart.fsID = CORBA::string_dup(partCfg.clients[0].fileSystemId.c_str());
00990 
00991             iPart.options = GetFSType(partCfg.clients[0].operationMode);
00992 
00993             log_DBG_m(dbg_NORM, "partCfg.clients[0].operationMode:" <<
00994                                 partCfg.clients[0].operationMode);
00995 
00996             partUUID =  m_rm->AddPartition(iPart);
00997 
00998         } catch (ivd_Exception &e) {
00999             log_DBG_m(dbg_NORM, "Partition already in rmdb: " << partCfg.name);
01000             throw ivd_Error(ie_MIF_CFG_ALREADY_CONFIGURED, e.GetFriendly());
01001         }
01002 
01003         // partition ID insertion in POOL records in RMDB
01004         for (UInt32_t i=0; i < partCfg.globalTreeOptions.pools.size(); i++) {
01005 
01006             i_MediaPool_t_var poolI;
01007 
01008             ipc_EXEC_m(
01009                 poolI =  m_rm->SelectMediaPool(
01010                     CORBA::string_dup(partCfg.globalTreeOptions.pools[i].Val().c_str()));
01011             );
01012             log_DBG_m(dbg_NORM,
01013                 "MIF: Media pool selected: " << poolI->mediaPoolName);
01014 
01015             poolI->partitionUUIDString = CORBA::string_dup(partUUID.c_str());
01016             log_DBG_m(dbg_NORM, "New partitionUUIDString for this media pool: " << partUUID);
01017 
01018             ipc_EXEC_m(
01019                 m_rm->UpdateMediaPool(poolI);
01020             );
01021             log_DBG_m(dbg_NORM, "MIF: Media pool record updated.");
01022         }
01023 
01024         // partition ADDITION to CfgDB
01025 
01026         //
01027         // save first revision of partition cfg file to configuration repository.
01028         mif_CfgRep cfg(mif_PARTITION, partCfg.name);
01029         cfg.Upload(pFile);
01030 
01031         log_DBG_m(dbg_DETAIL,
01032             "MIF: partition configuration stream is: " << endl << pFile);
01033 
01034         // add the partition to partition manager, start PM and notify the client
01035         try {
01036             ipc_EXEC_m(
01037                 m_partMgr.AddPart(partCfg.name,
01038                                         partUUID,
01039                                         partCfg.clients[0].name,
01040                                         partCfg.clients[0].fileSystemId);
01041             );
01042         } catch (ivd_Error& e){
01043             ostringstream msg;
01044             msg << "Adding of partition failed. " << e.GetFriendly();
01045             throw ivd_Error(ie_MIF_RM_PROBLEM, msg.str() );
01046         }
01047         log_DBG_m(dbg_NORM, "MIF: partition added to part mgr.");
01048 
01049         ostringstream eventText;
01050         eventText << "Added new.";
01051 
01052         log_WriteEvent(eventText.str(), "PARTITION", 0, partCfg.name);
01053 
01054         return CORBA::string_dup(partCfg.name.c_str());
01055     } ipc_CATCH_IVD_THROW_CORBA_m
01056 } // i_ManagementInterface_i::AddPartition()

Here is the call graph for this function:

void i_ManagementInterface_i::RemovePartition ( const char *  a_name,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 583 of file i_mif_partition.cpp.

References i_Medium_t::barcode, cmn_CleanDir(), i_Medium_t::currentVolume, dbg_LOW, dbg_NORM, cmn_File::DeleteDir(), cmn_File::DeleteF(), cmn_Global::dirs, evt_ERROR, ivd_Directories::fri, g_cmn, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), mif_PartMgr::GetPart(), i_Medium_t::idxOfSysVol, ie_PRECONDITION, ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, ivd_Error, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, ipc_Log::LogMediumVol(), mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, m_rm, i_MediumVol_t::mediumBarcode, i_Medium_t::mediumKey, i_MediumVol_t::medVolId, i_MediumVol_t::medVolNr, mif_PARTITION, mps_Online, i_Medium_t::numOfVolumes, ivd_Directories::part, mif_CfgRep::RemoveCfg(), mif_PartMgr::RemovePart(), rmdb_MEDIUM_FULL, rmdb_MEDIUM_OPEN, rmdb_MEDVOL_USED, i_MediumVol_t::status, and i_Medium_t::status.

00584                                                                               {
00585 
00586     log_FUNC_m(RemovePartition);
00587     bool found(false);
00588     try {
00589         i_Partition_t_var partition;
00590         ostringstream msg;
00591 
00592         try {
00593             ipc_EXEC_m(
00594                 partition = m_rm->SelectPartition(a_partName);
00595                 log_DBG_m(dbg_NORM, "MIF: Partition is configured.");
00596                 found = true;
00597             );
00598         } catch (ivd_Exception &e) {
00599             log_DBG_m(dbg_NORM, e);
00600 
00601             if (e.GetError() == ie_RMDB_NOTFOUND) {
00602                 msg << "Partition does not exist. Will try to do as much cleanup as possible.";
00603                 log_DBG_m(dbg_LOW,msg.str());
00604                 a_uims->DisplayError(msg.str().c_str());
00605                 log_WRN_m( msg.str());
00606             } else {
00607                 msg << "Selecting Partition failed. Will try to do as much cleanup as possible.";
00608                 log_DBG_m(dbg_LOW,msg.str());
00609                 a_uims->DisplayError(msg.str().c_str());
00610                 log_ERR_m( msg.str());
00611             }
00612         }
00613 
00614         //
00615         // check if partition is mounted -> deny
00616         bool partRunning(true);
00617         mif_PartEntry pe;
00618         try {
00619             pe = m_partMgr.GetPart(a_partName);
00620             if (pe.m_partStatus == mps_Online) {
00621                 i_HSM_var iHSM;
00622                 ipc_EXEC_m(
00623                     iHSM = pe.m_iPM->GetHSM();
00624                 );
00625 
00626                 if (!CORBA::is_nil(iHSM)) {
00627                     msg << "HSM File System mounted. Cannot remove partition.";
00628                     log_WriteEvent(evt_ERROR, msg.str(),
00629                         "PARTITION", 0, string(a_partName));
00630                     a_uims->DisplayError(msg.str().c_str());
00631                     return;
00632                 }
00633             }
00634             // check if jobs are running
00635             ipc_EXEC_m(
00636                 if (pe.m_iPM->GetJobCount() > 0){
00637                     throw ivd_Error(ie_PRECONDITION,
00638                         "Jobs are still running. Can not remove Partition Manager.");
00639                 }
00640             );
00641 
00642         } catch (ivd_Error &e) {
00643             log_DBG_m(dbg_LOW, "Could not contact PM: " << e);
00644             // PM probably not running
00645             partRunning = false;
00646         }
00647 
00648 
00649         // partition UNREGISTRATION
00650         try {
00651             m_partMgr.RemovePart(a_partName);
00652         }
00653         catch (ivd_Error &e) {
00654             log_DBG_m(dbg_LOW, "RemovePart failed: " << e);
00655             if (partRunning)
00656                 log_ERR_m("Removing of partition from list of active partitions failed.")
00657         }
00658 
00659         i_MediumSeq_t_var allMedia;
00660         ipc_EXEC_m(
00661             allMedia = m_rm->SelectAllMediaByPart(a_partName);
00662         );
00663 
00664         for (UInt32_t i = 0; i < allMedia->length(); i++) {
00665 
00666             //for each media do an update
00667             i_Medium_t m = allMedia[i];
00668             log_DBG_m(dbg_LOW, "Update medium [Barcode] [Key]: " << m.barcode << " " << m.mediumKey);
00669 
00670             m.status = m.status & ~(rmdb_MEDIUM_OPEN | rmdb_MEDIUM_FULL);
00671             m.currentVolume = 0;
00672             m.idxOfSysVol = 0;
00673             m.numOfVolumes = 0;
00674             try {
00675                 ipc_EXEC_m(m_rm->UpdateMedium(m);)
00676             } catch (ivd_Error &e){
00677                 log_DBG_m(dbg_LOW, "UpdateMedium failed: " << e);
00678             }
00679 
00680         }
00681 
00682         // remove all mediaVolumes
00683         i_MediumSeqByVol_t_var allMedVol;
00684         ipc_EXEC_m(
00685             allMedVol = m_rm->SelectAllMediumVolByPart(a_partName);
00686         );
00687 
00688         for (UInt32_t i = 0; i < allMedVol->length(); i++) { // for each medium
00689 
00690             if (allMedVol[i].length() > 0 ) {
00691 
00692                 for (UInt32_t j = 0; j < allMedVol[i].length(); j++){
00693                     i_MediumVol_t &mv = allMedVol[i][j];
00694                     // remove mediumVol From rmdb
00695                     ipc_EXEC_m(m_rm->RemoveMediumVol(
00696                                         mv.mediumBarcode,
00697                                         mv.medVolNr );
00698                     );
00699                     // remove fri file
00700                     log_DBG_m(dbg_NORM, ipc_Log::LogMediumVol(mv));
00701                     if ( (mv.status & rmdb_MEDVOL_USED) == rmdb_MEDVOL_USED){
00702                         cmn_Path friPath = g_cmn.dirs.fri + mv.medVolId;
00703                         try {
00704                             cmn_File friFile(friPath);
00705                             friFile.DeleteF();
00706                         } catch (...){
00707                             // ignore
00708                         }
00709                     }
00710                 }
00711             }
00712         }
00713 
00714 
00715         if (found){
00716             // remove all collocation ids for this partition
00717             try {
00718                 ipc_EXEC_m(
00719                     m_rm->RemoveColIDs(partition->partitionUUIDString);
00720                 );
00721             }
00722             catch (ivd_Error& e){
00723                 log_ERR_m("Removing of collocation IDs failed. " << e.GetFriendly());
00724                 throw;
00725             }
00726             //
00727             // remove media pool partitionUUIDstring
00728             i_MediaPoolSeq_t_var mediaPoolSeq;
00729             ipc_EXEC_m(mediaPoolSeq = m_rm->SelectAllMediaPools(););
00730             for (UInt32_t i = 0; i < mediaPoolSeq->length(); i++) {
00731                 if (strcmp(mediaPoolSeq[i].partitionUUIDString,
00732                         partition->partitionUUIDString) == 0) {
00733                     mediaPoolSeq[i].partitionUUIDString = CORBA::string_dup(ipc_nilStr);
00734                     try {
00735                         ipc_EXEC_m(m_rm->UpdateMediaPool(mediaPoolSeq[i]);)
00736                     } catch (ivd_Error& e){
00737                         log_ERR_m("Removing of mediapool from partition failed. " << e.GetFriendly());
00738                     }
00739                 }
00740             }
00741             try {
00742                 ipc_EXEC_m(m_rm->RemovePartition(a_partName););
00743                 log_DBG_m(dbg_NORM, "MIF: Partition record removed from RMDB.");
00744             } catch (ivd_Error& e){
00745                 log_ERR_m("Removing of partition from RMDB failed. " << e.GetFriendly());
00746             }
00747         }
00748 
00749         // partition DEINSTALLATION
00750         try {
00751             //
00752             // remove named partition subdir from partition repository.
00753             cmn_Path partPath = g_cmn.dirs.part + cmn_Path(a_partName);
00754             cmn_CleanDir(partPath);
00755             cmn_File::DeleteDir(partPath);
00756             log_DBG_m(dbg_NORM, "MIF: Partition files removed.");
00757         }
00758         catch (ivd_Error& e) {
00759             log_DBG_m(dbg_NORM, e);
00760             log_ERR_m("MIF: Could not delete Part/DB directory." << e.GetFriendly());
00761         }
00762         catch (ivd_SysError& se) {
00763             log_DBG_m(dbg_NORM, se);
00764             log_ERR_m("MIF: Could not delete Part/DB directory." << se.GetFriendly());
00765         }
00766 
00767         try {
00768             //
00769             // remove named partition subdir from configuration repository.
00770             mif_CfgRep cfgHelp(mif_PARTITION, a_partName);
00771             cfgHelp.RemoveCfg();
00772             log_DBG_m(dbg_NORM, "Part cfg removed from CfgDB repository" <<
00773                                 a_partName);
00774         }
00775         catch (ivd_Error& e) {
00776             log_DBG_m(dbg_NORM, e);
00777             log_ERR_m("MIF: Could not delete Part/CFG:" << e.GetFriendly());
00778         }
00779         catch (ivd_SysError& se) {
00780             log_DBG_m(dbg_NORM, se);
00781             log_ERR_m("MIF: Could not delete Part/CFG:" << se.GetFriendly());
00782         }
00783         msg << "Partition removed.";
00784         log_WriteEvent(msg.str(), "PARTITION", 0, string(a_partName));
00785     }
00786     ipc_CATCH_IVD_THROW_CORBA_m
00787 } // i_ManagementInterface_i::RemovePartition()

Here is the call graph for this function:

void i_ManagementInterface_i::UpdatePartition ( const char *  a_userAtDomain,
const char *  a_name,
const i_DataBlock_t a_cfgFile,
i_Index_t a_newRevNo 
)

Definition at line 1059 of file i_mif_partition.cpp.

References cfg_PMCfg::clients, dbg_DETAIL, dbg_NORM, fst_REGULAR, fst_WORM, GetFSType(), cfg_PMCfg::globalTreeOptions, ie_MIF_CFG_RENAMING_NOT_ALLOWED_YET, ie_MIF_CFG_SEMANTIC_ERROR, ie_RMDB_NOTFOUND, ie_SEMANTIC_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_nilStr, mif_PartMgr::IsInRecallOnlyMode(), ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_partMgr, m_rm, MIF_CFG_PARTITION, mif_PARTITION, cfg_PMCfg::name, mif_CfgRep::ParseToFile(), cfg_PMTree::pools, mif_CfgRep::ReplaceClients(), mif_PartMgr::UpdatePart(), mif_CfgRep::Upload(), and ValidatePMConfig().

01063                                                            {
01064 
01065     log_FUNC_m(UpdatePartition);
01066 
01067     try {
01068 
01069         //
01070         // check if specified partition is configured.
01071         string partUUID;
01072         i_Partition_t_var partI;
01073         try {
01074             ipc_EXEC_m(
01075                 partI =  m_rm->SelectPartition(CORBA::string_dup(a_name));
01076                 partUUID = partI->partitionUUIDString;
01077                 log_DBG_m(dbg_NORM, "MIF: Partition is configured.");
01078             );
01079         }
01080         catch (ivd_Exception) {
01081             // TODO: RMDB could return specific error for not found
01082             throw ivd_Error(ie_RMDB_NOTFOUND, "Partition not configured: " + string(a_name));
01083         }
01084 
01085         pf_File pFile;
01086         mif_CfgRep::ParseToFile(pFile, a_cfgFile, MIF_CFG_PARTITION, a_userAtDomain);
01087         mif_CfgRep::ReplaceClients(pFile);
01088 
01089         cfg_PMCfg partCfg(pFile);
01090 
01091         // rename is not allowed yet
01092         if (partCfg.name != a_name) {
01093             throw ivd_Error(ie_MIF_CFG_RENAMING_NOT_ALLOWED_YET);
01094         }
01095 
01096         // validate specified configuration options
01097         ValidatePMConfig(partCfg, partUUID, partCfg.name);
01098 
01099         // Check if WORM want to be changed
01100         if (GetFSType(partI->options) == fst_WORM){
01101             log_DBG_m(dbg_NORM, "partI->options:" << partI->options);
01102             if (GetFSType(partCfg.clients[0].operationMode) == fst_REGULAR){
01103                 throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
01104                     "Changing of HSM file system type from WORM to Regular is not allowed." );
01105             }
01106         }
01107 
01108         // verify which pools will bee added/removed and if this is allowed
01109         i_MediaPoolSeq_t_var poolSeq;
01110         ipc_EXEC_m(
01111             poolSeq =  m_rm->SelectAllMediaPools();
01112         );
01113 
01114         vector<string> poolsToAdd;
01115         vector<string> poolsToDel;
01116 
01117         // add all pools currently assigned to poolsToDel
01118         for (UInt32_t i = 0; i < poolSeq->length(); ++i) {
01119             if (strcmp(poolSeq[i].partitionUUIDString, partUUID.c_str()) == 0) {
01120                 poolsToDel.push_back(string(poolSeq[i].mediaPoolName));
01121             }
01122         }
01123 
01124         // match specified pools with already assigned to define to add/delete
01125         for (UInt32_t i=0; i < partCfg.globalTreeOptions.pools.size(); ++i) {
01126             string poolName = partCfg.globalTreeOptions.pools[i].Val();
01127 
01128             // check if already assigned
01129             bool assigned = false;
01130             for (vector<string>::iterator iter = poolsToDel.begin();
01131                 iter != poolsToDel.end();
01132                 ++iter) {
01133 
01134                 if (poolName == *iter) {
01135                     assigned = true;
01136                     poolsToDel.erase(iter); // no need to delete -> erase from list
01137                     break;
01138                 }
01139             }
01140             //  if not assigned -> will have to assign now
01141             if (!assigned) {
01142                 poolsToAdd.push_back(poolName);
01143             }
01144         }
01145 
01146         log_DBG_m(dbg_NORM, "MIF: pools to add: " << poolsToAdd.size());
01147         log_DBG_m(dbg_NORM, "MIF: pools to del: " << poolsToDel.size());
01148 
01149         // TODO: prevent some changes if mounted (client)
01150 
01151         bool volUsed(false);
01152         ipc_EXEC_m(
01153             volUsed =  m_rm->IsSomeVolumeUsed(a_name);
01154         );
01155         // if data already migrated:
01156         if (volUsed) {
01157             // cannot change pool config
01158             if (poolsToAdd.size() > 0 || poolsToDel.size() > 0) {
01159                 throw ivd_Error(ie_SEMANTIC_ERROR,
01160                                 "Cannot change pools if data already migrated.");
01161             }
01162 
01163             // cannot change recall only operation mode
01164             if (bool(partCfg.clients[0].disableAutMig) != m_partMgr.IsInRecallOnlyMode(partCfg.name)) {
01165                 throw ivd_Error(ie_SEMANTIC_ERROR,
01166                                 "Cannot change recall only mode if data already migrated.");
01167             }
01168         }
01169 
01170         //
01171         // remove partitionUUID assignment for removed pools.
01172         for (UInt32_t i=0; i < poolsToDel.size(); ++i) {
01173             log_DBG_m(dbg_NORM,
01174                 "MIF: Pool " << poolsToDel[i] << " to be removed from part");
01175 
01176             i_MediaPool_t_var poolI;
01177             ipc_EXEC_m(
01178                 poolI =  m_rm->SelectMediaPool(
01179                                         CORBA::string_dup(poolsToDel[i].c_str()));
01180             );
01181 
01182             poolI->partitionUUIDString = CORBA::string_dup(ipc_nilStr);
01183             ipc_EXEC_m(
01184                 m_rm->UpdateMediaPool(poolI)
01185             );
01186         }
01187 
01188         //
01189         // assign partitionUUID to added pools.
01190         for (UInt32_t i=0; i < poolsToAdd.size(); ++i) {
01191             log_DBG_m(dbg_NORM,
01192                 "MIF: Pool " << poolsToAdd[i] << " to be added to part");
01193 
01194             i_MediaPool_t_var poolI;
01195             ipc_EXEC_m(
01196                 poolI =  m_rm->SelectMediaPool(
01197                                         CORBA::string_dup(poolsToAdd[i].c_str()));
01198             );
01199 
01200             poolI->partitionUUIDString = CORBASTR_FROM_STRING_m(partUUID);
01201             ipc_EXEC_m(
01202                 m_rm->UpdateMediaPool(poolI);
01203             );
01204         }
01205 
01206 
01207         mif_CfgRep cfg(mif_PARTITION, partCfg.name);
01208         a_newRevNo = cfg.Upload(pFile);
01209 
01210         log_DBG_m(dbg_DETAIL,
01211             "MIF: partition configuration stream is: " << pFile);
01212 
01213         //
01214         // update partition RM State.
01215         ipc_EXEC_m(
01216             m_rm->UpdatePartition(CORBA::string_dup(a_name));
01217             log_DBG_m(dbg_NORM, "MIF: Partition config updated in RMDB.");
01218         );
01219 
01220 
01221         ipc_EXEC_m(
01222             m_partMgr.UpdatePart(partCfg.name,
01223                                         partCfg.clients[0].name,
01224                                         partCfg.clients[0].fileSystemId);
01225         );
01226         log_DBG_m(dbg_NORM, "MIF: partition updated in part mgr.");
01227 
01228 
01229 
01230         ostringstream eventText;
01231         eventText << "Updated (rev. ";
01232         eventText << a_newRevNo;
01233         eventText << ").";
01234 
01235         log_WriteEvent(eventText.str(), "PARTITION", 0, a_name);
01236     } ipc_CATCH_IVD_THROW_CORBA_m
01237 
01238 } // i_ManagementInterface_i::UpdatePartition()

Here is the call graph for this function:

i_DataBlock_t * i_ManagementInterface_i::ShowPartition ( const char *  a_name,
i_Index_t  a_revNo 
)

Definition at line 1241 of file i_mif_partition.cpp.

References dbg_NORM, mif_CfgRep::GetCfg(), ie_RMDB_NOTFOUND, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ipc_ReadFromFile(), ivd_Error, log_DBG_m, log_FUNC_m, m_rm, and mif_PARTITION.

01243                                                                {
01244     log_FUNC_m(ShowPartition);
01245     try {
01246         i_Partition_t_var partI;
01247         try {
01248             ipc_EXEC_m(
01249                 partI =  m_rm->SelectPartition(CORBA::string_dup(a_name));
01250                 log_DBG_m(dbg_NORM, "MIF: Partition is configured.");
01251             );
01252         }
01253         catch (ivd_Exception) {
01254             // TODO: RMDB could return specific error for not found
01255             throw ivd_Error(ie_RMDB_NOTFOUND, "Partition not configured: " + string(a_name));
01256         }
01257         mif_CfgRep cfgRev(mif_PARTITION, a_name);
01258         cmn_File cfgFile = cfgRev.GetCfg(a_revNo);
01259         return ipc_ReadFromFile(cfgFile);
01260     } ipc_CATCH_IVD_THROW_CORBA_m
01261 }

Here is the call graph for this function:

i_Count_t i_ManagementInterface_i::ShowPartitionRevs ( const char *  a_name  ) 

Definition at line 1264 of file i_mif_partition.cpp.

References ipc_CATCH_IVD_THROW_CORBA_m, mif_CfgRep::LastRev(), log_FUNC_m, and mif_PARTITION.

01264                                                                        {
01265     log_FUNC_m(ShowPartitionRevs);
01266 
01267     try {
01268 
01269         mif_CfgRep cfgObj(mif_PARTITION, a_name);
01270         return cfgObj.LastRev();
01271     }
01272     ipc_CATCH_IVD_THROW_CORBA_m
01273 }

Here is the call graph for this function:

void i_ManagementInterface_i::ListPartitions ( i_UIMessageServer_ptr  a_uims,
CORBA::Long  a_filter 
)

Definition at line 166 of file i_mif_partition.cpp.

References bf_Activity, bf_PartFsHost, bf_PartFsID, bf_PartFsMountpoint, bf_PartitionToText(), bf_PartMigIdCount, bf_PartMigIdTime, bf_PartName, bf_PartOptions, bf_PartStatus, bf_PartUUID, g_partitionTable, mif_PartMgr::GetAllPart(), GetFSType(), GetPartitionStatus(), ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ui_BitFlag::IsFlagSet(), log_FUNC_m, mif_PartEntry::m_partHost, m_partMgr, mif_PartEntry::m_partName, mif_PartEntry::m_partUUID, m_rm, ui_ResultPacker::NewRow(), ui_ResultPacker::SendResults(), uires_FSTYPE, uires_PARTITIONACTIVITY, uires_PARTITIONSTATUS, and cmn_BitFlag_t::val.

00167                                                                  {
00168     log_FUNC_m(ListPartitions);
00169 
00170     ui_BitFlag  flags(a_filter);
00171 
00172     try {
00173         ui_ResultPacker result;
00174 
00175         vector<mif_PartEntry> allPart = m_partMgr.GetAllPart();
00176 
00177         if ( !allPart.empty() ) {
00178             result.NewRow(true);
00179 
00180             UInt32_t i = 0;
00181             while ( g_partitionTable[i].val != -1 ) {
00182                 if (flags.IsFlagSet(g_partitionTable[i].val)) {
00183                     result.Insert(bf_PartitionToText(static_cast<bf_Partition_e>(g_partitionTable[i].val)));
00184                 }
00185                 i++;
00186             }
00187         }
00188 
00189         for (UInt32_t i = 0; i < allPart.size(); ++i) {
00190             mif_PartEntry& part = allPart[i];
00191 
00192             i_Partition_t_var rmPart;
00193             ipc_EXEC_m(
00194                 rmPart = m_rm->SelectPartition(part.m_partName.c_str());
00195             );
00196 
00197             string partMntPoint;
00198             ivd_PartitionActivity_e partActivity;
00199             ivd_PartitionStatus_e   partStatus = GetPartitionStatus(part, partMntPoint, rmPart->status, partActivity);
00200 
00201             result.NewRow();
00202 
00203             if (flags.IsFlagSet(bf_PartName))
00204                 result.Insert(part.m_partName);
00205 
00206             if (flags.IsFlagSet(bf_PartUUID))
00207                 result.Insert(part.m_partUUID);
00208 
00209             if (flags.IsFlagSet(bf_PartStatus))
00210                 result.Insert(uires_PARTITIONSTATUS, static_cast<const UInt64_t>(partStatus));
00211 
00212             if (flags.IsFlagSet(bf_PartFsHost))
00213                 result.Insert(part.m_partHost);
00214 
00215             if (flags.IsFlagSet(bf_PartFsMountpoint))
00216                 result.Insert(partMntPoint);
00217 
00218             if (flags.IsFlagSet(bf_PartFsID))
00219                 result.Insert(rmPart->fsID);
00220 
00221             if (flags.IsFlagSet(bf_PartOptions))
00222                 result.Insert(uires_FSTYPE, GetFSType(rmPart->options));
00223 
00224             if (flags.IsFlagSet(bf_PartMigIdTime))
00225                 result.Insert(rmPart->migIdTime);
00226 
00227             if (flags.IsFlagSet(bf_PartMigIdCount))
00228                 result.Insert(rmPart->migIdCount);
00229 
00230             if (flags.IsFlagSet(bf_Activity))
00231                 result.Insert(uires_PARTITIONACTIVITY, static_cast<const UInt64_t>(partActivity));
00232 
00233         }
00234 
00235         result.SendResults(a_uims);
00236     } ipc_CATCH_IVD_THROW_CORBA_m
00237 
00238 }  // i_ManagementInterface_i::ListPartitions()

Here is the call graph for this function:

void i_ManagementInterface_i::EnablePartition ( const char *  a_name,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 410 of file i_mif_partition.cpp.

References dbg_NORM, mif_PartMgr::EnablePart(), evt_ERROR, evt_WARNING, ivd_BaseException::GetFriendly(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_partMgr, m_rm, rmdb_PARTITION_ENABLED, and rmdb_PARTITION_RECOVERY_MODE.

00411                                                                               {
00412     log_FUNC_m(EnablePartition);
00413 
00414     try {
00415 
00416         i_Partition_t_var partition;
00417         ostringstream msg;
00418 
00419         try {
00420             ipc_EXEC_m(
00421                 partition = m_rm->SelectPartition(a_partName);
00422                 log_DBG_m(dbg_NORM, "MIF: Partition is configured.");
00423                 if (partition->status == rmdb_PARTITION_ENABLED) {
00424                     msg << "Partition already enabled.";
00425                     log_WriteEvent(evt_WARNING, msg.str(),
00426                                    "PARTITION", 0, string(a_partName));
00427                     a_uims->DisplayWarning(msg.str().c_str());
00428                     return;
00429                 }
00430                 if (partition->status == rmdb_PARTITION_RECOVERY_MODE) {
00431                     msg << "Partition is in recovery mode.";
00432                     log_WriteEvent(evt_WARNING, msg.str(),
00433                                    "PARTITION", 0, string(a_partName));
00434                     a_uims->DisplayWarning(msg.str().c_str());
00435                     return;
00436                 }
00437             )
00438         }
00439         catch (ivd_Exception) {
00440             log_DBG_m(dbg_NORM, "MIF: Partition is not configured.");
00441             msg << "Cannot find partition.";
00442             log_WriteEvent(evt_WARNING, msg.str(),
00443                            "PARTITION", 0, string(a_partName));
00444             a_uims->DisplayWarning(msg.str().c_str());
00445             return;
00446         }
00447 
00448         //
00449         // update partition field in RMDB.
00450         try {
00451             ipc_EXEC_m(m_rm->EnablePartition(a_partName);)
00452         } catch (ivd_Exception &e) {
00453             msg << "Updating Partition Record in RMDB failed. " << e.GetFriendly();
00454             log_WriteEvent(evt_ERROR, msg.str(),
00455                            "PARTITION", 0, string(a_partName));
00456             a_uims->DisplayError(msg.str().c_str());
00457             return;
00458         }
00459 
00460         ostringstream sstr;
00461         sstr << "Partition enabled." ;
00462         log_WriteEvent(sstr.str(), "PARTITION", 0, string(a_partName));
00463         a_uims->DisplayMessage(sstr.str().c_str());
00464 
00465 
00466         //
00467         // start PM for this partition and notify the client
00468         try {
00469             m_partMgr.EnablePart(a_partName);
00470             msg << "Partition Manager started." ;
00471             log_WriteEvent(msg.str(), "PARTITION", 0, string(a_partName));
00472             a_uims->DisplayMessage(msg.str().c_str());
00473         }
00474         catch (ivd_Exception &e) {
00475             msg << "Starting Partition Manager failed. " << e.GetFriendly();
00476             log_WriteEvent(evt_ERROR, msg.str(),
00477                            "PARTITION", 0, string(a_partName));
00478             a_uims->DisplayError(msg.str().c_str());
00479         }
00480     }
00481     ipc_CATCH_IVD_THROW_CORBA_m
00482 } // i_ManagementInterface_i::EnablePartition()

Here is the call graph for this function:

void i_ManagementInterface_i::DisablePartition ( const char *  a_name,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 485 of file i_mif_partition.cpp.

References dbg_LOW, dbg_NORM, mif_PartMgr::DisablePart(), evt_ERROR, evt_WARNING, ivd_BaseException::GetFriendly(), mif_PartMgr::GetPart(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteEvent(), mif_PartEntry::m_iPM, m_partMgr, mif_PartEntry::m_partStatus, m_rm, mps_Online, rmdb_PARTITION_DISABLED, and rmdb_PARTITION_RECOVERY_MODE.

00486                                                                               {
00487     log_FUNC_m(DisablePartition);
00488 
00489     try {
00490         i_Partition_t_var partition;
00491         ostringstream msg;
00492 
00493         //
00494         // check if partition already disabled
00495         try {
00496             ipc_EXEC_m(
00497                 partition = m_rm->SelectPartition(a_partName);
00498                 log_DBG_m(dbg_NORM, "MIF: Partition is configured.");
00499 
00500                 if (partition->status & rmdb_PARTITION_DISABLED) {
00501                     msg << "Partition already disabled.";
00502                     log_WriteEvent(evt_WARNING, msg.str(),
00503                                    "PARTITION", 0, string(a_partName));
00504                     a_uims->DisplayWarning(msg.str().c_str());
00505                     return;
00506                 }
00507                 if (partition->status & rmdb_PARTITION_RECOVERY_MODE) {
00508                     msg << "Partition is in recovery mode.";
00509                     log_WriteEvent(evt_WARNING, msg.str(),
00510                         "PARTITION", 0, string(a_partName));
00511                     a_uims->DisplayWarning(msg.str().c_str());
00512                     return;
00513                 }
00514             );
00515         }
00516         catch (ivd_Exception) {
00517             log_DBG_m(dbg_NORM, "MIF: Partition is not configured.");
00518             msg << "Cannot find partition.";
00519             log_WriteEvent(evt_WARNING, msg.str(),
00520                            "PARTITION", 0, string(a_partName));
00521             a_uims->DisplayWarning(msg.str().c_str());
00522             return;
00523         }
00524 
00525         //
00526         // check if partition is mounted -> deny
00527         mif_PartEntry pe = m_partMgr.GetPart(a_partName);
00528         if (pe.m_partStatus == mps_Online) {
00529             i_HSM_var iHSM;
00530             try {
00531                 ipc_EXEC_m(
00532                     iHSM = pe.m_iPM->GetHSM();
00533                 );
00534                 if (!CORBA::is_nil(iHSM)) {
00535                     msg <<  "HSM File System mounted. Cannot disable partition.";
00536                     log_WriteEvent(evt_ERROR, msg.str(),
00537                                    "PARTITION", 0, string(a_partName));
00538                     a_uims->DisplayError(msg.str().c_str());
00539                     return;
00540                 }
00541             } catch (ivd_Error &e) {
00542                 log_DBG_m(dbg_LOW, "Could not contact PM: " << e);
00543                 // PM probably not running
00544             }
00545         }
00546 
00547         //
00548         // update partition field in RMDB.
00549         try {
00550             ipc_EXEC_m(m_rm->DisablePartition(a_partName);)
00551         }
00552         catch (ivd_Exception &e) {
00553             msg << "Updating Partition Record in RMDB failed. "
00554                 << e.GetFriendly();
00555             log_WriteEvent(evt_ERROR, msg.str(),
00556                            "PARTITION", 0, string(a_partName));
00557             a_uims->DisplayError(msg.str().c_str());
00558         }
00559 
00560         ostringstream sstr;
00561         sstr << "Partition disabled." ;
00562         log_WriteEvent(sstr.str(), "PARTITION", 0, string(a_partName));
00563         a_uims->DisplayMessage(sstr.str().c_str());
00564 
00565         //
00566         // stop PM for this partition and notify the client
00567         try {
00568             m_partMgr.DisablePart(a_partName);
00569             msg << "Partition Manager stopped.";
00570             log_WriteEvent(msg.str(), "PARTITION", 0, string(a_partName));
00571             a_uims->DisplayMessage(msg.str().c_str());
00572         }
00573         catch (ivd_Exception &e) {
00574             msg << "Stopping Partition Manager failed. " << e.GetFriendly();
00575             log_WriteEvent(evt_ERROR, msg.str(), "PARTITION", 0, string(a_partName));
00576             a_uims->DisplayError(msg.str().c_str());
00577         }
00578     }
00579     ipc_CATCH_IVD_THROW_CORBA_m
00580 } // i_ManagementInterface_i::DisablePartition()

Here is the call graph for this function:

void i_ManagementInterface_i::PartitionStatus ( const char *  a_name,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 241 of file i_mif_partition.cpp.

References ivd_BaseException::GetError(), mif_PartMgr::GetPart(), GetPartitionStatus(), ui_ResultPacker::GetUIResults(), ie_MIF_PARTITION_MGR, ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, jt_MAINT, jt_MIGRATION, jt_RECALL, jt_RECOVERY, log_FUNC_m, mif_PartEntry::m_iPM, mif_PartEntry::m_partHost, m_partMgr, mif_PartEntry::m_partName, mif_PartEntry::m_partStatus, m_rm, mps_Online, ui_ResultPacker::NewRow(), uires_PARTITIONSTATUS, and usage().

00242                                                                               {
00243     log_FUNC_m(PartitionStatus);
00244 
00245     try {
00246         ui_ResultPacker uires;
00247         uires.NewRow();
00248 
00249         try {
00250             mif_PartEntry pe = m_partMgr.GetPart(a_partName);
00251 
00252             uires.Insert("Partition:");
00253             uires.Insert(pe.m_partName);
00254             uires.NewRow();
00255 
00256             string partMntPoint;
00257             ivd_PartitionStatus_e  partStatus = GetPartitionStatus(pe, partMntPoint);
00258 
00259             uires.Insert("Status:");
00260             uires.Insert(uires_PARTITIONSTATUS, static_cast<const UInt64_t> (partStatus));
00261             uires.NewRow();
00262 
00263             uires.Insert("Host:");
00264             uires.Insert(pe.m_partHost);
00265             uires.NewRow();
00266 
00267             uires.Insert("Mountpoint:");
00268             uires.Insert(partMntPoint);
00269             uires.NewRow();
00270 
00271             if (pe.m_partStatus == mps_Online) {
00272                 UInt32_t numOfMigJobs(0);
00273                 UInt32_t numOfRecJobs(0);
00274                 UInt32_t numOfMaintJobs(0);
00275                 UInt32_t numOfRecoveryJobs(0);
00276 
00277                 i_JobParamsSeq_t_var jobParams;
00278                 ipc_EXEC_m(jobParams = pe.m_iPM->GetAllJobsParam();)
00279 
00280                 for (UInt32_t i(0); i < jobParams->length(); ++i){
00281                     switch (jobParams[i].jobType){
00282                         case(jt_MIGRATION):
00283                             ++numOfMigJobs;
00284                             break;
00285                         case(jt_RECALL):
00286                             ++numOfRecJobs;
00287                             break;
00288                         case(jt_MAINT):
00289                             ++numOfMaintJobs;
00290                             break;
00291                         case(jt_RECOVERY):
00292                             ++numOfRecoveryJobs;
00293                             break;
00294                         default: // unhandled jobType;
00295                             break;
00296                     }
00297                 }
00298                 uires.Insert("# of Migration Jobs:");
00299                 uires.Insert(numOfMigJobs);
00300                 uires.NewRow();
00301 
00302                 uires.Insert("# of Recall Jobs:");
00303                 uires.Insert(numOfRecJobs);
00304                 uires.NewRow();
00305 
00306                 uires.Insert("# of Maintenance Jobs:");
00307                 uires.Insert(numOfMaintJobs);
00308                 uires.NewRow();
00309 
00310                 uires.Insert("# of Recovery Jobs:");
00311                 uires.Insert(numOfRecoveryJobs);
00312                 uires.NewRow();
00313             }
00314         }
00315         catch (ivd_Exception& e){
00316             if (e.GetError() == ie_MIF_PARTITION_MGR) {
00317                 ostringstream msg;
00318                 msg << "Could not find partition " << a_partName;
00319                 a_uims->DisplayError(msg.str().c_str());
00320                 return;
00321             }
00322             else
00323                 throw;
00324         }
00325 
00326         // send results
00327         vector<i_UIResult_t> result = uires.GetUIResults();
00328         for (UInt32_t i = 0; i < result.size(); i++){
00329             ipc_EXEC_m(a_uims->DisplayResult(result[i]);)
00330         }
00331     }
00332     ipc_CATCH_IVD_THROW_CORBA_m
00333 
00334     // Get pool information for partition
00335     try {
00336         i_PoolInfoSeq_t_var poolInfo;
00337         ipc_EXEC_m(poolInfo = m_rm->PoolInfo(a_partName);)
00338 
00339         if (poolInfo->length() == 0) {
00340             // nothing found
00341             ipc_EXEC_m(
00342                 a_uims->DisplayWarning(
00343                 "No pools or media assigned to partition.");
00344             )
00345             return;
00346         }
00347 
00348         ui_ResultPacker uires;
00349         uires.NewRow(true); // header
00350         uires.Insert("Pool");
00351 
00352         uires.Insert("Size[MB]");
00353         uires.Insert("Avail[MB]");
00354         uires.Insert("Used[%]");
00355 
00356         uires.Insert("SysSize[MB]");
00357         uires.Insert("SysAvail[MB]");
00358         uires.Insert("SysUsed[%]");
00359 
00360         uires.Insert("#Good");
00361         uires.Insert("#Unreliable");
00362         uires.Insert("#Unusable");
00363         uires.Insert("#Uninit");
00364 
00365         for (UInt32_t i = 0; i < poolInfo->length(); ++i ){
00366             uires.NewRow();
00367             uires.Insert(poolInfo[i].poolName);
00368 
00369             uires.Insert(poolInfo[i].dataSize);
00370             uires.Insert(poolInfo[i].dataAvailable);
00371 
00372             if (poolInfo[i].dataSize > 0){
00373                 Int32_t usage =
00374                     static_cast<UInt32_t>(100L - (100L * poolInfo[i].dataAvailable / poolInfo[i].dataSize));
00375 
00376                 uires.Insert(usage);
00377             }
00378             else {
00379                 uires.Insert(0L);
00380             }
00381 
00382             uires.Insert(poolInfo[i].sysSize);
00383             uires.Insert(poolInfo[i].sysAvailable);
00384 
00385             if (poolInfo[i].sysSize > 0){
00386                 Int32_t sysUsage =
00387                     static_cast<UInt32_t>(100L - (100L * poolInfo[i].sysAvailable / poolInfo[i].sysSize));
00388                 uires.Insert(sysUsage);
00389             }
00390             else {
00391                 uires.Insert(0L);
00392             }
00393 
00394             uires.Insert(poolInfo[i].mediaGood);
00395             uires.Insert(poolInfo[i].mediaUnreliable);
00396             uires.Insert(poolInfo[i].mediaUnusable);
00397             uires.Insert(poolInfo[i].mediaUninitialized);
00398         }
00399 
00400         // send results
00401         vector<i_UIResult_t> result = uires.GetUIResults();
00402         for (UInt32_t i = 0; i < result.size(); i++){
00403             a_uims->DisplayResult(result[i]);
00404         }
00405     }
00406     ipc_CATCH_IVD_THROW_CORBA_m
00407 } // i_ManagementInterface_i::PartitionStatus()

Here is the call graph for this function:

void i_ManagementInterface_i::PartitionReorgStat ( const char *  a_name,
CORBA::ULong  a_threshold,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 1475 of file i_mif_partition.cpp.

References dbg_DETAIL, mif_PartMgr::GetPart(), ui_ResultPacker::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, log_DBG_m, log_FUNC_m, ipc_Log::LogMediumVol(), m_partMgr, m_rm, i_MediumVol_t::mediumBarcode, i_MediumVol_t::medVolNr, ui_ResultPacker::NewRow(), rmdb_MEDVOL_FULL, rmdb_MEDVOL_REORG_SCANNED, rmdb_MEDVOL_USED, rmdb_SYSTEM_VOLUME, ui_ResultPacker::SendResults(), i_MediumVol_t::status, i_MediumVol_t::totalData, uialign_RIGHT, i_MediumVol_t::validData, and i_MediumVol_t::volType.

01477                                                                                {
01478     log_FUNC_m(PartitionReorgStat);
01479 
01480     try {
01481         mif_PartEntry pe = m_partMgr.GetPart(a_name);
01482 
01483         ui_ResultPacker        result;
01484         i_MediumSeqByVol_t_var allMedVol;
01485         ipc_EXEC_m(
01486             allMedVol = m_rm->SelectAllMediumVolByPart(a_name);
01487         );
01488         if (allMedVol->length() > 0) {
01489             // insert header
01490             result.NewRow(true);
01491             result.Insert("Barcode");
01492             result.Insert("VolNum");
01493             result.Insert("ValidData[MB]");
01494             result.Insert("Total[MB]");
01495             result.Insert("SlackSpace[%]");
01496         }
01497 
01498         for (UInt32_t i = 0; i < allMedVol->length(); i++) {
01499             for (UInt32_t j = 0; j < allMedVol[i].length(); j++) {
01500 
01501                 i_MediumVol_t & mv = allMedVol[i][j];
01502                 log_DBG_m(dbg_DETAIL, ipc_Log::LogMediumVol(mv));
01503 
01504                 if (mv.volType == rmdb_SYSTEM_VOLUME) {
01505                     // do not consider system volume
01506                     continue;
01507                 }
01508                 if (!(mv.status & (rmdb_MEDVOL_USED | rmdb_MEDVOL_FULL))) {
01509                     // do not consider empty volume
01510                     continue;
01511                 }
01512 
01513                 UInt32_t slackSpace(0);
01514 
01515                 if ((mv.totalData > 0) &&
01516                     (mv.status & rmdb_MEDVOL_REORG_SCANNED)) {
01517                     // calculate slackspace only on scanned volumes
01518 
01519                     double temp(mv.validData);
01520                     slackSpace = 100 -
01521                         static_cast<UInt32_t>( (100 * temp) / mv.totalData );
01522                 }
01523 
01524                 if (slackSpace < a_threshold) {
01525                     // do not write this to output
01526                     continue;
01527                 }
01528 
01529                 // insert row
01530                 result.NewRow();
01531                 result.Insert(mv.mediumBarcode);
01532                 result.Insert(mv.medVolNr);
01533 
01534                 if (mv.status & rmdb_MEDVOL_REORG_SCANNED){
01535                     // volume is scanned
01536                     result.Insert(mv.validData);
01537                     result.Insert(mv.totalData);
01538                     result.Insert(slackSpace);
01539                 } else {
01540                     // volume is not scanned
01541                     result.Insert("n/a", uialign_RIGHT); // for validData
01542                     if (mv.totalData > 0) {
01543                         result.Insert(mv.totalData);
01544                     } else {
01545                         result.Insert("n/a", uialign_RIGHT); // for totalData
01546                     }
01547                     result.Insert("n/a", uialign_RIGHT);// slackSpace
01548                 }
01549             } // for (UInt32_t j = 0; j < allMedVol[i].length(); j++)
01550         } // for (UInt32_t i = 0; i < allMedVol->length(); i++)
01551 
01552         result.SendResults(a_uims);
01553     }
01554     ipc_CATCH_IVD_THROW_CORBA_m;
01555 } // i_ManagementInterface_i::PartitionReorgStat()

Here is the call graph for this function:

i_StringList_t * i_ManagementInterface_i::GetFSList ( const char *  a_client  ) 

Definition at line 1439 of file i_mif_partition.cpp.

References mif_PartMgr::GetClientFSIDs(), log_FUNC_m, and m_partMgr.

01439                                                                        {
01440     log_FUNC_m(GetFSList);
01441 
01442     string host(a_client);
01443     i_StringList_t_var fsList(new i_StringList_t());
01444 
01445     m_partMgr.GetClientFSIDs(host, fsList);
01446 
01447     return fsList._retn();
01448 }

Here is the call graph for this function:

i_Partition_t * i_ManagementInterface_i::GetPartition ( const char *  a_name  ) 

Definition at line 790 of file i_mif_partition.cpp.

References i_Partition_t::fsMountpoint, mif_PartMgr::GetPart(), GetPartitionStatus(), ipc_EXEC_m, log_FUNC_m, m_partMgr, m_rm, and i_Partition_t::status.

00790                                                                         {
00791     log_FUNC_m(GetPartition);
00792 
00793     i_Partition_t* part;
00794     ipc_EXEC_m(
00795                part = m_rm->SelectPartition(a_name);
00796     );
00797 
00798     mif_PartEntry pe = m_partMgr.GetPart(a_name);
00799     ivd_PartitionActivity_e partActivity;
00800     string partMntPoint;
00801     ivd_PartitionStatus_e   partStatus = GetPartitionStatus(pe, partMntPoint, part->status, partActivity);
00802     // Note that part->status and other values are filled in the RMDB query above.
00803     // see also bugs 7570 and 7641 for details
00804 
00805     part->fsMountpoint = CORBA::string_dup(partMntPoint.c_str());
00806     return part;
00807 }

Here is the call graph for this function:

i_Partition_t * i_ManagementInterface_i::GetPartitionByUUID ( const char *  a_uuid  ) 

Definition at line 810 of file i_mif_partition.cpp.

References log_FUNC_m, and m_rm.

00810                                                                               {
00811     log_FUNC_m(GetPartitionByUUID);
00812     return m_rm->SelectPartitionByUUID(a_uuid);
00813 }

void i_ManagementInterface_i::ListJobs ( string &  a_partName,
UInt32_t  a_jobTypeMask,
ui_ResultPacker a_uires,
bool  printHeader 
)

Definition at line 71 of file i_mif_job.cpp.

References dbg_DETAIL, dbg_LOW, dbg_NORM, GetAllAdminJobs(), mif_PartMgr::GetPart(), ui_ResultPacker::GetUIResults(), ie_DATA_CORRUPTION, ie_SELECT_ERROR, ui_ResultPacker::Insert(), ipc_EXEC_m, ivd_Error, job_MED_PROC, job_NA, job_NOT_STARTED, job_POST_MED_PROC, job_PRE_MED_PROC, job_STARTED, js_ACTIVATING, js_FIN_PROC_MED, js_FIN_READ_FROM_MED, js_FIN_WRITE_TO_MED, js_LOADING, js_NA, js_NOT_STARTED, js_PROC_MED, js_READ_IVDFS, js_READING_FROM_MED, js_READING_FSC, js_READY, js_STARTED, js_UNKNOWN, js_UPD_CHK_FSC, js_UPD_IVDFS, js_WAITING_FOR_SRC, js_WRITE_IVDFS, js_WRITING_TO_MED, jt_ADMIN, jt_BACKUP, jt_MAINT, jt_MIGRATION, jt_RECALL, jt_RECOVERY, jt_REORG, i_Resource_t::load, log_DBG_m, log_ERR_m, log_FUNC_A_m, ipc_Log::LogJobParams(), ipc_Log::LogResources(), m_partMgr, m_rm, mps_Online, ui_ResultPacker::NewRow(), i_Resource_t::resAssigned, i_Resource_t::resBeaStarted, i_Resource_t::resMedOpComplete, i_Resource_t::resProcessed, i_Resource_t::resRequested, cmn_Time::Time2YMDhms(), uialign_RIGHT, uires_JOBSTATUS, uires_JOBTYPE, and WaitingForResStatus().

Referenced by JobInfo().

00074                                                          {
00075     log_FUNC_A_m(ListJobs, "a_partName:" << a_partName <<
00076         " a_jobTypeMask:" << a_jobTypeMask <<
00077         " printHeader:" << boolalpha << printHeader );
00078 
00079     i_JobList_t_var jobList;
00080     try {
00081         if (!a_partName.empty()) {
00082             ipc_EXEC_m(
00083                 mif_PartEntry pe = m_partMgr.GetPart(a_partName);
00084                 if (pe.m_partStatus != mps_Online) {
00085                     throw ivd_Error(ie_SELECT_ERROR, 
00086                                     "Partition Manager not running");
00087                 }   
00088                 jobList = pe.m_iPM->GetAllJobs();
00089             )
00090         } else {
00091             ipc_EXEC_m ( //get admin jobs from this==MIF
00092                 jobList = this->GetAllAdminJobs();
00093             )
00094         }
00095     } catch (ivd_Exception){
00096         log_DBG_m(dbg_NORM, "Could not resolve PM:" << a_partName);
00097         throw;
00098     };
00099     
00100     if ( printHeader && 
00101         (jobList->length() > 0) && 
00102         (a_uires.GetUIResults().size() == 0)){
00103 
00104         a_uires.NewRow(true);
00105         a_uires.Insert("JobID");
00106         a_uires.Insert("Partition");
00107         a_uires.Insert("Type");
00108         a_uires.Insert("Priority");
00109         a_uires.Insert("Started");
00110         a_uires.Insert("Status");
00111 
00112     }
00113     
00114     log_DBG_m(dbg_DETAIL,"Found " << jobList->length() <<  " jobs running");
00115     
00116     for (UInt32_t numOfJobs = 0; numOfJobs < jobList->length(); numOfJobs++) {
00117         
00118         i_JobParams_var jobParam;
00119         try {
00120             ipc_EXEC_m(
00121                 if (!jobList[numOfJobs]->_is_nil() && 
00122                     !jobList[numOfJobs]->_non_existent()){
00123 
00124                     jobParam = jobList[numOfJobs]->GetJobParams();
00125                 } else {
00126                     log_DBG_m(dbg_DETAIL,"Job probably finished meanwhile ");
00127                     continue;
00128                 }
00129                 
00130             )
00131         }
00132         catch (ivd_Exception& e) {
00133             log_DBG_m(dbg_DETAIL,"Job probably finished meanwhile " << e);
00134             continue;
00135         }
00136         
00137         i_ResourceList_t_var jobResources;
00138         try {
00139             ipc_EXEC_m(jobResources = jobList[numOfJobs]->GetAllResource();)
00140         }
00141         catch (ivd_Exception& e) {
00142             log_DBG_m(dbg_DETAIL,"Job probably finished meanwhile " << e);
00143             continue;
00144         }
00145 
00146         log_DBG_m(dbg_DETAIL,"Processing Job: " <<
00147                             ipc_Log::LogJobParams(jobParam)<< endl <<
00148                             ipc_Log::LogResources(jobResources));
00149 
00150         if  ((a_jobTypeMask == 0) || (a_jobTypeMask | jobParam->jobType) ) {
00151             
00152             i_JobParamsSeq_t_var rmJobParams;
00153             UInt32_t jobInRM(0);
00154             try {
00155                 ipc_EXEC_m( rmJobParams = m_rm->GetJob(jobParam->jobID););
00156                 jobInRM = rmJobParams->length();
00157             }
00158             catch (ivd_Exception& e) {
00159                 log_DBG_m(dbg_LOW,e);
00160             }
00161             
00162             log_DBG_m(dbg_DETAIL,"Job has "  << jobParam->copies << 
00163                                     " copies" << endl << 
00164                                     jobInRM << " job copies waiting in RM");
00165 
00166             UInt32_t countJobWaitRes = 0;
00167 
00168             if (jobParam->status == job_MED_PROC){
00169                 //for each resource one row
00170                 for (UInt32_t copyNum = 0; copyNum < jobResources->length(); copyNum++) {
00171                     i_Resource_t& res = jobResources[copyNum];
00172                     a_uires.NewRow();
00173                     a_uires.Insert(jobParam->jobID);
00174                     a_uires.Insert(jobParam->partName);
00175                     a_uires.Insert(uires_JOBTYPE, jobParam->jobType);
00176 
00177                     if (!res.resRequested && jobParam->jobType == jt_ADMIN){
00178                         a_uires.Insert("n/a", uialign_RIGHT);
00179                         cmn_Time time = jobParam->startTime;
00180                         a_uires.Insert(time.Time2YMDhms());
00181                         a_uires.Insert(uires_JOBSTATUS, js_WAITING_FOR_SRC);
00182                         continue;
00183                     }
00184                     if (!res.resRequested && jobParam->jobType == jt_REORG){
00185                         a_uires.Insert("n/a", uialign_RIGHT);
00186                         cmn_Time time = jobParam->startTime;
00187                         a_uires.Insert(time.Time2YMDhms());
00188                         a_uires.Insert(uires_JOBSTATUS, js_WAITING_FOR_SRC);
00189                         continue;
00190                     }
00191                     if (!res.resRequested && jobParam->jobType == jt_MAINT){
00192                         a_uires.Insert("n/a", uialign_RIGHT);
00193                         cmn_Time time = jobParam->startTime;
00194                         a_uires.Insert(time.Time2YMDhms());
00195                         a_uires.Insert(uires_JOBSTATUS, js_WAITING_FOR_SRC);
00196                         continue;
00197                     }
00198                     if (!res.resRequested && jobParam->jobType == jt_RECALL){
00199                         a_uires.Insert("n/a", uialign_RIGHT);
00200                         cmn_Time time = jobParam->startTime;
00201                         a_uires.Insert(time.Time2YMDhms());
00202                         a_uires.Insert(uires_JOBSTATUS, js_READY);
00203                         continue;
00204                     }
00205                     if (res.resRequested && !res.resAssigned){
00206                         log_DBG_m(dbg_DETAIL,"Resource not assigned. Counter for waiting res " << countJobWaitRes);
00207                         if (countJobWaitRes < jobInRM){
00208                             log_DBG_m(dbg_DETAIL,"Priority of job" << 
00209                                 rmJobParams[countJobWaitRes].jobID << 
00210                                 "is: " << ((Int64_t)rmJobParams[countJobWaitRes].jobPriority +
00211                                 (Int64_t)rmJobParams[countJobWaitRes].priorityModifier));
00212 
00213                             a_uires.Insert( (Int64_t)rmJobParams[countJobWaitRes].jobPriority +
00214                                             (Int64_t)rmJobParams[countJobWaitRes].priorityModifier );
00215                             countJobWaitRes++;
00216                             
00217                         } 
00218                         else {
00219                             a_uires.Insert("n/a", uialign_RIGHT);
00220                             log_DBG_m(dbg_LOW,
00221                                 "Found more Jobs with unassigned " <<
00222                                 "resources than job waiting in RM" <<
00223                                 ipc_Log::LogJobParams(jobParam) << endl <<
00224                                 ipc_Log::LogResources(jobResources))
00225                         }
00226                         cmn_Time time = jobParam->startTime;
00227                         a_uires.Insert(time.Time2YMDhms());
00228                         a_uires.Insert(WaitingForResStatus(jobParam, res, copyNum));
00229                        
00230                     } else if (res.load && res.resAssigned && !res.resBeaStarted && !res.resProcessed ) {
00231                         a_uires.Insert("n/a", uialign_RIGHT);
00232                         cmn_Time time = jobParam->startTime;
00233                         a_uires.Insert(time.Time2YMDhms());
00234                         a_uires.Insert(uires_JOBSTATUS, js_LOADING);
00235                     } else if (!res.load && res.resAssigned && !res.resBeaStarted && !res.resProcessed ) {
00236                         a_uires.Insert("n/a", uialign_RIGHT);
00237                         cmn_Time time = jobParam->startTime;
00238                         a_uires.Insert(time.Time2YMDhms());
00239                         a_uires.Insert(uires_JOBSTATUS, js_READY);
00240                     } else if (res.resAssigned && res.resBeaStarted && !res.resProcessed) {
00241                         a_uires.Insert("n/a", uialign_RIGHT);
00242                         cmn_Time time = jobParam->startTime;
00243                         a_uires.Insert(time.Time2YMDhms());
00244                         if (jobParam->jobType == jt_RECALL || jobParam->jobType == jt_RECOVERY) {
00245                             a_uires.Insert(uires_JOBSTATUS, js_READING_FROM_MED);
00246                         }
00247                         else {
00248                             a_uires.Insert(uires_JOBSTATUS, js_ACTIVATING);
00249                         }
00250                     } else if ( res.resAssigned   &&
00251                                (res.resBeaStarted || (jobParam->jobType == jt_BACKUP))  &&
00252                                 res.resProcessed && 
00253                                !res.resMedOpComplete){
00254                         a_uires.Insert("n/a", uialign_RIGHT);
00255                         cmn_Time time = jobParam->startTime;
00256                         a_uires.Insert(time.Time2YMDhms());
00257                         switch (jobParam->jobType){
00258                             case (jt_MIGRATION):
00259                             case (jt_BACKUP):
00260                                 {
00261                                     a_uires.Insert(uires_JOBSTATUS, js_WRITING_TO_MED);
00262                                     break;
00263                                 };
00264                             case (jt_RECALL):
00265                             case (jt_RECOVERY):
00266                                 {
00267                                     a_uires.Insert(uires_JOBSTATUS, js_READING_FROM_MED);
00268                                     break;
00269                                 };
00270                             case (jt_ADMIN):
00271                             case (jt_REORG):
00272                             case (jt_MAINT):
00273                                 {
00274                                     a_uires.Insert(uires_JOBSTATUS, js_PROC_MED);
00275                                     break;
00276                                 };
00277                             default:
00278                                 {
00279                                     log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00280                                         ipc_Log::LogJobParams(jobParam) << 
00281                                         ipc_Log::LogResources(res) );
00282                                     a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00283                                 };
00284                         }
00285                     } else if ( res.resMedOpComplete){
00286                         a_uires.Insert("n/a", uialign_RIGHT);
00287                         cmn_Time time = jobParam->startTime;
00288                         a_uires.Insert(time.Time2YMDhms());
00289                         switch (jobParam->jobType){
00290                             case (jt_MIGRATION):
00291                             case (jt_BACKUP):
00292                                 {
00293                                     a_uires.Insert(uires_JOBSTATUS, js_FIN_WRITE_TO_MED);
00294                                     break;
00295                                 };
00296                             case (jt_RECALL):
00297                             case (jt_MAINT):
00298                             case (jt_RECOVERY):
00299                                 {
00300                                     a_uires.Insert(uires_JOBSTATUS, js_FIN_READ_FROM_MED);
00301                                     break;
00302                                 };
00303                             case (jt_ADMIN):
00304                             case (jt_REORG):
00305                                 {
00306                                     a_uires.Insert(uires_JOBSTATUS, js_FIN_PROC_MED);
00307                                     break;
00308                                 };
00309                             default:
00310                                 {
00311                                     log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00312                                         ipc_Log::LogJobParams(jobParam) << 
00313                                         ipc_Log::LogResources(res) );
00314                                     a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00315                                 };
00316                         }
00317                     } else if (jobParam->jobType == jt_MAINT && res.resMedOpComplete){
00318                         a_uires.Insert("n/a", uialign_RIGHT);
00319                         cmn_Time time = jobParam->startTime;
00320                         a_uires.Insert(time.Time2YMDhms());
00321                         a_uires.Insert(uires_JOBSTATUS, js_FIN_READ_FROM_MED);
00322                     } else if (jobParam->jobType == jt_MAINT && !res.resRequested){
00323                         a_uires.Insert("n/a", uialign_RIGHT);
00324                         cmn_Time time = jobParam->startTime;
00325                         a_uires.Insert(time.Time2YMDhms());
00326                         a_uires.Insert(uires_JOBSTATUS, js_NOT_STARTED);
00327                     } else {
00328                         log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00329                                     ipc_Log::LogJobParams(jobParam) << 
00330                                     ipc_Log::LogResources(res) );
00331                         
00332                         a_uires.Insert("n/a", uialign_RIGHT);
00333                         cmn_Time time = jobParam->startTime;
00334                         a_uires.Insert(time.Time2YMDhms());
00335                         a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00336                     }
00337                 }
00338             } else {
00339                 //just one row if medium processing completed
00340                 a_uires.NewRow();
00341                 a_uires.Insert(jobParam->jobID);
00342                 a_uires.Insert(jobParam->partName);
00343                 a_uires.Insert(uires_JOBTYPE, jobParam->jobType);
00344                 a_uires.Insert("n/a", uialign_RIGHT);
00345                 cmn_Time time = jobParam->startTime;
00346                 a_uires.Insert(time.Time2YMDhms());
00347                 
00348                 if (jobParam->status == job_NOT_STARTED) {
00349                     a_uires.Insert(uires_JOBSTATUS, js_NOT_STARTED);
00350                 }
00351                 else if (jobParam->status == job_STARTED) {
00352                     a_uires.Insert(uires_JOBSTATUS, js_STARTED);
00353                 }
00354                 else if (jobParam->status == job_PRE_MED_PROC) {
00355                     switch (jobParam->jobType) {
00356                         case (jt_MIGRATION):
00357                             {
00358                                 a_uires.Insert(uires_JOBSTATUS, js_READ_IVDFS);
00359                                 break;
00360                             };
00361                         case (jt_MAINT):
00362                             {
00363                                 a_uires.Insert(uires_JOBSTATUS, js_READING_FSC);
00364                                 break;
00365                             };
00366                         case (jt_BACKUP):
00367                         case (jt_RECALL):
00368                         case (jt_RECOVERY):
00369                         case (jt_ADMIN):
00370                         case (jt_REORG):
00371                             {
00372                                 a_uires.Insert(uires_JOBSTATUS, js_STARTED);
00373                                 break;
00374                             };
00375                         default:
00376                             {
00377                                 log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00378                                     ipc_Log::LogJobParams(jobParam));
00379                                 a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00380                             };
00381                     }
00382                 }
00383                 else if (jobParam->status == job_POST_MED_PROC) {
00384                     switch (jobParam->jobType) {
00385                         case (jt_MIGRATION):
00386                             {
00387                                 a_uires.Insert(uires_JOBSTATUS, js_UPD_IVDFS);
00388                                 break;
00389                             };
00390                         
00391                         case (jt_RECALL):
00392                             {
00393                                 a_uires.Insert(uires_JOBSTATUS, js_WRITE_IVDFS);
00394                                 break;
00395                             }
00396                         case (jt_MAINT):
00397                         case (jt_RECOVERY):
00398                             {
00399                                 a_uires.Insert(uires_JOBSTATUS, js_UPD_CHK_FSC);
00400                                 break;
00401                             }
00402                         case (jt_BACKUP):
00403                         case (jt_ADMIN):
00404                             {
00405                                 log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00406                                     ipc_Log::LogJobParams(jobParam) );
00407                                 a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00408                                 break;
00409                             }
00410                         default:
00411                             {
00412                                 log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00413                                     ipc_Log::LogJobParams(jobParam) );
00414                                 a_uires.Insert(uires_JOBSTATUS,js_UNKNOWN);
00415                                 break;
00416                             }
00417                     }
00418                     
00419                 }
00420                 else if (jobParam->status == job_NA) {
00421                     log_ERR_m("Impossible status JOB, job_NA" << 
00422                                 ipc_Log::LogJobParams(jobParam));
00423                     a_uires.Insert(uires_JOBSTATUS, js_NA);
00424                 }
00425                 else {
00426                     throw ivd_Error(ie_DATA_CORRUPTION, "Impossible status");
00427                 }
00428             }
00429         } //job in mask
00430     }//for all jobs
00431 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_ManagementInterface_i::ListAdminJobs ( ui_ResultPacker a_uires,
bool  printHeader 
)

void i_ManagementInterface_i::ListJob ( UInt64_t  a_jobId,
ui_ResultPacker a_uires 
)

Definition at line 437 of file i_mif_job.cpp.

References i_Resource_t::barcode, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, i_Resource_t::driveKey, job_Manager::FindJob(), mif_PartMgr::GetAllPart(), i_Job_i::GetJob(), ie_DATA_CORRUPTION, ie_JOB_NOT_FOUND, ui_ResultPacker::Insert(), ipc_EXEC_m, ivd_Error, job_MED_PROC, job_NA, job_NOT_STARTED, job_POST_MED_PROC, job_PRE_MED_PROC, job_STARTED, js_ACTIVATING, js_FIN_PROC_MED, js_FIN_READ_FROM_MED, js_FIN_WRITE_TO_MED, js_LOADING, js_NA, js_NOT_STARTED, js_PROC_MED, js_READ_IVDFS, js_READING_FROM_MED, js_READING_FSC, js_READY, js_STARTED, js_UNKNOWN, js_UPD_CHK_FSC, js_UPD_IVDFS, js_WAITING_FOR_SRC, js_WAITING_FOR_SRC_ALLOC, js_WRITE_IVDFS, js_WRITING_TO_MED, jt_ADMIN, jt_BACKUP, jt_MAINT, jt_MIGRATION, jt_RECALL, jt_RECOVERY, jt_REORG, i_Resource_t::load, log_DBG_m, log_ERR_m, log_FUNC_m, ipc_Log::LogJobParams(), ipc_Log::LogResources(), m_jobMgr, m_partMgr, m_rm, ui_ResultPacker::MakeNewBlock(), i_Resource_t::medVolNr, mps_Online, ui_ResultPacker::NewRow(), i_Resource_t::resAssigned, i_Resource_t::resBeaStarted, i_Resource_t::resMedOpComplete, i_Resource_t::resProcessed, i_Resource_t::resRequested, cmn_Time::Time2YMDhms(), uires_JOBSTATUS, uires_JOBTYPE, and WaitingForResStatus().

Referenced by JobInfoDetail().

00437                                                                                {
00438     log_FUNC_m(ListJob);
00439 
00440     bool found(false);
00441     i_Job_var iJob;
00442    
00443     // search MIF jobs (admin) 
00444     try {
00445         ipc_EXEC_m(
00446             iJob = m_jobMgr.FindJob(a_jobID)->GetJob();
00447             found = true;
00448         )
00449     }
00450     catch (ivd_Exception){
00451         log_DBG_m(dbg_NORM, "could not find Job in  Mif:");
00452     }
00453 
00454     // search all PM jobs (mig, rcl, check, recovery) 
00455     if (!found){
00456         vector<mif_PartEntry> allPart = m_partMgr.GetAllPart();
00457         for (UInt32_t i = 0; i < allPart.size(); i++){
00458             if (allPart[i].m_partStatus != mps_Online)
00459                 continue;
00460 
00461             try {
00462                 ipc_EXEC_m(
00463                     iJob = allPart[i].m_iPM->GetJob(a_jobID);
00464                     found = true;
00465                 )
00466             }
00467             catch (ivd_Exception){
00468                 log_DBG_m(dbg_NORM, "could not find Job in PM:" 
00469                           << allPart[i].m_partName);
00470             }
00471         }
00472     }
00473     
00474     if (!found) {
00475         throw ivd_Error(ie_JOB_NOT_FOUND, 
00476                         "Could not find job " + cmn_Num2Str(a_jobID));
00477     }
00478     
00479     
00480     log_DBG_m(dbg_NORM, "Found job " << a_jobID);
00481     
00482     i_JobParams_var jobParam;
00483     ipc_EXEC_m(jobParam = iJob->GetJobParams();)
00484 
00485     i_ResourceList_t_var jobResources;
00486     ipc_EXEC_m(jobResources = iJob->GetAllResource();)
00487 
00488     log_DBG_m(dbg_DETAIL,"Processing Job: " << 
00489         ipc_Log::LogJobParams(jobParam) << 
00490         endl << ipc_Log::LogResources(jobResources));
00491     
00492     
00493 
00494     UInt32_t jobInRM(0);
00495     i_JobParamsSeq_t_var rmJobParams;
00496     try {
00497         ipc_EXEC_m(
00498             rmJobParams = m_rm->GetJob(jobParam->jobID);
00499             jobInRM = rmJobParams->length();
00500         )
00501     }
00502     catch (ivd_Exception& e) {
00503         log_DBG_m(dbg_LOW,e);
00504     }
00505     
00506     log_DBG_m(dbg_DETAIL,"Job has "  << jobParam->copies << "copies" << endl << 
00507                          jobInRM << " job copies waiting in RM");
00508 
00509 
00510     a_uires.NewRow();
00511     a_uires.Insert("JobID:");
00512     a_uires.Insert(jobParam->jobID);
00513 
00514     a_uires.NewRow();
00515     a_uires.Insert("Partition:");
00516     a_uires.Insert(jobParam->partName);
00517 
00518     a_uires.NewRow();
00519     a_uires.Insert("Type:");
00520     a_uires.Insert(uires_JOBTYPE, static_cast<ivd_JobType_e>(jobParam->jobType));
00521 
00522     a_uires.NewRow();
00523     a_uires.Insert("Priority:");
00524     if (jobInRM > 0){
00525         a_uires.Insert((Int64_t)(rmJobParams[0].jobPriority));
00526         log_DBG_m(dbg_DETAIL,"rmJobParams[0].jobPriority: "  << rmJobParams[0].jobPriority);
00527     }
00528 
00529     cmn_Time time = jobParam->startTime;
00530     a_uires.NewRow();
00531     a_uires.Insert("Started:");
00532     a_uires.Insert(time.Time2YMDhms());
00533 
00534     a_uires.MakeNewBlock();
00535 
00536     a_uires.NewRow();
00537     a_uires.NewRow();
00538     a_uires.Insert("Copy");
00539     a_uires.Insert("Phase");
00540     a_uires.Insert("Drive");
00541     a_uires.Insert("Medium");
00542     a_uires.Insert("Volume");
00543     a_uires.Insert("Status");
00544     
00545     //reason for waiting
00546                             
00547                             
00548 
00549     if  (jobParam->status == job_NOT_STARTED){
00550         a_uires.NewRow();
00551         a_uires.Insert(1L);
00552         a_uires.Insert(jobParam->phase + 1);
00553         a_uires.Insert("n/a");
00554         switch (jobParam->jobType){
00555             case(jt_MIGRATION):
00556             case(jt_RECALL):
00557                 {
00558                     a_uires.Insert("n/a");
00559                     break;
00560                 };
00561             case (jt_ADMIN):
00562                 {
00563                     a_uires.Insert("n/a");
00564                     break;
00565                 };
00566             default:
00567                 {
00568                     a_uires.Insert("n/a");
00569                     break;
00570                 };
00571         };
00572         
00573         a_uires.Insert("n/a");
00574         a_uires.Insert(uires_JOBSTATUS, js_NOT_STARTED);
00575     } 
00576     else if  (jobParam->status == job_STARTED){
00577         a_uires.NewRow();
00578         a_uires.Insert(1L);
00579         a_uires.Insert(jobParam->phase + 1);        
00580         a_uires.Insert("n/a");
00581         switch (jobParam->jobType){
00582             case(jt_MIGRATION):
00583                 {
00584                     a_uires.Insert("n/a");
00585                     break;
00586                 };
00587             case (jt_RECALL):
00588             case (jt_ADMIN):
00589                 {
00590                     a_uires.Insert("n/a");
00591                     break;
00592                 };
00593             default:
00594                 {
00595                     a_uires.Insert("n/a");
00596                     break;
00597                 };
00598         };
00599         a_uires.Insert("n/a");
00600         a_uires.Insert(uires_JOBSTATUS, js_STARTED);
00601     } 
00602     else if  (jobParam->status == job_PRE_MED_PROC){
00603         a_uires.NewRow();
00604         a_uires.Insert(1L);
00605         a_uires.Insert(jobParam->phase + 1);
00606         a_uires.Insert("n/a");
00607         a_uires.Insert("n/a");
00608         a_uires.Insert("n/a");
00609         switch (jobParam->jobType){
00610             case (jt_MIGRATION):
00611                 {
00612                     a_uires.Insert(uires_JOBSTATUS, js_READ_IVDFS);
00613                     break;
00614                 };
00615             case (jt_MAINT):
00616                 {
00617                     a_uires.Insert(uires_JOBSTATUS, js_READING_FSC);
00618                     break;
00619                 };
00620             case (jt_BACKUP):
00621             case (jt_RECALL):
00622             case (jt_RECOVERY):
00623             case (jt_ADMIN):
00624             case (jt_REORG):
00625                 {
00626                     a_uires.Insert(uires_JOBSTATUS, js_STARTED);
00627                     break;
00628                 };
00629             default:
00630                 {
00631                     log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00632                         ipc_Log::LogJobParams(jobParam) );
00633                     a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00634                 };
00635         }
00636     } else if (jobParam->status == job_MED_PROC){
00637         //for each resource one row
00638         for (UInt32_t copyNum = 0; copyNum < jobResources->length(); copyNum++) {
00639             a_uires.NewRow();
00640             a_uires.Insert(copyNum + 1);
00641             a_uires.Insert(jobParam->phase + 1);
00642             i_Resource_t& res = jobResources[copyNum];
00643             i_Drive_t_var drv;
00644             log_DBG_m(dbg_DETAIL,"Selecting drive " << res.driveKey);
00645             if (jobResources[copyNum].driveKey > 0){
00646 
00647                 ipc_EXEC_m(drv = m_rm->SelectDriveByKey(res.driveKey);)
00648                     a_uires.Insert(drv->driveName);
00649             } else {
00650                 a_uires.Insert("n/a");
00651             }
00652             if (string(res.barcode).empty()){
00653                 a_uires.Insert("n/a");
00654                 a_uires.Insert("n/a");
00655             } else {
00656                 a_uires.Insert(res.barcode);
00657                 a_uires.Insert(res.medVolNr);
00658             }
00659 
00660             if (!res.resRequested){
00661                 if (jobParam->jobType == jt_ADMIN){
00662                     a_uires.Insert(uires_JOBSTATUS, js_WAITING_FOR_SRC_ALLOC);
00663                 } else if (jobParam->jobType == jt_REORG){
00664                     a_uires.Insert(uires_JOBSTATUS, js_WAITING_FOR_SRC);
00665                 } else if (jobParam->jobType == jt_RECALL){
00666                     a_uires.Insert(uires_JOBSTATUS, js_READY);
00667                 }
00668                 
00669             } else if (res.resRequested && !res.resAssigned){
00670                 a_uires.Insert(WaitingForResStatus(jobParam, jobResources[copyNum], copyNum));
00671             } else if (res.load && res.resAssigned && !res.resBeaStarted && !res.resProcessed ) {
00672                 a_uires.Insert(uires_JOBSTATUS,js_LOADING);
00673             } else if (!res.load && res.resAssigned && !res.resBeaStarted && !res.resProcessed ) {
00674                 a_uires.Insert(uires_JOBSTATUS,js_READY);
00675             } else if (res.resAssigned && res.resBeaStarted && !res.resProcessed) {
00676                 if (jobParam->jobType == jt_RECALL || jobParam->jobType == jt_RECOVERY ) {
00677                     a_uires.Insert(uires_JOBSTATUS, js_READING_FROM_MED);
00678                 }
00679                 else {
00680                     a_uires.Insert(uires_JOBSTATUS, js_ACTIVATING);
00681                 }
00682             } else if ( res.resAssigned   &&
00683                         (res.resBeaStarted || (jobParam->jobType == jt_BACKUP)) &&
00684                         res.resProcessed && 
00685                         !res.resMedOpComplete){
00686                     switch (jobParam->jobType){
00687                         case (jt_MIGRATION):
00688                         case (jt_BACKUP):
00689                             {
00690                                 a_uires.Insert(uires_JOBSTATUS,js_WRITING_TO_MED);
00691                                 break;
00692                             };
00693                         case (jt_RECALL):
00694                         case (jt_MAINT):
00695                         case (jt_RECOVERY):
00696                             {
00697                                 a_uires.Insert(uires_JOBSTATUS,js_READING_FROM_MED);
00698                                 break;
00699                             };
00700                         case (jt_ADMIN):
00701                         case (jt_REORG):
00702                             {
00703                                 a_uires.Insert(uires_JOBSTATUS,js_PROC_MED);
00704                                 break;
00705                             };
00706                         default:
00707                             {
00708                                 log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00709                                     ipc_Log::LogJobParams(jobParam) << 
00710                                     ipc_Log::LogResources(res) );
00711                                 a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00712                             };
00713                     }
00714                 } else if (res.resMedOpComplete){
00715                         switch (jobParam->jobType){
00716                             case (jt_MIGRATION):
00717                             case (jt_BACKUP):
00718                                 {
00719                                     a_uires.Insert(uires_JOBSTATUS,js_FIN_WRITE_TO_MED);
00720                                     break;
00721                                 };
00722                             case (jt_RECALL):
00723                             case (jt_MAINT):
00724                             case (jt_RECOVERY):
00725                                 {
00726                                     a_uires.Insert(uires_JOBSTATUS, js_FIN_READ_FROM_MED);
00727                                     break;
00728                                 };
00729                             case (jt_ADMIN):
00730                             case (jt_REORG):
00731                                 {
00732                                     a_uires.Insert(uires_JOBSTATUS, js_FIN_PROC_MED);
00733                                     break;
00734                                 };
00735                             default:
00736                                 {
00737                                     log_ERR_m("Unhandled Job Type:" << 
00738                                         ipc_Log::LogJobParams(jobParam));
00739                                     a_uires.Insert("n/a");
00740                                 };
00741                         }
00742                     } else if (jobParam->jobType == jt_MAINT && res.resMedOpComplete){
00743                         a_uires.Insert(uires_JOBSTATUS, js_FIN_READ_FROM_MED);
00744                     } else if (jobParam->jobType == jt_MAINT && !res.resRequested){
00745                         a_uires.Insert(uires_JOBSTATUS,js_NOT_STARTED);
00746                     } else {
00747                         log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00748                             ipc_Log::LogJobParams(jobParam) << 
00749                             ipc_Log::LogResources(res) );
00750                         a_uires.Insert(uires_JOBSTATUS, js_UNKNOWN);
00751                     }
00752         }
00753     } else if (jobParam->status == job_POST_MED_PROC){
00754         a_uires.NewRow();
00755         a_uires.Insert(1L);
00756         a_uires.Insert(jobParam->phase + 1);
00757         a_uires.Insert("n/a");
00758         a_uires.Insert("n/a");
00759         a_uires.Insert("n/a");
00760 
00761         switch (jobParam->jobType){
00762             case (jt_MIGRATION):
00763                 {
00764                     a_uires.Insert(uires_JOBSTATUS,js_UPD_IVDFS);
00765                     break;
00766                 };
00767             case (jt_MAINT):
00768             case (jt_RECOVERY):
00769                 {
00770                     a_uires.Insert(uires_JOBSTATUS,js_UPD_CHK_FSC);
00771                     break;
00772                 };
00773             case (jt_RECALL):
00774                 {
00775                     a_uires.Insert(uires_JOBSTATUS,js_WRITE_IVDFS);
00776                     break;
00777                 };
00778             case (jt_BACKUP):
00779             case (jt_ADMIN):
00780             case (jt_REORG):
00781             default:
00782                 {
00783                     log_DBG_m(dbg_LOW, "Unknown status of Job:" << 
00784                         ipc_Log::LogJobParams(jobParam) );
00785                     a_uires.Insert(uires_JOBSTATUS,js_NA);
00786                 };
00787         }
00788     } else if (jobParam->status == job_NA){
00789         log_ERR_m("Impossible status JOB, job_NA" << 
00790             ipc_Log::LogJobParams(jobParam));
00791     } else {
00792         throw ivd_Error(ie_DATA_CORRUPTION, "Impossible status");
00793     }
00794 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_ManagementInterface_i::SetJobPriority ( UInt64_t  a_jobId,
i_JobPriorityMod_e  a_chgType,
Int32_t  a_value,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 799 of file i_mif_job.cpp.

References dbg_DETAIL, dbg_NORM, ivd_BaseException::GetText(), ie_UNKNOWN_TYPE, ipc_EXEC_m, jp_ABSOLUTE, jp_RELATIVE, log_DBG_m, log_ERR_m, log_FUNC_A_m, and m_rm.

Referenced by SetPriority().

00801                                   {
00802     
00803     log_FUNC_A_m(SetJobPriority, a_jobId);
00804 
00805     try {
00806     
00807         i_JobParamsSeq_t_var jobParams;
00808 
00809         try {
00810             ipc_EXEC_m(
00811                 jobParams = m_rm->GetJob(a_jobId);
00812             )   
00813         } catch (ivd_Exception& e){
00814             log_DBG_m(dbg_DETAIL,"e.GetText()");
00815             a_uims->DisplayError( CORBA::string_dup(e.GetText().c_str()) );
00816             return;
00817         }
00818 
00819         if (jobParams->length() > 0){
00820             Int32_t newPriMod(0);
00821             switch (a_chgType){
00822                 case(jp_RELATIVE):{
00823                     log_DBG_m(dbg_NORM,"RELATIVE: jobParams[0].priorityModifier " << jobParams[0].priorityModifier <<
00824                                         "a_value" << a_value);
00825                     if ((jobParams[0].priorityModifier + a_value + jobParams[0].jobPriority) > 0){
00826                         newPriMod = jobParams[0].priorityModifier + a_value;
00827                         ipc_EXEC_m(m_rm->SetPriorityModifier(a_jobId, newPriMod);)
00828                     }
00829                     else {
00830                         log_DBG_m(dbg_DETAIL,"job priority would be negatine:"  << a_jobId) ;            
00831                         ostringstream ostr;
00832                         ostr << "Decrease priority of job:" << a_jobId;
00833                         ostr << " would result in negative value.";
00834 
00835                         ipc_EXEC_m(
00836                             a_uims->DisplayError(CORBA::string_dup(ostr.str().c_str() ));
00837                         )
00838                     }
00839                     break;
00840                 }
00841                 case(jp_ABSOLUTE):{
00842                     
00843                     newPriMod = jobParams[0].priorityModifier + 
00844                                 ( a_value - (jobParams[0].jobPriority + jobParams[0].priorityModifier) );
00845 
00846                     log_DBG_m(dbg_NORM,"ABSOLUTE: newPriMod(" << newPriMod << 
00847                                     ") = priorityModifier(" << jobParams[0].priorityModifier <<
00848                                     ") + a_value(" << a_value <<
00849                                     ") - jobPriority(" << jobParams[0].jobPriority <<
00850                                     ") + priorityModifier (" << jobParams[0].priorityModifier << ")");
00851                     ipc_EXEC_m(m_rm->SetPriorityModifier(a_jobId, newPriMod);)
00852                     break;
00853                 }
00854                 default:
00855                     throw ivd_InternalError(ie_UNKNOWN_TYPE,"Unknown priority modifier type");
00856             }
00857             
00858             
00859 
00860         } else {
00861             log_DBG_m(dbg_DETAIL,"Did not fine any Job with Id:"  << a_jobId) ;            
00862             ipc_EXEC_m(a_uims->DisplayError(
00863                 CORBA::string_dup("Did not fine any Job with Id:"  + a_jobId));
00864             )
00865         }
00866 
00867     } catch (ivd_Exception& e){
00868         log_ERR_m(e);  
00869     }
00870 }//i_ManagementInterface_i::SetJobPriority

Here is the call graph for this function:

Here is the caller graph for this function:

void i_ManagementInterface_i::MakeInventoryHeader ( ui_ResultPacker a_uires  ) 

Definition at line 200 of file i_mif_library.cpp.

References ui_ResultPacker::Insert(), log_FUNC_m, and ui_ResultPacker::NewRow().

Referenced by ShowLibraryInventory().

00200                                                                           {
00201     log_FUNC_m(MakeInventoryHeader);
00202     a_uires.NewRow(true);
00203     a_uires.Insert("Name");
00204     a_uires.Insert("Type");
00205     a_uires.Insert("Status");
00206     a_uires.Insert("Medium");
00207 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_Medium_t & i_ManagementInterface_i::GetMediumBySlot ( i_Slot_t a_slot,
i_MediumSeq_t a_medSeq 
)

Definition at line 176 of file i_mif_library.cpp.

References dbg_DETAIL, ie_RMDB_ERROR, ivd_Error, i_Slot_t::libraryName, log_DBG_m, log_FUNC_m, ipc_Log::LogMedium(), ipc_Log::LogSlot(), i_Slot_t::slotAddr, and i_Slot_t::slotType.

Referenced by ShowLibraryInventory().

00178                                                                             {
00179     log_FUNC_m(GetMediumBySlot);
00180     
00181     for (UInt32_t i(0); i < a_medSeq.length(); i++ ) {
00182         log_DBG_m(dbg_DETAIL,"a_slot "<< ipc_Log::LogSlot(a_slot));
00183         log_DBG_m(dbg_DETAIL,"medium "<< ipc_Log::LogMedium(a_medSeq[i]));
00184 
00185         if (   (strcmp(a_slot.slotAddr, a_medSeq[i].slotAddr) == 0)
00186             && (a_slot.slotType == a_medSeq[i].slotType)
00187             && (strcmp(a_slot.libraryName, a_medSeq[i].libraryName) == 0)) {
00188 
00189             return a_medSeq[i];
00190         }
00191     };
00192 
00193     throw ivd_Error(
00194         ie_RMDB_ERROR,
00195         "Slot has status rmdb_SLOT_IN_USE, "
00196         "but there is no medium assigned to it!");
00197 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_PartitionInfo_t i_ManagementInterface_i::ReportInfo ( string  partitionName  ) 

void i_ManagementInterface_i::ValidatePMConfig ( const cfg_PMCfg a_partCfg,
const string &  a_partUUID,
string  a_name 
)

Definition at line 816 of file i_mif_partition.cpp.

References cfg_PMCfg::clients, cfg_PMCfg::criticalWaterMark, dbg_NORM, mif_PartMgr::GetAllPart(), cfg_PMCfg::globalTreeOptions, cfg_PMCfg::highWaterMark, ie_CFG_INVALID, ie_MIF_CFG_ALREADY_CONFIGURED, ie_MIF_CFG_SEMANTIC_ERROR, ie_RMDB_NOTFOUND, ie_SEMANTIC_ERROR, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, cfg_PMCfg::lowWaterMark, m_partMgr, m_rm, cfg_PMCfg::maxMigSize, cfg_PMCfg::maxNumDrives, cfg_PMCfg::maxNumDrivesMaint, cfg_PMCfg::maxNumDrivesMigration, cfg_PMCfg::maxNumDrivesRecall, cfg_PMCfg::maxNumDrivesRecovery, cfg_PMCfg::maxNumDrivesReorg, cfg_PMCfg::maxNumMigFiles, cfg_PMCfg::maxWaitTime, cfg_PMCfg::minMigSize, cfg_PMCfg::minNumMigFiles, cfg_PMCfg::minWaitTime, cfg_PMTree::pools, and pt_Backup.

Referenced by AddPartition(), and UpdatePartition().

00819                                                    {
00820     log_FUNC_m(ValidatePMConfig);
00821 
00822     // validate migration criteria
00823     if (a_partCfg.maxWaitTime < a_partCfg.minWaitTime) {
00824         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00825                         "MaxWaitTime cannot be smaller than MinWaitTime");
00826     }
00827     if (a_partCfg.maxMigSize < a_partCfg.minMigSize) {
00828         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00829                         "MaxMigSize cannot be smaller than MinMigSize");
00830     }
00831     if (a_partCfg.maxNumMigFiles < a_partCfg.minNumMigFiles) {
00832         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00833                         "MaxNumMigFiles cannot be smaller than MinNumMigFiles");
00834     }
00835 
00836     // validate watermarks
00837     if (a_partCfg.highWaterMark >= a_partCfg.criticalWaterMark) {
00838         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00839                   "CriticalWatermark must be higher than HighWatermark");
00840     }
00841     if (a_partCfg.lowWaterMark >= a_partCfg.highWaterMark) {
00842         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00843                         "HighWatermark must be higher than LowWatermark");
00844     }
00845 
00846 #if 0
00847 // TODO: currently not used as defaults may be higher than MaxNumDrives
00848     // validate max number of drives
00849     if (a_partCfg.maxNumDrives < a_partCfg.maxNumDrivesMigration) {
00850         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00851                   "MaxNumDrivesMigration cannot be larger than MaxNumDrives");
00852     }
00853     if (a_partCfg.maxNumDrives < a_partCfg.maxNumDrivesRecall) {
00854         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00855                   "MaxNumDrivesRecall cannot be larger than MaxNumDrives");
00856     }
00857     if (a_partCfg.maxNumDrives < a_partCfg.maxNumDrivesReorg) {
00858         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00859                   "MaxNumDrivesReorg cannot be larger than MaxNumDrives");
00860     }
00861     if (a_partCfg.maxNumDrives < a_partCfg.maxNumDrivesRecovery) {
00862         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00863                   "MaxNumDrivesRecovery cannot be larger than MaxNumDrives");
00864     }
00865     if (a_partCfg.maxNumDrives < a_partCfg.maxNumDrivesMaint) {
00866         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00867                   "MaxNumDrivesMaint cannot be larger than MaxNumDrives");
00868     }
00869     // TODO: check ReserveDrives parameters!
00870 #endif
00871 
00872     if (a_partCfg.clients.size() > 1) {
00873         throw ivd_Error(ie_CFG_INVALID, "Only one client supported.");
00874     }
00875 
00876     // check if two clients with same name with same file system exist
00877     vector<mif_PartEntry> allPart =  m_partMgr.GetAllPart();
00878     for (UInt32_t i=0; i < allPart.size(); ++i) {
00879 
00880         // Note: only one client supported today
00881         if (allPart[i].m_partName != a_name
00882             && allPart[i].m_partHost == a_partCfg.clients[0].name
00883             && allPart[i].m_partFSID == a_partCfg.clients[0].fileSystemId) {
00884 
00885             throw ivd_Error(ie_MIF_CFG_ALREADY_CONFIGURED,
00886                             "The specified filesystem is already configured for a different partition.");
00887         }
00888     }
00889 
00890     //
00891     // At least one pool has to be configured
00892     if (a_partCfg.globalTreeOptions.pools.size() == 0) {
00893         throw ivd_Error(ie_SEMANTIC_ERROR,
00894                         "At least one pool has to be assigned to partition");
00895     }
00896 
00897     // Validate specified pools:
00898     //  - media pools are configured and are not backup pools;
00899     //  - media pools are not already assigned to other partition;
00900     //  - media pools for multiple copies have equal BlockSize parameters.
00901     UInt32_t blockSize(0);
00902     for (UInt32_t i=0; i < a_partCfg.globalTreeOptions.pools.size(); ++i) {
00903 
00904         string poolName = a_partCfg.globalTreeOptions.pools[i].Val();
00905         log_DBG_m(dbg_NORM, "Validate specified pool: " << poolName);
00906 
00907         i_MediaPool_t_var poolI;
00908         try {
00909             ipc_EXEC_m(
00910                 poolI =  m_rm->SelectMediaPool(
00911                                           CORBA::string_dup(poolName.c_str()));
00912             );
00913         }
00914         catch (ivd_Exception) {
00915             // TODO: RMDB could return specific error for not found
00916             throw ivd_Error(ie_RMDB_NOTFOUND,
00917                             "Specified pool not configured: " + poolName);
00918         }
00919 
00920         if (poolI->mediaPoolType == pt_Backup) {
00921             throw ivd_Error(ie_SEMANTIC_ERROR,
00922                             "Cannot assign backup pool to partition: "
00923                             + poolName);
00924         }
00925 
00926         if (strlen(poolI->partitionUUIDString) > 0
00927             && strcmp(poolI->partitionUUIDString, a_partUUID.c_str()) != 0) {
00928             throw ivd_Error(ie_SEMANTIC_ERROR,
00929                             "Pool already assigned to other partition: "
00930                             + poolName);
00931         }
00932 
00933         if (blockSize == 0) {
00934             blockSize = poolI->blockSize;
00935         }
00936         else if (poolI->blockSize != blockSize) {
00937             throw ivd_Error(ie_SEMANTIC_ERROR,
00938                             "Multiple copies can only use media pools with "
00939                             "equal BlockSize parameters.");
00940         }
00941     }
00942 } // mif_Partition::ValidatePMConfig()

Here is the call graph for this function:

Here is the caller graph for this function:

void i_ManagementInterface_i::ValidatePoolConfig ( const cfg_RMPool a_poolCfg  ) 

Definition at line 639 of file i_mif_pool.cpp.

References cfg_RMPool::blockSize, cfg_KILOBYTE, dbg_NORM, ie_MIF_CFG_SEMANTIC_ERROR, ipc_EXEC_m, ivd_Error, ivd_MediaFamilyToText(), log_DBG_m, log_FUNC_m, m_rm, cfg_RMPool::mediaFamily, mf_DISK, mf_LTO, mf_SAIT, mf_VXA, cfg_RMPool::name, cfg_RMPool::numOfVolumes, cfg_RMPool::poolType, pt_Backup, cfg_RMPool::sizeOfSysVol, svl_NONE, and cfg_RMPool::sysVolLocation.

Referenced by AddPool(), and UpdatePool().

00639                                                                             {
00640     log_FUNC_m(ValidatePoolConfig);
00641 
00642     ostringstream msg;
00643     msg <<"Can not configure "
00644         << ivd_MediaFamilyToText(a_poolCfg.mediaFamily)
00645         << " MediaPool. ";
00646 
00647     switch (a_poolCfg.mediaFamily) {
00648         case mf_LTO:
00649         case mf_VXA:
00650         case mf_SAIT:
00651         {
00652             if (a_poolCfg.sizeOfSysVol != 0) {
00653             throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00654                 msg.str() + "SizeOfSysVol should be 0.");
00655             }
00656             if (a_poolCfg.numOfVolumes != 1) {
00657             throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00658                 msg.str() + "Number of volumes should be 1.");
00659             }
00660             if (a_poolCfg.sysVolLocation != svl_NONE) {
00661                 throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00662                     msg.str() + "SysVolLocation should be NONE.");
00663             }
00664             break;
00665         }
00666         default:
00667             log_DBG_m(dbg_NORM, "Medium can have volumes.");
00668     }
00669 
00670     if ( (a_poolCfg.sysVolLocation != svl_NONE) && (a_poolCfg.numOfVolumes == 1)) {
00671         throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00672             msg.str() + "One volume defined but it is a system volume.");
00673     }
00674 
00675     msg << "Can not configure Backup MediaPool. ";
00676 
00677     if (a_poolCfg.poolType == pt_Backup) {
00678         if (a_poolCfg.numOfVolumes != 1) {
00679             throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00680                 msg.str() + "Medium should have only one volume.");
00681         }
00682 
00683         if (a_poolCfg.blockSize != 32*cfg_KILOBYTE) {
00684             throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00685                 msg.str() + "Block size should be 32Kb.");
00686         }
00687 
00688         if (a_poolCfg.mediaFamily == mf_DISK) {
00689             throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00690                 msg.str() + "Media family should not be DISK.");
00691         }
00692 
00693         //check if there is already a backup pool configured
00694         i_MediaPoolSeq_t_var poolSeq;
00695         ipc_EXEC_m(poolSeq = m_rm->SelectAllMediaPools(););
00696 
00697         for (unsigned int i = 0; i < poolSeq->length(); i++) {
00698             if ( (poolSeq[i].mediaPoolType == pt_Backup) &&
00699                 (a_poolCfg.name.compare(poolSeq[i].mediaPoolName) != 0) ) {
00700                 throw ivd_Error(ie_MIF_CFG_SEMANTIC_ERROR,
00701                     msg.str() + "Another backup pool already exists.");
00702             }
00703         }
00704     }
00705 }

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_PartitionStatus_e i_ManagementInterface_i::GetPartitionStatus ( mif_PartEntry a_pe,
string &  a_mtPoint 
) [private]

Definition at line 40 of file i_mif_partition.cpp.

Referenced by GetPartition(), GetPartitionStatus(), ListPartitions(), PartitionStatus(), ReportAllPartitions(), and SystemStatus().

00043       {
00044     UInt32_t rmdbPartStatus(0);
00045     ivd_PartitionActivity_e activity;
00046     return GetPartitionStatus(a_pe, a_mtPoint, rmdbPartStatus, activity);
00047 }

Here is the caller graph for this function:

ivd_PartitionStatus_e i_ManagementInterface_i::GetPartitionStatus ( mif_PartEntry a_pe,
string &  a_mtPoint,
UInt32_t  a_rmdbPartStatus,
ivd_PartitionActivity_e a_activity 
) [private]

Definition at line 50 of file i_mif_partition.cpp.

References dbg_DETAIL, dbg_NORM, ivd_BaseException::GetError(), GetPartitionStatus(), ie_LOST_HSM, ipc_EXEC_m, log_DBG_m, log_FUNC_m, mif_PartEntry::m_iPM, mif_PartEntry::m_partName, mif_PartEntry::m_partStatus, mps_Disabled, mps_Online, mps_Stopped, pa_HSMUNREACHABLE, pa_IDLE, pa_JOBSRUNNING, pa_MOUNTINPROG, pa_NOPM, pa_RECOVERYINPROG, pa_RECOVERYPENDING, pa_REORGSCANINPROG, pa_UNKNOWN, ps_DISABLED, ps_ERROR, ps_MOUNTED, ps_READY, ps_RECOVERYMODE, ps_UNKNOWN, and rmdb_PARTITION_REORG_SCAN_INPROG.

00055           {
00056     log_FUNC_m(GetPartitionStatus);
00057 
00058     ivd_PartitionStatus_e  status = ps_UNKNOWN;
00059     a_mtPoint = "<not mounted>";
00060     a_activity = pa_UNKNOWN;
00061 
00062     bool recovery(false);
00063     // first check if it is mounted
00064     switch (a_pe.m_partStatus) {
00065         case mps_Online:
00066             {
00067                 try {
00068                     ipc_EXEC_m(
00069                         if (a_pe.m_iPM->RecoveryMode()) {
00070                             status = ps_RECOVERYMODE;
00071                             recovery = true;
00072                             a_activity = pa_RECOVERYINPROG;
00073                         }
00074                         else if (a_pe.m_iPM->RecoveryNeeded()) {
00075                             status = ps_RECOVERYMODE;
00076                             recovery = true;
00077                             a_activity = pa_RECOVERYPENDING;
00078                         }
00079                     );
00080                     if (recovery == true) {
00081                         return status;
00082                     }
00083                 }
00084                 catch (const ivd_Error &e) {
00085                     // such case should not happen
00086                     log_DBG_m(dbg_DETAIL, "PM not running. Error: " << e);
00087                     status = ps_ERROR;
00088                     a_mtPoint = "<unknown>";
00089                     a_activity = pa_NOPM;
00090                     return status;
00091                 }
00092                 i_HSM_var iHSM;
00093 
00094                 try {
00095                     ipc_EXEC_m(iHSM = a_pe.m_iPM->GetHSM(););
00096                 }
00097                 catch (const ivd_Error &e) {
00098                     if (e.GetError() == ie_LOST_HSM){
00099                         status = ps_ERROR;
00100                         a_mtPoint = "<HSM unreachable>";
00101                         a_activity = pa_HSMUNREACHABLE;
00102                         return status;
00103                     }
00104                     else {
00105                         log_DBG_m(dbg_DETAIL, "Error while getting a reference to HSM. Error: " << e);
00106                         a_mtPoint = "<unknown>";
00107                         return status;
00108                     }
00109                 }
00110 
00111                 if ( CORBA::is_nil(iHSM) ) {
00112                     log_DBG_m(dbg_NORM, "MIF: HSM for partition "
00113                                 << a_pe.m_partName << " not running.");
00114                     status = ps_READY;
00115                     if (a_rmdbPartStatus & rmdb_PARTITION_REORG_SCAN_INPROG) {
00116                         a_activity = pa_REORGSCANINPROG;
00117                     }
00118                     else {
00119                         a_activity = pa_IDLE;
00120                     }
00121                 }
00122                 else {
00123                     i_HsmInfo_t_var hsmInfo;
00124                     try {
00125                         ipc_EXEC_m(iHSM->GetInfo(hsmInfo););
00126                         status = ps_MOUNTED;
00127                         if (a_rmdbPartStatus & rmdb_PARTITION_REORG_SCAN_INPROG) {
00128                             a_activity = pa_REORGSCANINPROG;
00129                         }
00130                         else {
00131                             i_JobList_t *jobs = a_pe.m_iPM->GetAllJobs();
00132                             if (jobs->length() == 0) {
00133                                 a_activity = pa_IDLE;
00134                             }
00135                             else {
00136                                 a_activity = pa_JOBSRUNNING;
00137                             }
00138                         }
00139                         a_mtPoint = hsmInfo->mountPoint;
00140                     }
00141                     catch (ivd_Error &e) {
00142                         log_DBG_m(dbg_NORM, e);
00143                         status = ps_READY;
00144                         a_activity = pa_MOUNTINPROG;
00145                         a_mtPoint = "n/a";
00146                     }
00147                 }
00148             }
00149         break;
00150 
00151         case mps_Disabled:
00152             status = ps_DISABLED;
00153             a_activity = pa_NOPM;
00154             break;
00155 
00156         case mps_Stopped:
00157             status = ps_ERROR;
00158             a_activity = pa_NOPM;
00159             break;
00160 
00161     }
00162     return status;
00163 } // i_ManagementInterface_i::GetPartitionStatus()

Here is the call graph for this function:

void i_ManagementInterface_i::GetMediumInfo ( const i_Medium_t a_medium,
ui_ResultPacker a_uires,
ui_BitFlag  a_flags 
) [private]

Definition at line 37 of file i_mif_medium.cpp.

References i_Medium_t::barcode, bf_MedBarcode, bf_MedBlockSize, bf_MedCurrentVolume, bf_MedDrvName, bf_MedDSSName, bf_MedIdxOfSysVol, bf_MedKey, bf_MedLibName, bf_MedLocation, bf_MedNumOfVolumes, bf_MedPartitionName, bf_MedPoolName, bf_MedSerialNo, bf_MedSizeOfSysVol, bf_MedSlotAddr, bf_MedSlotType, bf_MedStatus, bf_MedType, i_Medium_t::blockSize, i_Medium_t::currentVolume, dbg_DETAIL, i_Medium_t::diskSubsysName, i_Medium_t::driveName, i_Medium_t::idxOfSysVol, ui_ResultPacker::Insert(), ipc_EXEC_m, ui_BitFlag::IsFlagSet(), i_Medium_t::libraryName, i_Medium_t::location, log_DBG_m, log_FUNC_m, m_rm, i_Medium_t::mediaPoolName, i_Medium_t::mediumKey, i_Medium_t::mediumSerialNo, i_Medium_t::mediumType, ms_FREE, ms_UNINITIALIZED, mt_AIT_5, mt_AIT_5_WORM, mt_DISK, mt_LTO_1, mt_LTO_2, mt_LTO_3, mt_LTO_3_WORM, mt_LTO_4, mt_LTO_4_WORM, mt_LTO_5, mt_SAIT_1, mt_UNKNOWN, i_Medium_t::numOfVolumes, i_Medium_t::partitionName, i_Medium_t::sizeOfSysVol, i_Medium_t::slotAddr, i_Medium_t::slotType, i_Medium_t::status, uialign_RIGHT, uires_MEDIATYPE, uires_MEDIUMSTATUS, and uires_SLOTTYPE.

Referenced by ListMedia(), and ListSingleMedium().

00040                                                             {
00041 
00042     log_FUNC_m(GetMediumInfo);
00043 
00044     if (a_flags.IsFlagSet(bf_MedBarcode))
00045         a_uires.Insert(a_medium.barcode);
00046 
00047     if (a_flags.IsFlagSet(bf_MedType)) {
00048         a_uires.Insert(uires_MEDIATYPE,
00049                        a_medium.mediumType);
00050     }
00051 
00052     if (a_flags.IsFlagSet(bf_MedPoolName))
00053         a_uires.Insert(a_medium.mediaPoolName);
00054 
00055     if (a_flags.IsFlagSet(bf_MedLibName))
00056         a_uires.Insert(a_medium.libraryName);
00057 
00058     if (a_flags.IsFlagSet(bf_MedSlotAddr))
00059         a_uires.Insert(a_medium.slotAddr);
00060 
00061     if (a_flags.IsFlagSet(bf_MedSlotType))
00062         a_uires.Insert(uires_SLOTTYPE,
00063                        a_medium.slotType);
00064 
00065     if (a_flags.IsFlagSet(bf_MedDSSName))
00066         a_uires.Insert(a_medium.diskSubsysName);
00067 
00068     if (a_flags.IsFlagSet(bf_MedDrvName))
00069         a_uires.Insert(a_medium.driveName);
00070            
00071     if (a_flags.IsFlagSet(bf_MedStatus)) {
00072 
00073         if (a_medium.status == 0) {
00074             ipc_EXEC_m(
00075                 i_MediumVolSeq_t_var mv;
00076                 mv = m_rm->SelectAllMediumVolByBarcode(a_medium.barcode);
00077                 if (mv->length() > 0 ) {
00078                     a_uires.Insert(uires_MEDIUMSTATUS, ms_FREE);
00079                 }
00080                 else {
00081                     a_uires.Insert(uires_MEDIUMSTATUS, ms_UNINITIALIZED);
00082                 }
00083             );
00084         }
00085         else {
00086             a_uires.Insert(uires_MEDIUMSTATUS, a_medium.status);
00087         }
00088     }
00089             
00090     if (a_flags.IsFlagSet(bf_MedLocation)) {
00091     
00092         ostringstream sstr;
00093         bool inLib(strlen(a_medium.libraryName) > 0);
00094         bool inDrv(strlen(a_medium.driveName) > 0);
00095 
00096         if (inLib || inDrv) {
00097             if (inDrv) {
00098                 sstr << "drv:" << a_medium.driveName;
00099                 if (inLib)
00100                     sstr << " (";
00101             }
00102             if (inLib) {
00103                 sstr << "lib:" << a_medium.libraryName << ":"
00104                      << a_medium.slotAddr;
00105             }
00106             if (inDrv)
00107                 sstr << ")";
00108 
00109             a_uires.Insert(sstr.str());
00110         } 
00111         else if ( strlen(a_medium.location) > 0 ) {
00112             a_uires.Insert(a_medium.location);
00113         } 
00114         else if ( a_medium.mediumType == mt_DISK)
00115             a_uires.Insert("n/a");
00116         else if ( a_medium.mediumType == mt_UNKNOWN)
00117             a_uires.Insert("n/a");
00118         else
00119             a_uires.Insert("offline");
00120 
00121     }
00122             
00123     if (a_flags.IsFlagSet(bf_MedSerialNo))
00124         a_uires.Insert(a_medium.mediumSerialNo);
00125 
00126     if (a_flags.IsFlagSet(bf_MedBlockSize))
00127         a_uires.Insert(a_medium.blockSize);
00128 
00129     if (a_flags.IsFlagSet(bf_MedNumOfVolumes))
00130         a_uires.Insert(a_medium.numOfVolumes);
00131 
00132     if (a_flags.IsFlagSet(bf_MedIdxOfSysVol)) {
00133         if ((a_medium.mediumType == mt_SAIT_1)      ||
00134             (a_medium.mediumType == mt_AIT_5)       ||
00135             (a_medium.mediumType == mt_AIT_5_WORM)  ||
00136             (a_medium.mediumType == mt_LTO_1)       ||
00137             (a_medium.mediumType == mt_LTO_2)       ||
00138             (a_medium.mediumType == mt_LTO_3)       ||
00139             (a_medium.mediumType == mt_LTO_3_WORM)  ||
00140             (a_medium.mediumType == mt_LTO_4)       ||
00141             (a_medium.mediumType == mt_LTO_4_WORM)  ||
00142             (a_medium.mediumType == mt_LTO_5)       ||
00143             (a_medium.mediumType == mt_DISK) ) {
00144             a_uires.Insert("n/a", uialign_RIGHT);
00145         } else {
00146             a_uires.Insert(a_medium.idxOfSysVol);
00147         }
00148     }
00149 
00150     if (a_flags.IsFlagSet(bf_MedSizeOfSysVol)) {
00151         if ((a_medium.mediumType == mt_SAIT_1)      ||
00152             (a_medium.mediumType == mt_AIT_5)       ||
00153             (a_medium.mediumType == mt_AIT_5_WORM)  ||
00154             (a_medium.mediumType == mt_LTO_1)       ||
00155             (a_medium.mediumType == mt_LTO_2)       ||
00156             (a_medium.mediumType == mt_LTO_3)       ||
00157             (a_medium.mediumType == mt_LTO_3_WORM)  ||
00158             (a_medium.mediumType == mt_LTO_4)       ||
00159             (a_medium.mediumType == mt_LTO_4_WORM)  ||
00160             (a_medium.mediumType == mt_LTO_5)       ||
00161             (a_medium.mediumType == mt_DISK)        ||
00162             (a_medium.idxOfSysVol == 0)) {
00163 
00164             a_uires.Insert("n/a", uialign_RIGHT);
00165         } else {
00166             a_uires.Insert(a_medium.sizeOfSysVol);
00167         }
00168     }
00169 
00170     if (a_flags.IsFlagSet(bf_MedCurrentVolume)) {
00171         log_DBG_m(dbg_DETAIL, "med.currentVolume:" << a_medium.currentVolume);
00172         if (a_medium.currentVolume == -1) {
00173             a_uires.Insert("n/a");
00174         } else {
00175             a_uires.Insert(a_medium.currentVolume);
00176         }
00177                 
00178     }
00179             
00180     if (a_flags.IsFlagSet(bf_MedPartitionName))
00181         a_uires.Insert(a_medium.partitionName);
00182 
00183     if (a_flags.IsFlagSet(bf_MedKey))
00184         a_uires.Insert(a_medium.mediumKey);
00185 
00186     
00187 
00188 } // i_ManagementInterface_i::GetMediumInfo()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

i_ResourceManager_var i_ManagementInterface_i::m_rm

Definition at line 448 of file i_mif_impl.h.

Referenced by i_ManagementInterface_i(), and mif_PartMgr::StartPM().

i_LibraryAgent_var i_ManagementInterface_i::m_la [private]

Definition at line 473 of file i_mif_impl.h.

Reimplemented from i_Component_i.

Definition at line 475 of file i_mif_impl.h.


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

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