rm_Operator Class Reference

#include <rm_operator.h>

Collaboration diagram for rm_Operator:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 25 of file rm_operator.h.


Private Member Functions

 rm_Operator ()
 ~rm_Operator ()
void MediumLoaded (string a_libName, string a_medBarcode, string a_driveAddr)
void MediumUnLoaded (string a_libName, string a_medBarcode, string a_slotAddr, UInt32_t a_slotType)
void VolumeFull (string a_medVolId)
void VolumeEmpty (string a_medVolId)
void VolumeListStatusSet (UInt32_t a_medKey, i_ULongList_t a_volumes, UInt32_t a_status)
 Performs setting of status flag for all required volumes.
void InventoryUpdate (string a_libName, const i_UpdateList_t &a_elemStatus)
 Performs update of the RMDB based on the current situation in the library.
void Add (i_Library_t a_library)
void Add (i_Drive_t a_drive)
void Add (i_DriveHost_t a_driveHost)
void Add (i_DiskSubsys_t a_dss)
void Add (i_Slot_t a_slot)
void Add (i_MediaPool_t a_mediaPool)
void Add (i_Medium_t a_medium)
void Add (i_MediumVol_t a_mediumVol)
void Add (i_MajorCol_t &a_majorCol)
void Add (i_MinorCol_t &a_minorCol)
void Add (i_ColMediaVol_t &a_colMediaVol)
void CheckAndAdd (i_ColMediaVol_t &a_colMediaVol, UInt32_t a_flags)
void RemoveLibrary (string a_libraryName)
void RemoveDrive (string a_driveName)
void RemoveDriveHost (string a_driveName, string a_host)
void RemoveDSS (string a_dssName)
void RemoveSlot (string a_slotAddr, string a_libraryName, Int32_t a_slotType)
void RemoveMediaPool (string a_mediaPoolName)
void RemoveMedium (string a_mediumBarcode)
void RemoveMediumVol (string a_mediumBarcode, Int32_t a_mediumVolNr)
void RemoveMajorCol (UInt64_t a_majorCol)
void RemoveMinorCol (UInt64_t a_minorCol)
void RemoveColMediaVol (string &a_mediumBarcode, Int32_t a_medVolNr)
void RemoveColIDs (string &a_partUUID)
void InitAllLibrary ()
void InitAllDrive ()
void InitAllDriveHost ()
void InitAllDSS ()
void InitAllSlot ()
void InitAllMediaPool ()
void InitAllMedium ()
void InitAllMediumVol ()
i_Library_t SelectLibrary (string a_libraryName)
i_Drive_t SelectDrive (string a_driveName)
i_DriveHost_t SelectDriveHost (string a_driveName, string a_host)
i_DiskSubsys_t SelectDSS (string a_dssName)
i_Slot_t SelectSlot (string a_slotAddr, string a_libraryName, Int32_t a_slotType)
i_MediaPool_t SelectMediaPool (string a_mediaPoolName)
i_MediaPool_t SelectMediaPoolbyUUID (string a_mediaPoolUUID)
i_Medium_t SelectMedium (string a_mediumBarcode)
i_MediumVol_t SelectMediumVol (string a_mediumBarcode, Int32_t a_mediumVolNr)
i_MinorCol_t SelectMinorCol (UInt64_t a_minColId)
i_MajorCol_t SelectMajorCol (UInt64_t a_majColId)
i_Library_t SelectLibrary (Int32_t a_libraryKey)
i_Drive_t SelectDrive (Int32_t a_driveKey)
i_DriveHost_t SelectDriveHost (Int32_t a_driveKey, string a_host)
i_DiskSubsys_t SelectDSS (Int32_t a_dssKey)
i_Slot_t SelectSlot (string a_slotAddr, Int32_t a_libraryKey, Int32_t a_slotType)
i_MediaPool_t SelectMediaPool (Int32_t a_mediumPoolKey)
i_Medium_t SelectMedium (Int32_t a_mediumKey)
i_Medium_t SelectMediumByDrive (string a_driveName)
i_MediumVol_t SelectMediumVol (Int32_t a_mediumKey, Int32_t a_mediumVolNr)
i_MediumVol_t SelectMediumVol (string a_medVolId)
i_ColMediaVolSeq_t SelectAllColVolumes ()
i_DriveSeq_t SelectAllDrives ()
i_MinorColSeq_t SelectAllMinorCol ()
i_MinorColSeq_t SelectAllMinColByMajCol (UInt64_t a_majColId)
i_MajorColSeq_t SelectAllMajorCol ()
i_LibrarySeq_t SelectAllLibraries ()
i_DriveHostSeq_t SelectAllDriveHosts ()
i_DssSeq_t SelectAllDSS ()
i_SlotSeq_t SelectAllSlots ()
i_MediaPoolSeq_t SelectAllMediaPools ()
i_MediumSeq_t SelectAllMedium ()
i_MediumVolSeq_t SelectAllMediumVol ()
i_MediumVolSeq_t SelectAllMediumVolByMedium (string a_barcode)
i_MediumSeqByVol_t SelectAllMediumVolByPart (string &a_partName, bool a_unRecovered)
i_MediumSeq_t SelectAllMediaByPart (string &a_partName)
i_MediaInfoSeq_t GetMediaInfo (rm_String &a_partName)
bool IsSomeVolumeUsed (string &a_partName)
void SetRecoveryFlag (string &a_medVolId)
void ClearRecoveryFlag (string &a_medVolId)
void Update (i_Library_t &a_library)
void Update (i_Drive_t a_drive)
void Update (i_DriveHost_t a_driveHost)
void Update (i_DiskSubsys_t a_dss)
void Update (i_Slot_t a_slot)
void Update (i_MediaPool_t a_mediaPool)
void Update (i_Medium_t a_medium)
void Update (i_MediumVol_t a_mediumVol)
void Update (i_MajorCol_t &a_majorCol)
void Update (i_MinorCol_t &a_minorCol)
void AutoDetect (rm_Library a_library)
void AutoDetect (rm_Drive a_drive)
void AutoDetect (rm_DriveHost a_driveHost)
void AutoDetect (rm_DiskSubsys a_dss)
void AutoDetect (rm_Slot a_slot)
void AutoDetect (rm_MediaPool a_mediaPool)
void AutoDetect (rm_Medium a_medium)
void AutoDetect (rm_MediumVol a_mediumVol)
UInt32_t GetBestCopy (rm_CopiesPos_v_t &a_mediumTable)
i_DriveHost_t GetHost (Int32_t a_driveKey)
void AllocateRecall (rm_Resource_t &a_resource)
bool AllocateMigCollocation (bool a_online, rm_Resource_t &a_resource)
void UpdateCollocation (rm_Resource_t &a_resource)
bool AllocateMigDefault (bool a_online, bool a_newVol, rm_Resource_t &a_resource)
void AllocateMig (bool a_online, rm_ResourceTable_t &a_resourceTable)
vector< rm_ColAllocSelectColAlloc (UInt64_t a_majColId, UInt32_t a_poolKey)
bool SelectMediumForMig (bool a_online, bool a_newVol, rm_Resource_t &a_resource)
bool IsDriveWORM (rm_Drive &a_drv)
bool IsMediumWORM (rm_Medium &a_med)
bool SelectDriveForMig (rm_Resource_t &a_resource)
void CheckForAnyResourceForMig (rm_Resource_t &res, bool a_online)
bool SelectMediumVolumeMig (rm_Medium &a_med, rm_MediumVol &a_mv)
bool SelectMediumVolumeCol (rm_Medium &a_med, UInt32_t &a_volNum)
bool SelectOpenedVolume (rm_Resource_t &a_resource, vector< rm_ColAlloc > &a_colAlloc)
bool CheckMediumFull (UInt32_t a_mediumKey)
void AllocateAdmin (rm_ResourceTable_t &a_resourceTable)
void ReleaseResources (const i_ResourceList_t &a_resources, const ivd_JobType_e a_jobType)
i_PartSeq_t SelectAllPart ()
rm_Partition SelectPartition (rm_String a_partName)
rm_Partition SelectPartitionByUuid (rm_String a_partUuid)
void UpdatePartition (rm_Partition a_part)
void InsertPartition (rm_Partition a_part)
void RemovePartition (rm_String a_partName)
void PoolInfo (rm_String &a_partitionName, i_PoolInfoSeq_t &a_poolInfo)

Private Attributes

rm_DB m_dataBase
 log_CLASSID_m

Friends

class rm_DBThread
class rm_DBOperation
class dbo_SelectLibrary
class dbo_SelectLibraryByKey
class dbo_SelectAllLibraries
class dbo_UpdateLibrary
class dbo_AddLibrary
class dbo_RemoveLibrary
class dbo_SelectAllMajorCol
class dbo_AddMajorCol
class dbo_RemoveMajorCol
class dbo_UpdateMajorCol
class dbo_SelectMajorCol
class dbo_SelectAllMinorCol
class dbo_SelectMinColByMajCol
class dbo_AddMinorCol
class dbo_RemoveMinorCol
class dbo_UpdateMinorCol
class dbo_SelectMinorCol
class dbo_SelectAllColVolumes
class dbo_SelectAllColMediaVol
class dbo_AddColMediaVol
class dbo_CheckAndAddColMediaVol
class dbo_RemoveColMediaVol
class dbo_RemoveColIDs
class dbo_GetMediaInfo
class dbo_SelectDrive
class dbo_SelectDriveByKey
class dbo_UpdateDrive
class dbo_AddDrive
class dbo_RemoveDrive
class dbo_SelectAllDrives
class dbo_SelectDriveHost
class dbo_SelectDriveHostByKey
class dbo_UpdateDriveHost
class dbo_AddDriveHost
class dbo_RemoveDriveHost
class dbo_SelectAllDriveHosts
class dbo_SelectDiskSubsys
class dbo_SelectDiskSubsysByKey
class dbo_UpdateDiskSubsys
class dbo_AddDiskSubsys
class dbo_RemoveDiskSubsys
class dbo_SelectAllDiskSubsys
class dbo_SelectSlot
class dbo_SelectSlotByKey
class dbo_UpdateSlot
class dbo_AddSlot
class dbo_RemoveSlot
class dbo_SelectAllSlots
class dbo_SelectMediaPool
class dbo_SelectMediaPoolbyUUID
class dbo_SelectMediaPoolByKey
class dbo_UpdateMediaPool
class dbo_AddMediaPool
class dbo_RemoveMediaPool
class dbo_SelectAllMediaPool
class dbo_SelectMedium
class dbo_SelectMediumByKey
class dbo_SelectMediumByDrive
class dbo_UpdateMedium
class dbo_AddMedium
class dbo_RemoveMedium
class dbo_SelectAllMedium
class dbo_SelectMediumVol
class dbo_SelectMediumVolByKey
class dbo_SelectMediumVolByUUID
class dbo_UpdateMediumVol
class dbo_AddMediumVol
class dbo_RemoveMediumVol
class dbo_SelectAllMediumVol
class dbo_SelectAllMediumVolByPart
class dbo_SelectAllMediaByPart
class dbo_SetRecoveryFlag
class dbo_ClearRecoveryFlag
class dbo_UpdateDataSize
class dbo_GetBestCopy
class dbo_MediumLoaded
class dbo_MediumUnloaded
class dbo_VolumeEmpty
class dbo_VolumeFull
class dbo_VolumeError
class dbo_VolumeUsage
class dbo_MediumUnreliable
class dbo_MediumUnusable
class dbo_MediumStatusSet
class dbo_MediumStatusClear
class dbo_MedVolStatusSet
class dbo_MedVolStatusClear
class dbo_VolumeListStatusSet
class dbo_DriveStatusSet
class dbo_DriveStatusClear
class dbo_DriveError
class dbo_LibraryStatusSet
class dbo_LibraryStatusClear
class dbo_InventoryUpdate
class dbo_InitAllResource
class dbo_AllocateMig
class dbo_AllocateRec
class dbo_AllocateAdmin
class dbo_ReleaseResources
class dbo_GetHost
class dbo_SelectAllPartition
class dbo_DisablePartition
class dbo_EnablePartition
class dbo_InsertPartition
class dbo_SelectPartition
class dbo_SelectPartitionByUuid
class dbo_RemovePartition
class dbo_UpdatePartition
class dbo_SetPartitionStatus
class dbo_ClearPartitionStatus
class dbo_SelectAllMediumVolByBarcode
class dbo_PoolInfo
class dbo_SetReorgScan
class dbo_ClearReorgScan
class dbo_IsSomeVolumeUsed

Constructor & Destructor Documentation

rm_Operator::rm_Operator (  )  [private]

Definition at line 56 of file rm_operator.cpp.

References rm_DB::Connect(), log_FUNC_m, and m_dataBase.

00056                          {
00057     log_FUNC_m(rm_Operator);
00058     m_dataBase.Connect();
00059 }

Here is the call graph for this function:

rm_Operator::~rm_Operator (  )  [private]

Definition at line 61 of file rm_operator.cpp.

References rm_DB::Disconnect(), log_FUNC_m, and m_dataBase.

00061                           {
00062     log_FUNC_m(~rm_Operator);
00063     m_dataBase.Disconnect();
00064 }

Here is the call graph for this function:


Member Function Documentation

void rm_Operator::MediumLoaded ( string  a_libName,
string  a_medBarcode,
string  a_driveAddr 
) [private]

Definition at line 69 of file rm_operator.cpp.

References dbg_DETAIL, rm_Medium::driveKey, rm_Drive::driveKey, rm_Library::libraryKey, log_DBG_m, log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rmdb_MAX_DRIVEIDX, rmdb_MAX_LIBRARYNAME, rm_Drive::SelectByAddr(), rm_Medium::SelectByBarcode(), rm_Library::SelectByName(), and rm_Medium::Update().

Referenced by dbo_MediumLoaded::Process().

00069                                                                                         {
00070     log_FUNC_A_m(MediumLoaded, "a_libName: " << a_libName <<
00071                                ", a_medBarcode: " << a_medBarcode <<
00072                                ", a_driveAddr: " << a_driveAddr);
00073     try {
00074 
00075         rm_Medium medium;
00076         rm_String barcode(rmdb_MAX_BARCODE);
00077 
00078         barcode = a_medBarcode;
00079         medium.SelectByBarcode(barcode);
00080 
00081         //medium.slotKey = -1;
00082 
00083         rm_String libName(rmdb_MAX_LIBRARYNAME);
00084         libName = a_libName;
00085         rm_Library library;
00086         library.SelectByName(libName);
00087 
00088         rm_String driveAddr(rmdb_MAX_DRIVEIDX);
00089         driveAddr = a_driveAddr;
00090 
00091         rm_Drive drive;
00092         drive.SelectByAddr(library.libraryKey, driveAddr);
00093 
00094         log_DBG_m(dbg_DETAIL,"New DriveKey = " << drive.driveKey);
00095         medium.driveKey = drive.driveKey;
00096 
00097         medium.Update();
00098 
00099     } rm_CATCH_DB_THROW_IVD_m;
00100 
00101 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::MediumUnLoaded ( string  a_libName,
string  a_medBarcode,
string  a_slotAddr,
UInt32_t  a_slotType 
) [private]

Definition at line 103 of file rm_operator.cpp.

References rm_Medium::barcode, dbg_NORM, rm_Medium::driveKey, rm_Medium::libraryKey, rm_Library::libraryKey, log_DBG_m, log_ERR_m, log_FUNC_m, log_WRN_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, rmdb_MEDIUM_IN_USE, rmdb_SLOT_FREE, rmdb_SLOT_IN_USE, rm_Slot::Select(), rm_Medium::SelectByBarcode(), rm_Slot::SelectByLibAddrType(), rm_Library::SelectByName(), rm_Slot::slotKey, rm_Medium::slotKey, rm_Slot::status, rm_Medium::status, rm_Medium::Update(), and rm_Slot::Update().

Referenced by dbo_MediumUnloaded::Process().

00103                                                                                                               {
00104     log_FUNC_m(MediumUnLoaded);
00105     try {
00106 
00107 
00108         rm_Medium medium;
00109         rm_String barcode(rmdb_MAX_BARCODE);
00110 
00111         barcode = a_medBarcode;
00112         medium.SelectByBarcode(barcode);
00113 
00114         medium.driveKey = -1;
00115         medium.status = medium.status & ~(rmdb_MEDIUM_IN_USE);
00116 
00117         rm_String libName(rmdb_MAX_LIBRARYNAME);
00118         libName = a_libName;
00119         rm_Library library;
00120         library.SelectByName(libName);
00121 
00122         if (!a_slotAddr.empty()) {
00123             rm_String slotAddr(rmdb_MAX_SLOTADDR);
00124             slotAddr = a_slotAddr;
00125             rm_Slot oldSlot;
00126 
00127             try {
00128                 oldSlot.Select(medium.slotKey, library.libraryKey);
00129             } catch (ivd_DBException) {
00130                 log_DBG_m(dbg_NORM, "medium has no home slot");
00131             }
00132 
00133             rm_Slot newSlot;
00134             bool newSlotExists(true);
00135             try {
00136                 newSlot.SelectByLibAddrType(library.libraryKey, slotAddr, a_slotType);
00137             } catch (ivd_DBException) {
00138                 ostringstream msg;
00139                 msg << "New home slot does not exist in rmdb configuration. BC: " <<
00140                     medium.barcode << ".";
00141                 log_ERR_m(msg.str());
00142                 medium.libraryKey = -1;
00143                 medium.slotKey = -1;
00144                 newSlotExists = false;
00145             }
00146 
00147             if (newSlot.slotKey != oldSlot.slotKey) {
00148                 log_WRN_m("Medium: " << medium.barcode << " changed home slot.");
00149                 oldSlot.status &= rmdb_SLOT_FREE;
00150                 oldSlot.Update();
00151                 if (newSlotExists) {
00152                     medium.slotKey = newSlot.slotKey;
00153                     newSlot.status |= rmdb_SLOT_IN_USE;
00154                     newSlot.Update();
00155                 }
00156             }
00157         }
00158         else {
00159             medium.slotKey = -1; // manual robot: just unloaded from drive
00160         }
00161 
00162         medium.Update();
00163 
00164     } rm_CATCH_DB_THROW_IVD_m;
00165 
00166 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::VolumeFull ( string  a_medVolId  )  [private]

Definition at line 169 of file rm_operator.cpp.

References rm_Medium::barcode, dbg_DETAIL, dbg_LOW, dbg_NORM, ivd_UUID_STR_SIZE_d, log_DBG_m, log_FUNC_m, log_WriteEvent(), rm_MediumVol::mediumKey, rm_CATCH_DB_THROW_IVD_m, rmdb_MEDIUM_FULL, rmdb_MEDIUM_OPEN, rmdb_MEDVOL_FULL, rmdb_MEDVOL_USED, rmdb_SYSTEM_VOLUME, rm_Medium::Select(), rm_MediumVol::SelectByMedium(), rm_MediumVol::SelectByMedVolId(), rm_Medium::status, rm_MediumVol::status, rm_Medium::Update(), and rm_MediumVol::Update().

Referenced by dbo_VolumeFull::Process().

00169                                               {
00170     log_FUNC_m(VolumeFull);
00171     try {
00172 
00173         rm_MediumVol mediumVol;
00174 
00175         rm_String medVolId(ivd_UUID_STR_SIZE_d);
00176         medVolId = a_medVolId;
00177         mediumVol.SelectByMedVolId(medVolId);
00178 
00179         //clear open flag
00180         mediumVol.status = mediumVol.status & ~rmdb_MEDVOL_USED;
00181 
00182         //set full flag
00183         mediumVol.status = mediumVol.status | rmdb_MEDVOL_FULL;
00184         mediumVol.Update();
00185 
00186         bool allVolumeFull = true;
00187         vector<rm_MediumVol> medVolV;
00188         medVolV = mediumVol.SelectByMedium(mediumVol.mediumKey);
00189 
00190         for (UInt32_t i = 0; i < medVolV.size(); i++) {
00191             log_DBG_m(dbg_DETAIL,"Checking volume " << medVolV[i].medVolNr <<
00192                                 " for free space" <<
00193                                 ", medVolV[i].volType: " << medVolV[i].volType <<
00194                                 ", medVolV[i].status: " << medVolV[i].status);
00195 
00196             if ( ((medVolV[i].volType & rmdb_SYSTEM_VOLUME) == 0)   &&
00197                  (medVolV[i].status & rmdb_MEDVOL_FULL) == 0) {
00198                 //if any of the dataVolumes is NOT full
00199                 log_DBG_m(dbg_NORM,"Vol: " << medVolV[i].medVolNr << " has still some free space");
00200                 allVolumeFull = false;
00201                 break;
00202             }
00203         }
00204 
00205         if (allVolumeFull) {
00206 
00207             rm_Medium med;
00208             med.Select(mediumVol.mediumKey);
00209             ostringstream sstr;
00210             sstr << "All volumes on medium are Full. Marking whole medium as closed.";
00211             log_WriteEvent(sstr.str(), "", 0, med.barcode);
00212             log_DBG_m(dbg_LOW,sstr.str() << " bc: " << med.barcode);
00213 
00214             med.status = med.status & ~rmdb_MEDIUM_OPEN;
00215             med.status = med.status | rmdb_MEDIUM_FULL;
00216             med.Update();
00217         }
00218     } rm_CATCH_DB_THROW_IVD_m;
00219 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::VolumeEmpty ( string  a_medVolId  )  [private]

Definition at line 221 of file rm_operator.cpp.

References ivd_UUID_STR_SIZE_d, log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MEDVOL_EMPTY, rm_MediumVol::SelectByMedVolId(), rm_MediumVol::status, and rm_MediumVol::Update().

Referenced by dbo_VolumeEmpty::Process().

00221                                                {
00222     log_FUNC_m(VolumeEmpty);
00223     try {
00224 
00225         rm_MediumVol mediumVol;
00226 
00227         rm_String medVolId(ivd_UUID_STR_SIZE_d);
00228         medVolId = a_medVolId;
00229         mediumVol.SelectByMedVolId(medVolId);
00230         mediumVol.status = rmdb_MEDVOL_EMPTY;
00231         mediumVol.Update();
00232     } rm_CATCH_DB_THROW_IVD_m;
00233 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::VolumeListStatusSet ( UInt32_t  a_medKey,
i_ULongList_t  a_volumes,
UInt32_t  a_status 
) [private]

Performs setting of status flag for all required volumes.

If volume list is empty status is set for all volumes of that medium

Definition at line 242 of file rm_operator.cpp.

References dbg_DETAIL, dbg_NORM, ie_PRECONDITION, ivd_Error, log_DBG_m, log_FUNC_m, and rm_MediumVol::SelectByMedium().

Referenced by dbo_VolumeListStatusSet::Process().

00244                                                           {
00245     log_FUNC_m(VolumeListStatusSet);
00246     rm_MediumVol mv;
00247     vector<rm_MediumVol> medVolList = mv.SelectByMedium(a_medKey);
00248 
00249     if (a_volumes.length() == 0){
00250         //no volumes specified
00251         //set status for all volumes
00252         log_DBG_m(dbg_NORM, "Setting status:" << hex << a_status <<
00253                             " for all volumes. MediaKey:" << a_medKey);
00254         for (UInt32_t i(0); i < medVolList.size(); i++){
00255             if (medVolList[i].status & a_status){
00256                 throw ivd_Error(ie_PRECONDITION, "Volume status already set.");
00257             }
00258         }
00259 
00260         //exception was not thrown, all volume are ready for status to be set
00261         for (UInt32_t i(0); i < medVolList.size(); i++){
00262             medVolList[i].status |= a_status;
00263             medVolList[i].Update();
00264         }
00265 
00266     } else {
00267         log_DBG_m(dbg_NORM, "Setting status:" << a_status <<
00268             " for list of volumes. List length: " << a_volumes.length() <<
00269             " MediaKey:" << a_medKey);
00270 
00271         for (UInt32_t i(0); i < a_volumes.length(); i++){
00272             for (UInt32_t j(0); j < medVolList.size(); j++){
00273                 if (medVolList[j].medVolNr == (CORBA::Long)a_volumes[i]){
00274                     if (medVolList[j].status & a_status){
00275                         throw ivd_Error(ie_PRECONDITION, "Volume status already set.");
00276                     }
00277                 }
00278             }
00279         }
00280 
00281         bool found(false);
00282 
00283         //exception was not thrown, all volume are ready for status to be set
00284         for (UInt32_t i(0); i < a_volumes.length(); i++){
00285             UInt32_t j(0);
00286             for (; j < medVolList.size(); j++){
00287                 if (medVolList[j].medVolNr == (CORBA::Long)a_volumes[i]){
00288                     found = true;
00289                     break;
00290                 } else {
00291                     //next
00292                 }
00293             }
00294             if (found){
00295                 log_DBG_m(dbg_DETAIL, "Setting status:" << a_status <<
00296                     " for list volume. " <<
00297                     medVolList[j].medVolNr);
00298                 medVolList[j].status |= a_status;
00299                 medVolList[j].Update();
00300             }
00301         }
00302     }
00303 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InventoryUpdate ( string  a_libName,
const i_UpdateList_t a_elemStatus 
) [private]

Performs update of the RMDB based on the current situation in the library.

Used by Library Agent via i_ResourceManager.

Definition at line 318 of file rm_operator.cpp.

References rm_Medium::barcode, i_SlotUpdate_t::barcode, rm_Medium::blockSize, rm_Medium::currentVolume, dbg_DETAIL, dbg_LOW, dbg_NORM, rm_Medium::diskSubsysKey, rm_Drive::driveKey, rm_Medium::driveKey, rm_Drive::driveName, elem_DRIVE, evt_ERROR, evt_WARNING, ivd_BaseException::GetError(), rm_Medium::idxOfSysVol, rm_Medium::Insert(), ipc_nilStr, i_SlotUpdate_t::isFull, rm_Medium::libraryKey, rm_Library::libraryKey, rm_Library::libraryName, log_DBG_m, log_ERR_m, log_FUNC_A_m, log_WriteEvent(), rm_Medium::mediaPoolKey, rm_Medium::mediumKey, rm_Medium::mediumType, rm_Medium::numOfVolumes, rmdb_DRIVE_ERROR, rmdb_MAIL_SLOT_TYPE_ID, rmdb_MAX_BARCODE, rmdb_MAX_DRIVEIDX, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, rmdb_MEDIUM_UNUSABLE, rmdb_REP_SLOT_TYPE_ID, rmdb_SLOT_FREE, rmdb_SLOT_IN_USE, SelectAllMedium(), rm_Drive::SelectByAddr(), rm_Medium::SelectByBarcode(), rm_Medium::SelectByDrive(), rm_Slot::SelectByLibAddrType(), rm_Library::SelectByName(), rm_Medium::SelectBySlot(), rm_Medium::sizeOfSysVol, i_SlotUpdate_t::slot, rm_Slot::slotAddr, rm_Medium::slotKey, rm_Slot::slotKey, SQL_NOTFOUND, rm_Drive::status, rm_Medium::status, rm_Slot::status, str, i_SlotUpdate_t::type, Update(), rm_Drive::Update(), rm_Medium::Update(), and rm_Slot::Update().

Referenced by dbo_InventoryUpdate::Process().

00320                                         {
00321 
00322     log_FUNC_A_m(InventoryUpdate, "lib: " << a_libName);
00323 
00324 
00325     log_DBG_m(dbg_NORM, "[type, slot, isFull, barcode, barcode2]"
00326                             );
00327     for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
00328         log_DBG_m(dbg_NORM, "[" <<
00329                             a_elemStatus[i].type << ", " <<
00330                             a_elemStatus[i].slot << ", " <<
00331                             a_elemStatus[i].isFull << ", " <<
00332                             a_elemStatus[i].barcode << ", " <<
00333                             a_elemStatus[i].barcode2 <<
00334                             "]"
00335                             );
00336 
00337     }
00338 
00339     UInt32_t slotStart = 0;
00340 
00341     // Skip the drives in the sequence. They are at the beginning of the list.
00342     // THEY MUST BE.
00343     for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
00344         if (a_elemStatus[i].type != elem_DRIVE) {
00345             slotStart = i;
00346             break;
00347         }
00348     }
00349 
00350     set<UInt32_t> processed;
00351 
00352     rm_String libName(rmdb_MAX_LIBRARYNAME);
00353     rm_String slotAddr(rmdb_MAX_SLOTADDR);
00354     rm_String medBarcode(rmdb_MAX_BARCODE);
00355 
00356     rm_Library lib;
00357     libName = a_libName;
00358     lib.SelectByName(libName);
00359 
00360     // Process slots first.
00361     // Do rebindings and clean drive key bindings.
00362     for (UInt32_t i = slotStart; i < a_elemStatus.length(); i++) {
00363         const i_SlotUpdate_t &elem = a_elemStatus[i];
00364 
00365         log_DBG_m(dbg_NORM,
00366             elem.slot << " \"" << elem.barcode << "\": Processing." );
00367 
00368         // Get slot record
00369         slotAddr = string(elem.slot);
00370         rm_Slot  slot;
00371         try {
00372             // TODO Make difference between slot and mail slot
00373 
00374 //            typedef enum {
00375 //                /// All elements (CDB only)
00376 //                et_ALL          = 0x00,
00377 //                /// Medium transport
00378 //                et_TRANSPORT    = 0x01,
00379 //                /// Storage element (slot)
00380 //                et_SLOT         = 0x02,
00381 //                /// Import/export element
00382 //                et_IMPEX        = 0x03,
00383 //                /// Data transfer (tape drive)
00384 //                et_DRIVE        = 0x04
00385 //            } ElemType_t;
00386 
00387 
00388             UInt32_t slotType(0);
00389 
00390             switch (elem.type) {
00391                 case(0x02): {
00392                                 slotType = rmdb_REP_SLOT_TYPE_ID;
00393                                 break;
00394                             }
00395                 case(0x03): {
00396                                 slotType = rmdb_MAIL_SLOT_TYPE_ID;
00397                                 break;
00398                             }
00399                 case(0x04): {
00400                                 log_DBG_m(dbg_LOW, "Last element is drive.");
00401                                 continue;
00402                             }
00403                 default:    {
00404                                 log_ERR_m("Slot: "<< elem.slot <<
00405                                       ", has unknown type.");
00406                                 continue;
00407                             }
00408             }
00409 
00410 
00411             slot.SelectByLibAddrType(
00412                 lib.libraryKey, slotAddr, slotType);
00413 
00414             // Check if Slot was full before Inventory
00415             try {
00416                 rm_Medium tmpMed;
00417                 tmpMed.SelectBySlot(slot.slotKey);
00418                 slot.status = rmdb_SLOT_FREE;
00419                 slot.Update();
00420 
00421                 tmpMed.slotKey = -1;
00422                 tmpMed.libraryKey = -1;
00423                 tmpMed.Update();
00424             }
00425             catch (ivd_DBException &de) {
00426                 log_DBG_m(dbg_NORM,
00427                     "DB Exception querying medium in slot " << elem.slot <<
00428                     ". Slot was probably empty before Inventory. " << de);
00429             };
00430 
00431         }
00432         catch (ivd_DBException) {
00433             log_DBG_m(dbg_NORM, "Library: " << libName << ", Slot: " <<
00434                                 elem.slot << " does not exist in " <<
00435                                 "current Library Configuration.");
00436             continue;
00437         };
00438 
00439         if (elem.isFull) {
00440             medBarcode = string(elem.barcode);
00441 
00442             // if empty barcode -> just mark it as in use
00443             if (medBarcode.empty()) {
00444                 slot.status = rmdb_SLOT_IN_USE;
00445                 slot.Update();
00446                 continue;
00447             }
00448 
00449             // Select medium that is currently in the slot
00450             rm_Medium medium;
00451             try {
00452                 medium.SelectByBarcode(medBarcode);
00453             }
00454             catch (ivd_DBException &de) {
00455                 log_DBG_m(dbg_NORM,
00456                     "DB Exception: Medium most probably not in RMDB. Barcode " << elem.barcode <<
00457                     " (Slot marked IN_USE).");
00458 
00459                 if (de.GetError() == SQL_NOTFOUND) {
00460                     log_DBG_m(dbg_LOW,
00461                         "Will add medium to RMDB: " << elem.barcode);
00462 
00463                     rm_Medium newMedium;
00464                     newMedium.barcode = string(elem.barcode);
00465                     newMedium.slotKey = slot.slotKey;
00466                     newMedium.mediumKey = 0; // New will be generated.
00467 
00468                     // Keys
00469                     newMedium.mediaPoolKey = -1;
00470                     newMedium.libraryKey = lib.libraryKey;
00471                     newMedium.diskSubsysKey = -1;
00472                     newMedium.driveKey = -1;
00473 
00474                     // Defaults
00475                     newMedium.mediumType = 0;
00476                     newMedium.blockSize = 0;
00477                     newMedium.numOfVolumes = 0;
00478                     newMedium.idxOfSysVol = 0;
00479                     newMedium.sizeOfSysVol = 0;
00480                     newMedium.currentVolume = 0;
00481 
00482                     newMedium.status = 0;
00483 
00484                     newMedium.Insert();
00485                 }
00486                 slot.status = rmdb_SLOT_IN_USE;
00487                 slot.Update();
00488                 continue;
00489             };
00490 
00491             if (processed.find(medium.mediumKey) != processed.end() ) {
00492                 // Medium already found in slots.
00493                 // The same medium in another slot??? Log this.
00494                 ostringstream sstr;
00495                 sstr
00496                     << "Library: " << libName <<
00497                     ", Duplicate barcode reported from library. "
00498                     << "Slot #" << elem.slot;
00499                 log_WriteEvent(evt_ERROR, sstr.str(), "", 0, medBarcode);
00500             }
00501 
00502             if (slot.slotKey != medium.slotKey) {
00503 
00504                 rm_Medium oldMedium;
00505 
00506                 // Can medium record of the medium, that was previously
00507                 // in this slot, be found?
00508                 bool oldMediumFound = false;
00509 
00510                 try {
00511                     oldMedium.SelectBySlot(slot.slotKey);
00512                     oldMediumFound = true;
00513 
00514                     log_DBG_m(dbg_NORM,
00515                         slot.slotAddr << " " << medium.barcode <<
00516                         ": Binding (Previously here: " << oldMedium.barcode << ")." );
00517                 }
00518                 catch (ivd_DBException) {
00519                     log_DBG_m(dbg_NORM,
00520                         "DB Exception querying old medium in slot " << slot.slotAddr <<
00521                         " Ignore.");
00522                 };
00523 
00524                 medium.slotKey = slot.slotKey;
00525 
00526                 // Was oldMedium already processed?
00527                 // If not, then clear previous medium's location.
00528                 if (   oldMediumFound
00529                     && processed.find(oldMedium.mediumKey) == processed.end()) {
00530 
00531                     log_DBG_m(dbg_DETAIL,
00532                         oldMedium.barcode << ": Clearing location. Medium position changed.");
00533 
00534                     if (oldMedium.driveKey > 0) {
00535                         log_DBG_m(dbg_DETAIL,
00536                             oldMedium.barcode <<
00537                             ": Medium most probably in drive. Will get new HOME slot.");
00538                     }
00539 
00540                     oldMedium.slotKey = -1, oldMedium.driveKey = -1, oldMedium.libraryKey = -1;
00541                     oldMedium.Update();
00542                 }
00543                 slot.status = rmdb_SLOT_IN_USE;
00544                 slot.Update();
00545             }
00546             else {
00547                 log_DBG_m(dbg_NORM,
00548                     slot.slotAddr << " " << medium.barcode <<
00549                     ": No update necessary." );
00550             }
00551 
00552             // TODO: Library key is most probably unnecessary in
00553             // the medium record. Library is accessible via
00554             // slot key.
00555             medium.libraryKey = lib.libraryKey;
00556 
00557             // Clear driveKey. Proper keys will be assigned in the next step.
00558             medium.driveKey = -1;
00559             medium.Update();
00560 
00561             processed.insert(medium.mediumKey);
00562         } // if (elem.isFull)
00563         else {
00564             // Slot is currently empty.
00565             rm_Medium oldMedium;
00566             try {
00567                 oldMedium.SelectBySlot(slot.slotKey);
00568             }
00569             catch (ivd_DBException) {
00570                 log_DBG_m(dbg_NORM,
00571                     "DB Exception querying previous medium in slot " << elem.slot <<
00572                     " Marking slot free.");
00573 
00574                 slot.status = rmdb_SLOT_FREE;
00575                 slot.Update();
00576 
00577                 continue;
00578             };
00579 
00580             // Was oldMedium already processed?
00581             // If not, then clear previous medium's location.
00582             if (processed.find(oldMedium.mediumKey) == processed.end() ) {
00583 
00584                 if (oldMedium.driveKey < 1) {
00585                     log_DBG_m(dbg_DETAIL,
00586                         oldMedium.barcode <<
00587                         ": Clearing location. Medium location currently unknown.");
00588 
00589                     oldMedium.slotKey = -1, oldMedium.driveKey = -1, oldMedium.libraryKey = -1;
00590                     oldMedium.Update();
00591                 }
00592                 else {
00593                     log_DBG_m(dbg_DETAIL,
00594                         oldMedium.barcode <<
00595                         ": Won't delete slot. Tape may be in drive.");
00596                 }
00597             }
00598 
00599             if (oldMedium.driveKey < 1) {
00600                 log_DBG_m(dbg_DETAIL,
00601                     slot.slotAddr << ": Slot marked as FREE. Tape not in drive.");
00602 
00603                 slot.status = rmdb_SLOT_FREE;
00604                 slot.Update();
00605             }
00606             else {
00607                 log_DBG_m(dbg_DETAIL,
00608                     slot.slotAddr << ": Slot not marked as free. Tape may be in drive.");
00609             }
00610         } // else
00611     } // for i
00612 
00613     // Check the drives.
00614     // Assign HOME slots to those medium that don't have any.
00615     for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
00616         if (a_elemStatus[i].type != elem_DRIVE) {
00617             log_DBG_m(dbg_DETAIL, "All drives processed.");
00618             break;
00619         }
00620         bool driveFound(false);
00621 
00622         const i_SlotUpdate_t &elem = a_elemStatus[i];
00623 
00624         rm_String driveAddr(rmdb_MAX_DRIVEIDX);
00625         driveAddr = elem.slot;
00626         rm_Drive drive;
00627         try {
00628             log_DBG_m(dbg_DETAIL,"Selecting drive addr: " << driveAddr <<
00629                                     " LibraryKey: " <<lib.libraryKey);
00630 
00631             drive.SelectByAddr(lib.libraryKey, driveAddr);
00632             driveFound = true;
00633         }
00634         catch (ivd_DBException) {
00635             log_DBG_m(dbg_NORM,
00636                 "DB Exception querying drive " << elem.slot <<
00637                 " Skipping.");
00638         };
00639 
00640         //if (driveFound && !elem.isFull) {
00641         if (driveFound) {
00642 
00643             if (elem.isFull) {
00644 
00645                 log_DBG_m(dbg_NORM,
00646                     elem.slot << ": Drive full." );
00647             }
00648             else {
00649 
00650                 log_DBG_m(dbg_NORM,
00651                     elem.slot << ": Drive empty." );
00652             }
00653 
00654             // select Medium By this drive and clear drivekey if equal to this drivekey
00655             try {
00656                 log_DBG_m(dbg_DETAIL,"Selecting drive addr: " << driveAddr <<
00657                                         " LibraryKey: " << lib.libraryKey);
00658 
00659                 rm_Medium m;
00660                 m.SelectByDrive(drive.driveKey);
00661                 if (m.barcode != string(elem.barcode)) {
00662                     log_DBG_m(dbg_DETAIL,"Clearing DriveKey from Medium " << m.barcode);
00663 
00664                     m.driveKey = 0;
00665                     m.Update();
00666                 }
00667             }
00668             catch (ivd_DBException) {
00669                 log_DBG_m(dbg_NORM,
00670                     "No medium assigned to Drive.");
00671             };
00672         }
00673 
00674         log_DBG_m(dbg_NORM,
00675             elem.slot << " " << elem.barcode << ": Processing (drive)." );
00676 
00677         medBarcode = string(elem.barcode);
00678         rm_Medium medium;
00679 
00680         // if empty barcode & drive empty -> continue
00681         if (!elem.isFull){
00682             continue;
00683         }
00684         else if (medBarcode.empty()) {
00685             ostringstream str;
00686             str <<"Library: " << libName <<
00687                 ", Medium does not have a barcode. Drive #" << elem.slot;
00688             log_WriteEvent(evt_ERROR, str.str());
00689             continue;
00690         }
00691 
00692         try {
00693             medium.SelectByBarcode(medBarcode);
00694         }
00695         catch (ivd_DBException &de) {
00696             log_DBG_m(dbg_NORM,
00697                 "DB Exception: Medium most probably not in RMDB. Barcode " << medBarcode );
00698 
00699                 if (de.GetError() == SQL_NOTFOUND) {
00700                     log_DBG_m(dbg_LOW,
00701                         "Will add medium to RMDB: " << medBarcode);
00702 
00703                     medium.barcode = medBarcode;
00704                     medium.slotKey = -1;
00705                     medium.mediumKey = 0; // New will be generated.
00706 
00707                     // Keys
00708                     medium.mediaPoolKey = -1;
00709                     medium.libraryKey = -1;
00710                     medium.diskSubsysKey = -1;
00711                     medium.driveKey = -1;
00712 
00713                     // Defaults
00714                     medium.mediumType = 0;
00715                     medium.blockSize = 0;
00716                     medium.numOfVolumes = 0;
00717                     medium.idxOfSysVol = 0;
00718                     medium.sizeOfSysVol = 0;
00719                     medium.currentVolume = 0;
00720 
00721                     medium.status = 0;
00722 
00723                     medium.Insert();
00724                     medium.SelectByBarcode(medBarcode);
00725                 }
00726         };
00727 
00728         if (processed.find(medium.mediumKey) != processed.end() ) {
00729             // Medium already found in slots.
00730             // The same medium in drive??? Log this.
00731             ostringstream sstr;
00732             rm_Drive drv;
00733             rm_String drvAddr(rmdb_MAX_DRIVEIDX);
00734             drvAddr = elem.slot;
00735             bool foundDrive(false);
00736             try {
00737                 drv.SelectByAddr(lib.libraryKey, drvAddr);
00738                 foundDrive = true;
00739             } catch (ivd_DBException e){
00740                 log_ERR_m("Library: " << libName <<
00741                           ", not configured drive reported by inventory." <<
00742                           endl << e);
00743             }
00744 
00745             sstr.str("");
00746             sstr
00747                 << "Library: " << libName << ", Duplicate barcode reported from library. "
00748                 << "Drive: " << drv.driveName << ", barcode: " << medium.barcode ;
00749             log_WriteEvent(evt_ERROR, sstr.str(), "", 0, medium.barcode);
00750 
00751             //mark medium & drive as unusable
00752             if (foundDrive){
00753                 drv.status = drv.status | rmdb_DRIVE_ERROR;
00754                 drv.Update();
00755                 sstr.str("");
00756                 sstr << "Library: " << libName << ", Marking drive as Error " <<
00757                     "in order to prevent further failures.";
00758                     log_WriteEvent(evt_WARNING, sstr.str(), "", 0, drv.driveName);
00759             }
00760 
00761             medium.status = medium.status | rmdb_MEDIUM_UNUSABLE;
00762             medium.Update();
00763             sstr.str("");
00764             sstr << "Library: " << libName << ", Marking medium as Unusable " <<
00765                     " in order to prevent further failures.";
00766             log_WriteEvent(evt_WARNING, sstr.str(), "", 0, medium.barcode);
00767         }
00768 
00769         try {
00770             if (driveFound) {
00771                 medium.driveKey = drive.driveKey;
00772                 medium.Update();
00773             }
00774         }
00775         catch (ivd_DBException) {
00776             log_DBG_m(dbg_NORM,
00777                 "DB Exception updating Medium " << elem.barcode <<
00778                 ". Skipping.");
00779             continue;
00780         };
00781 
00782         if (medium.slotKey < 1) {
00783             // Medium in drive, but it does not have a "home" slot.
00784             for (UInt32_t f = slotStart; f < a_elemStatus.length(); f++) {
00785                 const i_SlotUpdate_t &freeElem = a_elemStatus[f];
00786                 if (!freeElem.isFull) {
00787 
00788                     // Get free slot record
00789                     rm_String freeSlotAddr(rmdb_MAX_SLOTADDR);
00790                     freeSlotAddr = string(freeElem.slot);
00791                     rm_Slot  freeSlot;
00792 
00793                     try {
00794                         freeSlot.SelectByLibAddrType(
00795                             lib.libraryKey, freeSlotAddr, rmdb_REP_SLOT_TYPE_ID);
00796                     }
00797                     catch (ivd_DBException) {
00798                         log_DBG_m(dbg_NORM,
00799                             "DB Exception querying for free slot " << freeElem.slot <<
00800                             ". Skip this slot.");
00801                         continue;
00802                     };
00803 
00804                     if (freeSlot.status == rmdb_SLOT_IN_USE) {
00805                         log_DBG_m(dbg_DETAIL,"Skipping reserved Slot (Addr): " << freeSlot.slotAddr);
00806                         continue;
00807                     }
00808                     medium.slotKey = freeSlot.slotKey;
00809                     medium.libraryKey = lib.libraryKey;
00810                     medium.Update();
00811 
00812                     freeSlot.status = rmdb_SLOT_IN_USE;
00813                     freeSlot.Update();
00814 
00815                     log_DBG_m(dbg_NORM,
00816                         freeSlot.slotAddr << " " << medium.barcode <<
00817                         ": Medium in drive got a HOME slot.");
00818 
00819                     processed.insert(medium.mediumKey);
00820 
00821                     slotStart = f+1;
00822                     break;
00823                 }
00824             } // for f
00825         } // if (medium..
00826         else {
00827             log_DBG_m(dbg_DETAIL,
00828                 medium.barcode << ": Medium already has a HOME slot.");
00829         }
00830     } // for i
00831 
00832     //Check if there are medium in rmdb that are assigned to this library
00833     i_MediumSeq_t medSeq = SelectAllMedium();
00834     for (UInt32_t m(0); m < medSeq.length(); m++){
00835         bool foundBC(false);
00836         for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
00837             string elBarcode(a_elemStatus[i].barcode);
00838             if ( elBarcode.compare(medSeq[m].barcode) == 0 )
00839                 foundBC = true;
00840         }
00841 
00842         if (!foundBC && lib.libraryName.compare(medSeq[m].libraryName) == 0 ){
00843             log_DBG_m(dbg_NORM, "Medium: " << medSeq[m].barcode <<
00844                                 " is assigned to " << lib.libraryName <<
00845                                 ". Will unassign it NOW");
00846             medSeq[m].libraryName = CORBA::string_dup(ipc_nilStr);
00847             medSeq[m].slotAddr = CORBA::string_dup(ipc_nilStr);
00848             medSeq[m].slotType = 0;
00849             Update(medSeq[m]);
00850         }
00851 
00852 
00853     }
00854 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::Add ( i_Library_t  a_library  )  [private]

ToDo: assign generated values to a_Library

Definition at line 965 of file rm_operator.cpp.

References i_Library_t::auditTime, rm_Library::auditTime, i_Library_t::capabilities, rm_Library::capabilities, i_Library_t::controlDevice, rm_Library::controlDevice, i_Library_t::firmwareRev, rm_Library::firmwareRev, i_Library_t::host, rm_Library::host, rm_Library::Insert(), rm_Library::libraryKey, i_Library_t::libraryName, rm_Library::libraryName, i_Library_t::libraryType, rm_Library::libraryType, i_Library_t::loadNr, rm_Library::loadNr, log_FUNC_A_m, i_Library_t::mediaAccessTime, rm_Library::mediaAccessTime, i_Library_t::mediaFamily, rm_Library::mediaFamily, i_Library_t::mediaXChgTime, rm_Library::mediaXChgTime, i_Library_t::options, rm_Library::options, rm_CATCH_DB_THROW_IVD_m, i_Library_t::scsiID, rm_Library::scsiID, i_Library_t::status, rm_Library::status, i_Library_t::unloadNr, and rm_Library::unloadNr.

Referenced by Add(), dbo_AddMediumVol::Process(), dbo_AddMedium::Process(), dbo_AddMediaPool::Process(), dbo_AddSlot::Process(), dbo_AddDiskSubsys::Process(), dbo_AddDriveHost::Process(), dbo_AddDrive::Process(), dbo_AddColMediaVol::Process(), dbo_AddMinorCol::Process(), dbo_AddMajorCol::Process(), and dbo_AddLibrary::Process().

00965                                            {
00966     log_FUNC_A_m(Add, "library");
00967     try {
00968 
00969         rm_Library library;
00970 
00971         library.auditTime       =   a_library.auditTime;
00972         library.capabilities    =   a_library.capabilities;
00973         library.controlDevice   =   a_library.controlDevice;
00974         library.host            =   a_library.host;
00975         library.libraryName     =   a_library.libraryName;
00976         library.libraryType     =   a_library.libraryType;
00977         library.loadNr          =   a_library.loadNr;
00978         library.mediaAccessTime =   a_library.mediaAccessTime;
00979         library.mediaAccessTime =   a_library.mediaAccessTime;
00980         library.mediaFamily     =   a_library.mediaFamily;
00981         library.mediaXChgTime   =   a_library.mediaXChgTime;
00982         library.options         =   a_library.options;
00983         library.status          =   a_library.status;
00984         library.unloadNr        =   a_library.unloadNr;
00985         library.firmwareRev     =   a_library.firmwareRev;
00986         library.scsiID          =   a_library.scsiID;
00987 
00988         library.libraryKey      =   0;
00989 
00990         //AutoDetect(library);
00991         library.Insert();
00992 
00994 
00995     } rm_CATCH_DB_THROW_IVD_m;
00996 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::Add ( i_Drive_t  a_drive  )  [private]

ToDo: assign generated values to a_drive

Definition at line 998 of file rm_operator.cpp.

References Add(), i_Drive_t::aveSeekTime, rm_Drive::aveSeekTime, i_Drive_t::capabilities, rm_Drive::capabilities, i_Drive_t::cleanNr, rm_Drive::cleanNr, i_Drive_t::dataThroughput, rm_Drive::dataThroughput, dbg_DETAIL, i_Drive_t::driveIndex, rm_Drive::driveIndex, rm_Drive::driveKey, i_Drive_t::driveName, rm_Drive::driveName, i_Drive_t::firmwareRev, rm_Drive::firmwareRev, ivd_BaseException::GetError(), ie_DRIVE_INDEX_DUPL, rm_Drive::Insert(), ivd_Error, i_Drive_t::lastClean, rm_Drive::lastClean, rm_Library::libraryKey, rm_Drive::libraryKey, i_Drive_t::libraryName, i_Drive_t::loadTime, rm_Drive::loadTime, log_DBG_m, log_FUNC_A_m, i_Drive_t::mediaFamily, rm_Drive::mediaFamily, i_Drive_t::options, rm_Drive::options, i_Drive_t::rewindTime, rm_Drive::rewindTime, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, i_Drive_t::scsiID, rm_Drive::scsiID, rm_Drive::SelectByAddr(), rm_Library::SelectByName(), SQL_NOTFOUND, i_Drive_t::status, rm_Drive::status, i_Drive_t::unloadTime, rm_Drive::unloadTime, i_Drive_t::usageCount, and rm_Drive::usageCount.

00998                                        {
00999     log_FUNC_A_m(Add, "Drive");
01000 
01001     try {
01002 
01003         rm_Drive drive;
01004 
01005         drive.driveIndex    = a_drive.driveIndex;
01006 
01007         rm_Library lib;
01008         rm_String libName(rmdb_MAX_LIBRARYNAME);
01009         libName = a_drive.libraryName;
01010         bool driveUnique = false;
01011 
01012         if (libName.size() > 0 ) {
01013             lib.SelectByName(libName);
01014             drive.libraryKey = lib.libraryKey;
01015         } else {
01016             drive.libraryKey = -1;
01017             driveUnique = true;
01018         }
01019 
01020         if (drive.libraryKey > 0) {
01021             try {
01022                 drive.SelectByAddr(drive.libraryKey, drive.driveIndex);
01023             } catch (ivd_DBException& dbe) {
01024                 if (dbe.GetError() == SQL_NOTFOUND) {
01025                     log_DBG_m(dbg_DETAIL,"DriveIndexCheck is OK");
01026                     driveUnique = true;
01027                 } else throw;
01028 
01029             }
01030             if (driveUnique == false) {
01031                 ostringstream errDescStream;
01032                 errDescStream << "There is already a drive in that Library with the same index" << endl;
01033                 errDescStream << "Drive: " << drive.driveName << "  has already index " << drive.driveIndex;
01034                 errDescStream << endl;
01035                 throw ivd_Error (ie_DRIVE_INDEX_DUPL, errDescStream.str());
01036             }
01037         }
01038 
01039         drive.aveSeekTime       = a_drive.aveSeekTime;
01040         drive.capabilities      = a_drive.capabilities;
01041         drive.cleanNr           = a_drive.cleanNr;
01042         drive.dataThroughput    = a_drive.dataThroughput;
01043         drive.driveIndex        = a_drive.driveIndex;
01044         drive.driveName         = a_drive.driveName;
01045         drive.lastClean         = a_drive.lastClean;
01046         drive.loadTime          = a_drive.loadTime;
01047         drive.mediaFamily       = a_drive.mediaFamily;
01048         drive.options           = a_drive.options;
01049         drive.rewindTime        = a_drive.rewindTime;
01050         drive.status            = a_drive.status;
01051         drive.unloadTime        = a_drive.unloadTime;
01052         drive.usageCount        = a_drive.usageCount;
01053         drive.firmwareRev       = a_drive.firmwareRev;
01054         drive.scsiID            = a_drive.scsiID;
01055         drive.driveKey          = 0;
01056         //AutoDetect(drive);
01057         drive.Insert();
01059     } rm_CATCH_DB_THROW_IVD_m;
01060 }

Here is the call graph for this function:

void rm_Operator::Add ( i_DriveHost_t  a_driveHost  )  [private]

Definition at line 1062 of file rm_operator.cpp.

References Add(), i_DriveHost_t::controlDevice, rm_DriveHost::controlDevice, rm_Drive::driveKey, rm_DriveHost::driveKey, i_DriveHost_t::driveName, i_DriveHost_t::host, rm_DriveHost::host, rm_DriveHost::Insert(), log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, and rm_Drive::SelectByName().

01062                                                {
01063     log_FUNC_A_m(Add, "DriveHost");
01064 
01065     try {
01066 
01067         rm_DriveHost driveHost;
01068 
01069         driveHost.controlDevice = a_driveHost.controlDevice;
01070         driveHost.host          = a_driveHost.host;
01071 
01072         rm_Drive d;
01073         rm_String driveName(rmdb_MAX_DRIVENAME);
01074         driveName = a_driveHost.driveName;
01075         d.SelectByName(driveName);
01076         driveHost.driveKey = d.driveKey;
01077 
01078         //AutoDetect(driveHost);
01079         driveHost.Insert();
01080     } rm_CATCH_DB_THROW_IVD_m;
01081 }

Here is the call graph for this function:

void rm_Operator::Add ( i_DiskSubsys_t  a_dss  )  [private]

Definition at line 1083 of file rm_operator.cpp.

References Add(), rm_DiskSubsys::diskSubsysKey, i_DiskSubsys_t::diskSubsysName, rm_DiskSubsys::diskSubsysName, i_DiskSubsys_t::diskSubsysType, rm_DiskSubsys::diskSubsysType, i_DiskSubsys_t::host, rm_DiskSubsys::host, rm_DiskSubsys::Insert(), log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, i_DiskSubsys_t::status, and rm_DiskSubsys::status.

01083                                           {
01084     log_FUNC_A_m(Add, "DiskSubsys");
01085     try {
01086 
01087         rm_DiskSubsys dss;
01088 
01089         dss.diskSubsysName  = a_dss.diskSubsysName;
01090         dss.diskSubsysType  = a_dss.diskSubsysType;
01091         dss.host            = a_dss.host;
01092         dss.status          = a_dss.status;
01093         dss.diskSubsysKey   = 0;
01094 
01095         //AutoDetect(dss);
01096         dss.Insert();
01097     } rm_CATCH_DB_THROW_IVD_m;
01098 }

Here is the call graph for this function:

void rm_Operator::Add ( i_Slot_t  a_slot  )  [private]

Definition at line 1100 of file rm_operator.cpp.

References Add(), rm_Slot::Insert(), rm_Library::libraryKey, rm_Slot::libraryKey, i_Slot_t::libraryName, log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, rm_Library::SelectByName(), i_Slot_t::slotAddr, rm_Slot::slotAddr, rm_Slot::slotKey, i_Slot_t::slotType, rm_Slot::slotType, i_Slot_t::status, and rm_Slot::status.

01100                                      {
01101     log_FUNC_A_m(Add, "Slot");
01102     try {
01103 
01104         rm_Slot slot;
01105 
01106         rm_Library lib;
01107         rm_String libraryName(rmdb_MAX_LIBRARYNAME);
01108         libraryName = a_slot.libraryName;
01109         lib.SelectByName(libraryName);
01110 
01111         slot.libraryKey = lib.libraryKey;
01112         slot.slotAddr   = a_slot.slotAddr;
01113         slot.slotType   = a_slot.slotType;
01114         slot.status     = a_slot.status;
01115         slot.slotKey    = 0;
01116 
01117         //AutoDetect(slot);
01118         slot.Insert();
01119     } rm_CATCH_DB_THROW_IVD_m;
01120 }

Here is the call graph for this function:

void rm_Operator::Add ( i_MediaPool_t  a_mediaPool  )  [private]

num of volumes is limited to 255

Definition at line 1122 of file rm_operator.cpp.

References Add(), i_MediaPool_t::blockSize, rm_MediaPool::blockSize, rm_MediaPool::Insert(), log_FUNC_A_m, i_MediaPool_t::maxMediaAge, rm_MediaPool::maxMediaAge, i_MediaPool_t::maxNrReadWrite, rm_MediaPool::maxNrReadWrite, i_MediaPool_t::mediaFamily, rm_MediaPool::mediaFamily, rm_MediaPool::mediaPoolKey, i_MediaPool_t::mediaPoolName, rm_MediaPool::mediaPoolName, i_MediaPool_t::mediaPoolType, rm_MediaPool::mediaPoolType, i_MediaPool_t::numOfVolumes, rm_MediaPool::numOfVolumes, i_MediaPool_t::partitionUUIDString, rm_MediaPool::partitionUUIDString, rm_CATCH_DB_THROW_IVD_m, i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sysVolLocation, and rm_MediaPool::sysVolLocation.

01122                                                {
01123     log_FUNC_A_m(Add, "MediaPool");
01124     try {
01125 
01126         rm_MediaPool mediaPool;
01127 
01128         mediaPool.maxMediaAge       = a_mediaPool.maxMediaAge;
01129         mediaPool.maxNrReadWrite     = a_mediaPool.maxNrReadWrite;
01130         mediaPool.mediaFamily       = a_mediaPool.mediaFamily;
01131         mediaPool.mediaPoolName     = a_mediaPool.mediaPoolName;
01132         mediaPool.mediaPoolType     = a_mediaPool.mediaPoolType;
01133         mediaPool.partitionUUIDString = a_mediaPool.partitionUUIDString;
01134         mediaPool.mediaPoolKey      = 0;
01135         mediaPool.blockSize         = a_mediaPool.blockSize;
01136 
01137         mediaPool.numOfVolumes      = static_cast<Int16_t>(a_mediaPool.numOfVolumes);
01139         mediaPool.sysVolLocation    = static_cast<Int16_t>(a_mediaPool.sysVolLocation);
01140         mediaPool.sizeOfSysVol      = a_mediaPool.sizeOfSysVol;
01141         mediaPool.sizeOfVolume      = a_mediaPool.sizeOfVolume;
01142 
01143         //AutoDetect(mediaPool);
01144         mediaPool.Insert();
01145     } rm_CATCH_DB_THROW_IVD_m;
01146 }

Here is the call graph for this function:

void rm_Operator::Add ( i_Medium_t  a_medium  )  [private]

Definition at line 1148 of file rm_operator.cpp.

References Add(), i_Medium_t::barcode, rm_Medium::barcode, i_Medium_t::blockSize, rm_Medium::blockSize, rm_Medium::currentVolume, i_Medium_t::currentVolume, rm_DiskSubsys::diskSubsysKey, rm_Medium::diskSubsysKey, i_Medium_t::diskSubsysName, rm_Drive::driveKey, rm_Medium::driveKey, i_Medium_t::driveName, i_Medium_t::idxOfSysVol, rm_Medium::idxOfSysVol, rm_Medium::Insert(), rm_Library::libraryKey, rm_Medium::libraryKey, i_Medium_t::libraryName, i_Medium_t::location, rm_Medium::location, log_FUNC_A_m, rm_MediaPool::mediaPoolKey, rm_Medium::mediaPoolKey, i_Medium_t::mediaPoolName, rm_Medium::mediumKey, i_Medium_t::mediumSerialNo, rm_Medium::mediumSerialNo, i_Medium_t::mediumType, rm_Medium::mediumType, i_Medium_t::numOfVolumes, rm_Medium::numOfVolumes, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rmdb_MAX_DSSNAME, rmdb_MAX_LIBRARYNAME, rmdb_MAX_MEDIAPOOLNAME, rmdb_MAX_SLOTADDR, rm_Slot::SelectByLibAddrType(), rm_MediaPool::SelectByName(), rm_Library::SelectByName(), rm_Drive::SelectByName(), rm_DiskSubsys::SelectByName(), i_Medium_t::sizeOfSysVol, rm_Medium::sizeOfSysVol, i_Medium_t::slotAddr, rm_Slot::slotKey, rm_Medium::slotKey, i_Medium_t::slotType, i_Medium_t::status, and rm_Medium::status.

01148                                          {
01149     log_FUNC_A_m(Add, "Medium");
01150     try {
01151 
01152         rm_Medium medium;
01153 
01154         medium.barcode     = a_medium.barcode ;
01155 
01156         string dssName(a_medium.diskSubsysName);
01157         if (dssName.length() > 0 ) {
01158             rm_DiskSubsys dss;
01159             rm_String dssName(rmdb_MAX_DSSNAME);
01160             dssName = a_medium.diskSubsysName;
01161             dss.SelectByName(dssName);
01162             medium.diskSubsysKey = dss.diskSubsysKey;
01163         } else {
01164             medium.diskSubsysKey = -1;
01165         };
01166         string driveName(a_medium.driveName);
01167         if (driveName.length() > 0 ) {
01168             rm_Drive d;
01169             rm_String dName(rmdb_MAX_DRIVENAME);
01170             dName = a_medium.driveName;
01171             d.SelectByName(dName);
01172             medium.driveKey = d.driveKey;
01173         } else {
01174             medium.driveKey = -1;
01175         };
01176 
01177         if (strlen(a_medium.libraryName) > 0 ) {
01178             rm_Library l;
01179             rm_String lName(rmdb_MAX_LIBRARYNAME);
01180             lName = a_medium.libraryName;
01181             l.SelectByName(lName);
01182             medium.libraryKey = l.libraryKey;
01183         } else {
01184             medium.libraryKey = -1;
01185         };
01186 
01187         medium.location     = a_medium.location ;
01188 
01189         if (strlen(a_medium.mediaPoolName) > 0 ) {
01190             rm_MediaPool mp;
01191             rm_String mpName(rmdb_MAX_MEDIAPOOLNAME);
01192             mpName = a_medium.mediaPoolName;
01193             mp.SelectByName(mpName);
01194             medium.mediaPoolKey = mp.mediaPoolKey;
01195         } else {
01196             medium.mediaPoolKey = -1;
01197         };
01198 
01199         medium.mediumSerialNo = a_medium.mediumSerialNo ;
01200         medium.mediumType     = a_medium.mediumType ;
01201 
01202         if (strlen(a_medium.slotAddr) > 0 ) {
01203             rm_Slot s;
01204             rm_String sAddr(rmdb_MAX_SLOTADDR);
01205             sAddr = a_medium.slotAddr;
01206             s.SelectByLibAddrType(medium.libraryKey, sAddr, a_medium.slotType);
01207             medium.slotKey = s.slotKey;
01208         } else {
01209             medium.slotKey = -1;
01210         };
01211 
01212         if (a_medium.currentVolume < 1) {
01213             medium.currentVolume = -1; //setting indicator bi6
01214         }
01215 
01216         medium.status    = a_medium.status ;
01217         medium.blockSize         = a_medium.blockSize;
01218         medium.numOfVolumes      = static_cast<Int16_t>(a_medium.numOfVolumes);
01219         medium.idxOfSysVol       = static_cast<Int16_t>(a_medium.idxOfSysVol);
01220         medium.sizeOfSysVol      = a_medium.sizeOfSysVol;
01221 
01222         medium.mediumKey  = 0;
01223 
01224         //AutoDetect(medium);
01225         medium.Insert();
01226     } rm_CATCH_DB_THROW_IVD_m;
01227 }

Here is the call graph for this function:

void rm_Operator::Add ( i_MediumVol_t  a_mediumVol  )  [private]

Definition at line 1289 of file rm_operator.cpp.

References i_MediumVol_t::accessNr, rm_MediumVol::accessNr, i_MediumVol_t::accessTime, rm_MediumVol::accessTime, Add(), i_MediumVol_t::initTime, rm_MediumVol::initTime, rm_MediumVol::Insert(), i_MediumVol_t::lastVerification, rm_MediumVol::lastVerification, log_FUNC_A_m, i_MediumVol_t::mediumBarcode, rm_Medium::mediumKey, rm_MediumVol::mediumKey, i_MediumVol_t::medVolId, rm_MediumVol::medVolId, i_MediumVol_t::medVolNr, rm_MediumVol::medVolNr, i_MediumVol_t::owriteNr, rm_MediumVol::owriteNr, i_MediumVol_t::owriteTime, rm_MediumVol::owriteTime, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rm_Medium::SelectByBarcode(), i_MediumVol_t::status, rm_MediumVol::status, i_MediumVol_t::totalData, rm_MediumVol::totalData, i_MediumVol_t::validData, rm_MediumVol::validData, i_MediumVol_t::volSize, rm_MediumVol::volSize, i_MediumVol_t::volType, rm_MediumVol::volType, i_MediumVol_t::volUsed, rm_MediumVol::volUsed, i_MediumVol_t::writeNr, rm_MediumVol::writeNr, i_MediumVol_t::writeTime, and rm_MediumVol::writeTime.

01289                                                {
01290     log_FUNC_A_m(Add, "MediumVol");
01291     try {
01292 
01293         rm_MediumVol mediumVol;
01294         mediumVol.medVolNr       = a_mediumVol.medVolNr;
01295         mediumVol.accessNr       = a_mediumVol.accessNr;
01296         mediumVol.accessTime     = a_mediumVol.accessTime;
01297         mediumVol.initTime       = a_mediumVol.initTime;
01298         mediumVol.lastVerification    = a_mediumVol.lastVerification;
01299 
01300         rm_Medium medium;
01301         rm_String medBarcode(rmdb_MAX_BARCODE);
01302         medBarcode = a_mediumVol.mediumBarcode;
01303         medium.SelectByBarcode(medBarcode);
01304         mediumVol.mediumKey       = medium.mediumKey;
01305 
01306         mediumVol.medVolId       = a_mediumVol.medVolId;
01307         mediumVol.owriteNr       = a_mediumVol.owriteNr;
01308         mediumVol.owriteTime     = a_mediumVol.owriteTime;
01309         mediumVol.status         = a_mediumVol.status;
01310         mediumVol.volSize        = a_mediumVol.volSize;
01311         mediumVol.volType        = a_mediumVol.volType;
01312         mediumVol.volUsed        = a_mediumVol.volUsed;
01313         mediumVol.writeNr        = a_mediumVol.writeNr;
01314         mediumVol.writeTime      = a_mediumVol.writeTime;
01315         mediumVol.validData      = a_mediumVol.validData;
01316         mediumVol.totalData      = a_mediumVol.totalData;
01317 
01318         //AutoDetect(mediumVol);
01319         mediumVol.Insert();
01320     } rm_CATCH_DB_THROW_IVD_m;
01321 }

Here is the call graph for this function:

void rm_Operator::Add ( i_MajorCol_t a_majorCol  )  [private]

Definition at line 1229 of file rm_operator.cpp.

References Add(), i_MajorCol_t::flags, rm_MajorCol::flags, rm_MajorCol::Insert(), log_FUNC_A_m, i_MajorCol_t::majColId, rm_MajorCol::majColId, i_MajorCol_t::majColSize, rm_MajorCol::majColSize, i_MajorCol_t::partUUID, rm_MajorCol::partUUID, and rm_CATCH_DB_THROW_IVD_m.

01229                                              {
01230     log_FUNC_A_m(Add, "MajorCol");
01231     try {
01232         rm_MajorCol majorcol;
01233 
01234         majorcol.majColId   = a_majorCol.majColId;
01235         majorcol.majColSize = a_majorCol.majColSize;
01236         majorcol.partUUID   = a_majorCol.partUUID;
01237         majorcol.flags      = a_majorCol.flags;
01238 
01239         majorcol.Insert();
01240     } rm_CATCH_DB_THROW_IVD_m;
01241 }

Here is the call graph for this function:

void rm_Operator::Add ( i_MinorCol_t a_minorCol  )  [private]

Definition at line 1243 of file rm_operator.cpp.

References Add(), i_MinorCol_t::flags, rm_MinorCol::Insert(), log_FUNC_A_m, rm_MinorCol::m_flags, rm_MinorCol::m_majColId, rm_MinorCol::m_minColId, i_MinorCol_t::majColId, i_MinorCol_t::minColId, and rm_CATCH_DB_THROW_IVD_m.

01243                                               {
01244     log_FUNC_A_m(Add, "MinorCol");
01245     try {
01246         rm_MinorCol minorcol;
01247 
01248         minorcol.m_minColId   = a_minorCol.minColId;
01249         minorcol.m_majColId   = a_minorCol.majColId;
01250         minorcol.m_flags      = a_minorCol.flags;
01251 
01252         minorcol.Insert();
01253     } rm_CATCH_DB_THROW_IVD_m;
01254 }

Here is the call graph for this function:

void rm_Operator::Add ( i_ColMediaVol_t a_colMediaVol  )  [private]

Definition at line 1256 of file rm_operator.cpp.

References Add(), rm_ColMediaVol::Insert(), log_FUNC_A_m, and rm_CATCH_DB_THROW_IVD_m.

01256                                                     {
01257     log_FUNC_A_m(Add, "ColMediaVol");
01258     try {
01259         rm_ColMediaVol colMediaVol(a_colMediaVol);
01260         colMediaVol.Insert();
01261     } rm_CATCH_DB_THROW_IVD_m;
01262 }

Here is the call graph for this function:

void rm_Operator::CheckAndAdd ( i_ColMediaVol_t a_colMediaVol,
UInt32_t  a_flags 
) [private]

Definition at line 1264 of file rm_operator.cpp.

References API_FLAG_EXCLUSIVE, rm_Medium::barcode, ivd_BaseException::GetError(), rm_ColMediaVol::Insert(), log_FUNC_A_m, log_WriteEvent(), rm_ColMediaVol::m_mediaKey, rm_ColMediaVol::m_medVolNr, rm_ColMediaVol::m_minColId, rm_CATCH_DB_THROW_IVD_m, rm_ColMediaVol::Select(), and SQL_NOTFOUND.

Referenced by dbo_CheckAndAddColMediaVol::Process(), and UpdateCollocation().

01264                                                                               {
01265     log_FUNC_A_m(CheckAndAdd, "ColMediaVol");
01266     try {
01267         rm_ColMediaVol cmv(a_colMediaVol);
01268         try {
01269             cmv.Select(cmv.m_minColId, cmv.m_mediaKey, cmv.m_medVolNr);
01270         }
01271         catch (ivd_Exception &e) {
01272             if (e.GetError() == SQL_NOTFOUND){
01273                 cmv.Insert();
01274                 rm_Medium m(cmv.m_mediaKey);
01275                 ostringstream sstr;
01276                 sstr << "Added volume: " << cmv.m_medVolNr << " to collocation set: " << cmv.m_minColId;
01277                 if ((a_flags & API_FLAG_EXCLUSIVE) == API_FLAG_EXCLUSIVE) {
01278                     sstr << " (exclusive)";
01279                 }
01280                 log_WriteEvent(sstr.str(), "", 0, m.barcode);
01281             }
01282             else {
01283                 throw;
01284             }
01285         }
01286     } rm_CATCH_DB_THROW_IVD_m;
01287 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveLibrary ( string  a_libraryName  )  [private]

Definition at line 1323 of file rm_operator.cpp.

References rm_Library::libraryKey, rm_Library::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, and rm_Library::SelectByName().

Referenced by dbo_RemoveLibrary::Process().

01323                                                     {
01324 
01325     try {
01326 
01327         rm_Library library;
01328         rm_String libraryName(rmdb_MAX_LIBRARYNAME);
01329         libraryName = a_libraryName;
01330         library.SelectByName(libraryName);
01331         // remove library only in case it isn't online?
01332         //if ( (library.status != rmdb_INIT_LIBRARY_STATUS) ) {
01333             library.Remove(library.libraryKey);
01334         //} else {
01335         //    throw ivd_Error( ie_RMDB_ERROR, "Can not remove Library. Library in Use", true);
01336         //}
01337     } rm_CATCH_DB_THROW_IVD_m;
01338 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveDrive ( string  a_driveName  )  [private]

Definition at line 1392 of file rm_operator.cpp.

References rm_Drive::driveKey, ie_RMDB_ERROR, ivd_Error, rm_Drive::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_DRIVE_IN_USE, rmdb_MAX_DRIVENAME, rm_Drive::SelectByName(), and rm_Drive::status.

Referenced by dbo_RemoveDrive::Process().

01392                                                 {
01393 
01394     try {
01395 
01396         rm_Drive drive;
01397         rm_String driveName(rmdb_MAX_DRIVENAME);
01398         driveName = a_driveName;
01399         drive.SelectByName(driveName);
01400         if ( (drive.status & rmdb_DRIVE_IN_USE) == 0 ) {
01401             drive.Remove(drive.driveKey);
01402         } else {
01403             throw ivd_Error( ie_RMDB_ERROR, "Can not remove Drive. Drive in Use", true);
01404         }
01405     } rm_CATCH_DB_THROW_IVD_m;
01406 
01407 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveDriveHost ( string  a_driveName,
string  a_host 
) [private]

Definition at line 1409 of file rm_operator.cpp.

References rm_Drive::driveKey, rm_DriveHost::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rmdb_MAX_HOSTNAME, and rm_Drive::SelectByName().

Referenced by dbo_RemoveDriveHost::Process().

01409                                                                    {
01410 
01411     try {
01412 
01413         // @TODO Do we need to check something else before removing the record?
01414         rm_DriveHost driveHost;
01415 
01416         rm_Drive drive;
01417         rm_String driveName(rmdb_MAX_DRIVENAME);
01418         driveName = a_driveName;
01419         drive.SelectByName(driveName);
01420 
01421         rm_String host(rmdb_MAX_HOSTNAME);
01422         host = a_host;
01423         driveHost.Remove(drive.driveKey, host);
01424 
01425     } rm_CATCH_DB_THROW_IVD_m;
01426 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveDSS ( string  a_dssName  )  [private]

Definition at line 1428 of file rm_operator.cpp.

References rm_DiskSubsys::diskSubsysKey, ie_RMDB_ERROR, ivd_Error, rm_DiskSubsys::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_DSS_IN_USE, rmdb_MAX_DSSNAME, rm_DiskSubsys::SelectByName(), and rm_DiskSubsys::status.

Referenced by dbo_RemoveDiskSubsys::Process().

01428                                             {
01429 
01430     try {
01431 
01432         rm_DiskSubsys dss;
01433         rm_String dssName(rmdb_MAX_DSSNAME);
01434         dssName = a_dssName;
01435         dss.SelectByName(dssName);
01436 
01437         if ( (dss.status & rmdb_DSS_IN_USE) == 0 ) {
01438             dss.Remove(dss.diskSubsysKey);
01439         } else {
01440             throw ivd_Error( ie_RMDB_ERROR, "Can not remove DSS. DSS in Use", true);
01441         }
01442     } rm_CATCH_DB_THROW_IVD_m;
01443 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveSlot ( string  a_slotAddr,
string  a_libraryName,
Int32_t  a_slotType 
) [private]

Definition at line 1445 of file rm_operator.cpp.

References rm_Slot::libraryKey, rm_Library::libraryKey, rm_Slot::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, rm_Slot::SelectByLibAddrType(), rm_Library::SelectByName(), and rm_Slot::slotKey.

Referenced by dbo_RemoveSlot::Process().

01445                                                                                         {
01446     try {
01447 
01448         rm_Library library;
01449         rm_String libraryName(rmdb_MAX_LIBRARYNAME);
01450         libraryName = a_libraryName;
01451         library.SelectByName(libraryName);
01452 
01453         rm_Slot slot;
01454         rm_String slotAddr(rmdb_MAX_SLOTADDR);
01455         slotAddr = a_slotAddr;
01456         slot.SelectByLibAddrType(library.libraryKey, slotAddr, a_slotType);
01457         slot.Remove(slot.slotKey, slot.libraryKey);
01458 
01459     } rm_CATCH_DB_THROW_IVD_m;
01460 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveMediaPool ( string  a_mediaPoolName  )  [private]

Definition at line 1462 of file rm_operator.cpp.

References rm_MediaPool::mediaPoolKey, rm_MediaPool::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_MEDIAPOOLNAME, and rm_MediaPool::SelectByName().

Referenced by dbo_RemoveMediaPool::Process().

01462                                                         {
01463     try {
01464 
01465         rm_MediaPool mediaPool;
01466         rm_String mediaPoolName(rmdb_MAX_MEDIAPOOLNAME);
01467         mediaPoolName = a_mediaPoolName;
01468         mediaPool.SelectByName(mediaPoolName);
01469         mediaPool.Remove(mediaPool.mediaPoolKey);
01470     } rm_CATCH_DB_THROW_IVD_m;
01471 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveMedium ( string  a_mediumBarcode  )  [private]

Definition at line 1473 of file rm_operator.cpp.

References ie_RMDB_ERROR, ivd_Error, rm_Medium::mediumKey, rm_Medium::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rmdb_MEDIUM_IN_USE, rm_Medium::SelectByBarcode(), and rm_Medium::status.

Referenced by dbo_RemoveMedium::Process().

01473                                                      {
01474     try {
01475 
01476         rm_Medium medium;
01477         rm_String mediumBarcode(rmdb_MAX_BARCODE);
01478         mediumBarcode = a_mediumBarcode;
01479         medium.SelectByBarcode(mediumBarcode);
01480     if ( (medium.status & rmdb_MEDIUM_IN_USE) == 0 ) {
01481             medium.Remove(medium.mediumKey);
01482         } else {
01483             throw ivd_Error( ie_RMDB_ERROR, "Can not remove Medium. Medium in Use", true);
01484         }
01485     } rm_CATCH_DB_THROW_IVD_m;
01486 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveMediumVol ( string  a_mediumBarcode,
Int32_t  a_mediumVolNr 
) [private]

Definition at line 1488 of file rm_operator.cpp.

References dbg_LOW, log_DBG_m, log_FUNC_m, rm_Medium::mediumKey, rm_MediumVol::Remove(), rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rm_MediumVol::Select(), rm_Medium::SelectByBarcode(), and rm_ColMediaVol::SelectByVolume().

Referenced by dbo_RemoveMediumVol::Process().

01488                                                                                 {
01489     log_FUNC_m(RemoveMediumVol);
01490 
01491     try {
01492         rm_MediumVol mediumVol;
01493         rm_Medium medium;
01494 
01495         rm_String medBarcode(rmdb_MAX_BARCODE);
01496         medBarcode = a_mediumBarcode;
01497         medium.SelectByBarcode(medBarcode);
01498         mediumVol.Select(medium.mediumKey, a_mediumVolNr);
01499 
01500         //remove all collocation entries
01501         rm_ColMediaVol cmv;
01502         vector<rm_ColMediaVol> cmvList = cmv.SelectByVolume(medium.mediumKey, a_mediumVolNr);
01503         for(UInt32_t i(0); i < cmvList.size(); i++){
01504             log_DBG_m(dbg_LOW, "Removed ColMediaVol: " <<
01505                                 cmvList[i].m_minColId << ", " <<
01506                                 cmvList[i].m_mediaKey << ", " <<
01507                                 cmvList[i].m_medVolNr );
01508             cmvList[i].Remove();
01509         }
01510 
01511         //remove volume
01512         mediumVol.Remove(medium.mediumKey, a_mediumVolNr);
01513 
01514     } rm_CATCH_DB_THROW_IVD_m;
01515 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveMajorCol ( UInt64_t  a_majorCol  )  [private]

Definition at line 1340 of file rm_operator.cpp.

References ie_RMDB_ERROR, ivd_Error, rm_MajorCol::Remove(), and rm_CATCH_DB_THROW_IVD_m.

Referenced by dbo_RemoveMajorCol::Process(), and RemoveColIDs().

01340                                                     {
01341 
01342     try {
01343         rm_MajorCol majorCol;
01344         UInt64_t majColId;
01345         majColId = a_majorCol;
01346         if (majColId > 0) {
01347             majorCol.Remove(majColId);
01348         }
01349         else {
01350            throw ivd_Error( ie_RMDB_ERROR, "Can not remove MajorCollocationId.", true);
01351         }
01352     } rm_CATCH_DB_THROW_IVD_m;
01353 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveMinorCol ( UInt64_t  a_minorCol  )  [private]

Definition at line 1355 of file rm_operator.cpp.

References ie_RMDB_ERROR, ivd_Error, rm_MinorCol::Remove(), and rm_CATCH_DB_THROW_IVD_m.

Referenced by dbo_RemoveMinorCol::Process(), and RemoveColIDs().

01355                                                     {
01356     try {
01357         rm_MinorCol minorCol;
01358         UInt64_t minColId;
01359         minColId = a_minColId;
01360         if (minColId != 0) {
01361             minorCol.Remove(minColId);
01362         }
01363         else {
01364            throw ivd_Error( ie_RMDB_ERROR, "Remove MinorCollocationId not allowed.", true);
01365         }
01366     } rm_CATCH_DB_THROW_IVD_m;
01367 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveColMediaVol ( string &  a_mediumBarcode,
Int32_t  a_medVolNr 
) [private]

Definition at line 1369 of file rm_operator.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, i_Medium_t::mediumKey, rm_CATCH_DB_THROW_IVD_m, rm_ColMediaVol::SelectByVolume(), and SelectMedium().

Referenced by dbo_RemoveColMediaVol::Process().

01369                                                                                {
01370     log_FUNC_m(RemoveColMediaVol);
01371     try {
01372         // Get medium key from barcode
01373         i_Medium_t medium;
01374         medium = SelectMedium(a_mediumBarcode);
01375 
01376         // Get all entries for selected volume
01377         rm_ColMediaVol cmv;
01378         vector<rm_ColMediaVol> cmvEntries;
01379         cmvEntries = cmv.SelectByVolume(medium.mediumKey, a_medVolNr);
01380         log_DBG_m(dbg_DETAIL, "Found " << cmvEntries.size() << " entries.");
01381         for (UInt32_t i(0); i< cmvEntries.size(); i++) {
01382             log_DBG_m(dbg_DETAIL, "Removing " << i
01383                 << " m_minColId:" << cmvEntries[i].m_minColId
01384                 << " m_mediaKey:" << cmvEntries[i].m_mediaKey
01385                 << " m_medVolNr:" << cmvEntries[i].m_medVolNr);
01386             cmvEntries[i].Remove();
01387         }
01388         log_DBG_m(dbg_DETAIL, "All entries removed.");
01389     } rm_CATCH_DB_THROW_IVD_m;
01390 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemoveColIDs ( string &  a_partUUID  )  [private]

Definition at line 1517 of file rm_operator.cpp.

References dbg_LOW, log_DBG_m, log_FUNC_m, RemoveMajorCol(), RemoveMinorCol(), SelectAllMajorCol(), and SelectAllMinColByMajCol().

Referenced by dbo_RemoveColIDs::Process().

01517                                                  {
01518     log_FUNC_m(RemoveColIDs);
01519     i_MajorColSeq_t mcs = SelectAllMajorCol();
01520     log_DBG_m(dbg_LOW,"mcs.length(): " << mcs.length());
01521         for (UInt32_t i(0); i < mcs.length(); i++) {
01522             if (a_partUUID.compare(mcs[i].partUUID) == 0) {
01523                 i_MinorColSeq_t minCS = SelectAllMinColByMajCol(mcs[i].majColId);
01524                 log_DBG_m(dbg_LOW,"minCS.length(): " << minCS.length());
01525                 for (UInt32_t j(0); j < minCS.length(); j++) {
01526                     // Remove all minor collocations for selected major collocation
01527                     RemoveMinorCol(minCS[j].minColId);
01528                 }
01529                 RemoveMajorCol(mcs[i].majColId);
01530             }
01531         }
01532 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllLibrary (  )  [private]

Definition at line 4987 of file librmdb.exx.

References errorDesc(), log_FUNC_m, NAME, rmdb_INIT_LIBRARY_STATUS, and SQL_CHECK_M.

04987                                 {
04988     log_FUNC_m(InitAllLibrary);
04989     EXEC SQL
04990         SET TRANSACTION NAME readWriteTrans;
04991     EXEC SQL
04992         UPDATE TRANSACTION readWriteTrans
04993         LIBRARY SET
04994         STATUS = :rmdb_INIT_LIBRARY_STATUS;
04995 
04996     string sqlErrDesc = errorDesc(SQLCODE,"Setting all Library status to rmdb_INIT_LIBRARY_STATUS");
04997     SQL_CHECK_M( sqlErrDesc );
04998 }

Here is the call graph for this function:

void rm_Operator::InitAllDrive (  )  [private]

Definition at line 5000 of file librmdb.exx.

References dbg_DETAIL, errorDesc(), log_DBG_m, log_FUNC_m, NAME, rmdb_DRIVE_IN_USE, and SQL_CHECK_M.

Referenced by dbo_InitAllResource::Process().

05000                               {
05001     log_FUNC_m(InitAllDrive);
05002 
05003     EXEC SQL
05004         SET TRANSACTION NAME readWriteTrans;
05005 
05006     EXEC SQL
05007         DECLARE INIT_ALL_DRIVE CURSOR FOR
05008             SELECT STATUS FROM DRIVE WHERE DRIVE.STATUS != 0;
05009 
05010     EXEC SQL
05011         OPEN TRANSACTION readWriteTrans INIT_ALL_DRIVE;
05012 
05013     while (1) {
05014         UInt32_t cStatus = 0;
05015         EXEC SQL
05016             FETCH
05017             INIT_ALL_DRIVE INTO :cStatus;
05018 
05019         log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on INIT_ALL_DRIVE: " << SQLCODE);
05020 
05021         if (SQLCODE != 0) break;
05022         log_DBG_m(dbg_DETAIL,"Updating drive status");
05023 
05024         UInt32_t newStatus = cStatus & ~(rmdb_DRIVE_IN_USE);
05025         if (newStatus != cStatus){
05026 
05027             EXEC SQL
05028             UPDATE TRANSACTION readWriteTrans
05029             DRIVE SET
05030             STATUS = :newStatus
05031             WHERE CURRENT OF INIT_ALL_DRIVE;
05032 
05033             if (SQLCODE != 0) break;
05034         }
05035     }
05036     string sqlErrDesc = errorDesc(SQLCODE, "Setting all DRIVE status to INIT_DRIVE_STATUS");
05037     SQL_CHECK_M( sqlErrDesc );
05038 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllDriveHost (  )  [private]

Definition at line 5040 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

05040                                   {
05041     log_FUNC_m(InitAllDriveHost);
05042     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
05043 }

void rm_Operator::InitAllDSS (  )  [private]

Definition at line 5045 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

05045                             {
05046     log_FUNC_m(InitAllDSS);
05047     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
05048 }

void rm_Operator::InitAllSlot (  )  [private]

Definition at line 5050 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

05050                              {
05051     log_FUNC_m(InitAllSlot);
05052     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
05053 }

void rm_Operator::InitAllMediaPool (  )  [private]

Definition at line 5055 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

05055                                   {
05056     log_FUNC_m(InitAllMediaPool);
05057     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
05058 }

void rm_Operator::InitAllMedium (  )  [private]

Definition at line 5060 of file librmdb.exx.

References dbg_DETAIL, errorDesc(), log_DBG_m, log_FUNC_m, ms_FULL, ms_OPEN, ms_UNRELIABLE, ms_UNUSABLE, NAME, rmdb_MEDIUM_IN_USE, and SQL_CHECK_M.

Referenced by dbo_InitAllResource::Process().

05060                                {
05061     log_FUNC_m(InitAllMedium);
05062 
05063     EXEC SQL
05064         SET TRANSACTION NAME readWriteTrans;
05065 
05066     EXEC SQL
05067         DECLARE INIT_ALL_MEDIA CURSOR FOR
05068             SELECT STATUS FROM MEDIA WHERE MEDIA.STATUS != 0;
05069 
05070     EXEC SQL
05071         OPEN TRANSACTION readWriteTrans INIT_ALL_MEDIA;
05072 
05073     while (1) {
05074         UInt32_t cStatus = 0;
05075         EXEC SQL
05076             FETCH
05077             INIT_ALL_MEDIA INTO :cStatus;
05078 
05079         log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on INIT_ALL_MEDIA: " << SQLCODE);
05080 
05081         if (SQLCODE != 0) break;
05082 
05083         UInt32_t newStatus = cStatus & ~(rmdb_MEDIUM_IN_USE);
05084         if (   ((newStatus & ms_UNUSABLE) == ms_UNUSABLE)
05085             && ((newStatus & ms_UNRELIABLE) == ms_UNRELIABLE) ){
05086             //clear unreliable flag if unusable is set
05087             newStatus = newStatus & ~ms_UNRELIABLE;
05088         }
05089         if ( ((newStatus & ms_OPEN) == ms_OPEN) &&
05090              ((newStatus & ms_FULL) == ms_FULL) ){
05091             //clear open flag if full is set
05092             newStatus = newStatus & ~(ms_OPEN);
05093         }
05094 
05095         log_DBG_m(dbg_DETAIL, "Medium status changed from " << cStatus <<
05096             " to " << newStatus);
05097         //it is not possible to get barcode (for logging)
05098         //without reading it from database here :(
05099 
05100 
05101         if (newStatus != cStatus){
05102 
05103             EXEC SQL
05104             UPDATE TRANSACTION readWriteTrans
05105             MEDIA SET
05106             STATUS = :newStatus
05107             WHERE CURRENT OF INIT_ALL_MEDIA;
05108 
05109             if (SQLCODE != 0) break;
05110         }
05111     }
05112     string sqlErrDesc = errorDesc(SQLCODE, "Setting all MEDIA status to INIT_MEDIA_STATUS");
05113     SQL_CHECK_M( sqlErrDesc );
05114 
05115 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllMediumVol (  )  [private]

Definition at line 5117 of file librmdb.exx.

References dbg_DETAIL, errorDesc(), log_DBG_m, log_FUNC_m, mvs_FULL, mvs_OPEN, NAME, rmdb_MEDVOL_REORG_INREORG, and SQL_CHECK_M.

Referenced by dbo_InitAllResource::Process().

05117                                   {
05118     log_FUNC_m(InitAllMediumVol);
05119 
05120     EXEC SQL
05121         SET TRANSACTION NAME readWriteTrans;
05122 
05123     EXEC SQL
05124         DECLARE INIT_ALL_MEDIA_VOL CURSOR FOR
05125         SELECT STATUS FROM MEDIAVOL WHERE MEDIAVOL.STATUS > 1;
05126 
05127     EXEC SQL
05128         OPEN TRANSACTION readWriteTrans INIT_ALL_MEDIA_VOL;
05129 
05130     while (1) {
05131         UInt32_t cStatus = 0;
05132         EXEC SQL
05133             FETCH
05134             INIT_ALL_MEDIA_VOL INTO :cStatus;
05135 
05136         log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on INIT_ALL_MEDIA_VOL: " << SQLCODE);
05137 
05138         if (SQLCODE != 0) break;
05139 
05140         log_DBG_m(dbg_DETAIL,"cStatus: " << cStatus);
05141         UInt32_t newStatus = cStatus & ~(rmdb_MEDVOL_REORG_INREORG);
05142         log_DBG_m(dbg_DETAIL,"newStatus: " << newStatus);
05143         if ( ((newStatus & mvs_OPEN) == mvs_OPEN) &&
05144              ((newStatus & mvs_FULL) == mvs_FULL) ){
05145             //clear open flag if full is set
05146             newStatus = newStatus & ~(mvs_OPEN);
05147         }
05148         log_DBG_m(dbg_DETAIL,"newStatus: " << newStatus);
05149 
05150         log_DBG_m(dbg_DETAIL, "Volume status changed from " << cStatus <<
05151             " to " << newStatus);
05152         //it is not possible to get volumeuuid (for logging)
05153         //without reading it from database here :(
05154 
05155         if (newStatus != cStatus){
05156 
05157             EXEC SQL
05158                 UPDATE TRANSACTION readWriteTrans
05159                 MEDIAVOL SET
05160                 STATUS = :newStatus
05161                 WHERE CURRENT OF INIT_ALL_MEDIA_VOL;
05162 
05163             if (SQLCODE != 0) break;
05164         }
05165     }
05166     string sqlErrDesc = errorDesc(SQLCODE,
05167                          "Setting all MEDIAVOL status to INIT_ALL_MEDIA_VOL");
05168     SQL_CHECK_M( sqlErrDesc );
05169 
05170 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_Library_t rm_Operator::SelectLibrary ( string  a_libraryName  )  [private]

Definition at line 1579 of file rm_operator.cpp.

References rm_Library::auditTime, i_Library_t::auditTime, rm_Library::capabilities, i_Library_t::capabilities, rm_Library::controlDevice, i_Library_t::controlDevice, rm_String::cvalue_p, rm_Library::firmwareRev, i_Library_t::firmwareRev, rm_Library::host, i_Library_t::host, rm_Library::libraryKey, i_Library_t::libraryKey, rm_Library::libraryName, i_Library_t::libraryName, rm_Library::libraryType, i_Library_t::libraryType, rm_Library::loadNr, i_Library_t::loadNr, rm_Library::mediaAccessTime, i_Library_t::mediaAccessTime, rm_Library::mediaFamily, i_Library_t::mediaFamily, rm_Library::mediaXChgTime, i_Library_t::mediaXChgTime, rm_Library::options, i_Library_t::options, rm_Library::productID, i_Library_t::productID, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, rm_Library::scsiID, i_Library_t::scsiID, rm_Library::SelectByName(), rm_Library::serialNo, i_Library_t::serialNo, rm_Library::status, i_Library_t::status, rm_Library::unloadNr, i_Library_t::unloadNr, rm_Library::vendorID, and i_Library_t::vendorID.

Referenced by dbo_LibraryStatusClear::Process(), dbo_LibraryStatusSet::Process(), dbo_SelectLibraryByKey::Process(), and dbo_SelectLibrary::Process().

01579                                                             {
01580     i_Library_t i_lib;
01581     try {
01582 
01583         rm_Library lib;
01584         rm_String libName(rmdb_MAX_LIBRARYNAME);
01585         libName = a_libraryName;
01586 
01587         lib.SelectByName(libName);
01588 
01589         i_lib.auditTime        = lib.auditTime;
01590         i_lib.capabilities     = lib.capabilities;
01591         i_lib.libraryKey       = lib.libraryKey;
01592         i_lib.libraryType      = lib.libraryType;
01593         i_lib.loadNr           = lib.loadNr;
01594         i_lib.mediaAccessTime  = lib.mediaAccessTime;
01595         i_lib.mediaFamily      = lib.mediaFamily;
01596         i_lib.mediaXChgTime    = lib.mediaXChgTime;
01597         i_lib.options          = lib.options;
01598         i_lib.status           = lib.status;
01599         i_lib.unloadNr         = lib.unloadNr;
01600 
01601         i_lib.controlDevice    = CORBA::string_dup(lib.controlDevice.cvalue_p);
01602         i_lib.host             = CORBA::string_dup(lib.host.cvalue_p);
01603         i_lib.libraryName      = CORBA::string_dup(lib.libraryName.cvalue_p);
01604         i_lib.productID        = CORBA::string_dup(lib.productID.cvalue_p);
01605         i_lib.serialNo         = CORBA::string_dup(lib.serialNo.cvalue_p);
01606         i_lib.vendorID         = CORBA::string_dup(lib.vendorID.cvalue_p);
01607         i_lib.firmwareRev      = CORBA::string_dup(lib.firmwareRev.cvalue_p);
01608         i_lib.scsiID           = CORBA::string_dup(lib.scsiID.cvalue_p);
01609 
01610         return i_lib;
01611     } rm_CATCH_DB_THROW_IVD_m;
01612 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_Drive_t rm_Operator::SelectDrive ( string  a_driveName  )  [private]

Definition at line 1665 of file rm_operator.cpp.

References rm_Drive::aveSeekTime, i_Drive_t::aveSeekTime, rm_Drive::capabilities, i_Drive_t::capabilities, rm_Drive::cleanNr, i_Drive_t::cleanNr, rm_String::cvalue_p, rm_Drive::dataThroughput, i_Drive_t::dataThroughput, rm_Drive::driveIndex, i_Drive_t::driveIndex, rm_Drive::driveKey, i_Drive_t::driveKey, rm_Drive::driveName, i_Drive_t::driveName, rm_Drive::firmwareRev, i_Drive_t::firmwareRev, rm_TimeStamp::GetTime(), ipc_nilStr, rm_Drive::lastClean, i_Drive_t::lastClean, rm_Drive::libraryKey, rm_Library::libraryName, i_Drive_t::libraryName, rm_Drive::loadTime, i_Drive_t::loadTime, log_FUNC_m, rm_Drive::mediaFamily, i_Drive_t::mediaFamily, rm_Drive::options, i_Drive_t::options, rm_Drive::productID, i_Drive_t::productID, rm_Drive::rewindTime, i_Drive_t::rewindTime, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rm_Drive::scsiID, i_Drive_t::scsiID, rm_Drive::SelectByName(), rm_Drive::serialNo, i_Drive_t::serialNo, rm_Drive::status, i_Drive_t::status, rm_Drive::unloadTime, i_Drive_t::unloadTime, rm_Drive::usageCount, i_Drive_t::usageCount, rm_Drive::vendorID, and i_Drive_t::vendorID.

Referenced by dbo_DriveStatusClear::Process(), dbo_DriveStatusSet::Process(), dbo_DriveError::Process(), dbo_SelectDriveByKey::Process(), dbo_SelectDrive::Process(), and SelectDrive().

01665                                                      {
01666     log_FUNC_m(SelectDrive);
01667     i_Drive_t i_drv;
01668     try {
01669 
01670         rm_Drive d;
01671         rm_String dName(rmdb_MAX_DRIVENAME);
01672         dName = a_driveName;
01673         d.SelectByName(dName);
01674 
01675         i_drv.aveSeekTime      = d.aveSeekTime;
01676         i_drv.capabilities     = d.capabilities;
01677         i_drv.cleanNr          = d.cleanNr;
01678         i_drv.dataThroughput   = d.dataThroughput;
01679         i_drv.driveKey         = d.driveKey;
01680         i_drv.lastClean        = d.lastClean.GetTime();
01681         i_drv.loadTime         = d.loadTime;
01682         i_drv.mediaFamily      = d.mediaFamily;
01683         i_drv.options          = d.options;
01684         i_drv.rewindTime       = d.rewindTime;
01685         i_drv.status           = d.status;
01686         i_drv.unloadTime       = d.unloadTime;
01687         i_drv.usageCount       = d.usageCount;
01688         i_drv.driveIndex       = CORBA::string_dup(d.driveIndex.cvalue_p);
01689         i_drv.driveName        = CORBA::string_dup(d.driveName.cvalue_p);
01690         i_drv.firmwareRev      = CORBA::string_dup(d.firmwareRev.cvalue_p);
01691         i_drv.scsiID           = CORBA::string_dup(d.scsiID.cvalue_p);
01692 
01693 
01694         if (d.libraryKey > 0) {
01695             rm_Library lib(d.libraryKey);
01696             i_drv.libraryName = CORBA::string_dup(lib.libraryName.c_str());
01697         } else {
01698             i_drv.libraryName = CORBA::string_dup(ipc_nilStr);
01699         }
01700 
01701         i_drv.productID        = CORBA::string_dup(d.productID.cvalue_p);
01702         i_drv.serialNo         = CORBA::string_dup(d.serialNo.cvalue_p);
01703         i_drv.vendorID         = CORBA::string_dup(d.vendorID.cvalue_p);
01704 
01705         return i_drv;
01706     } rm_CATCH_DB_THROW_IVD_m;
01707 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_DriveHost_t rm_Operator::SelectDriveHost ( string  a_driveName,
string  a_host 
) [private]

Definition at line 1873 of file rm_operator.cpp.

References rm_DriveHost::controlDevice, i_DriveHost_t::controlDevice, rm_String::cvalue_p, rm_Drive::driveKey, i_DriveHost_t::driveName, rm_DriveHost::host, i_DriveHost_t::host, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rmdb_MAX_HOSTNAME, rm_DriveHost::Select(), and rm_Drive::SelectByName().

Referenced by dbo_SelectDriveHostByKey::Process(), and dbo_SelectDriveHost::Process().

01873                                                                              {
01874     i_DriveHost_t i_dH;
01875     try {
01876 
01877         rm_DriveHost dH;
01878 
01879         rm_String host(rmdb_MAX_HOSTNAME);
01880         host = a_host;
01881 
01882 
01883         rm_String driveName(rmdb_MAX_DRIVENAME);
01884         driveName = a_driveName;
01885         rm_Drive drive;
01886 
01887         drive.SelectByName(driveName);
01888 
01889         dH.Select(drive.driveKey, host);
01890 
01891         i_dH.controlDevice = CORBA::string_dup(dH.controlDevice.cvalue_p);
01892         i_dH.host = CORBA::string_dup(dH.host.cvalue_p);
01893         i_dH.driveName = CORBA::string_dup(driveName.cvalue_p);
01894 
01895         return i_dH;
01896 
01897     } rm_CATCH_DB_THROW_IVD_m;
01898 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_DiskSubsys_t rm_Operator::SelectDSS ( string  a_dssName  )  [private]

Definition at line 1935 of file rm_operator.cpp.

References ie_NYI, and ivd_Error.

Referenced by dbo_SelectDiskSubsysByKey::Process(), and dbo_SelectDiskSubsys::Process().

01935                                                       {
01936     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
01937 }

Here is the caller graph for this function:

i_Slot_t rm_Operator::SelectSlot ( string  a_slotAddr,
string  a_libraryName,
Int32_t  a_slotType 
) [private]

Definition at line 1944 of file rm_operator.cpp.

References rm_Library::libraryKey, i_Slot_t::libraryName, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, rm_Slot::SelectByLibAddrType(), rm_Library::SelectByName(), i_Slot_t::slotAddr, rm_Slot::slotKey, i_Slot_t::slotKey, rm_Slot::slotType, i_Slot_t::slotType, rm_Slot::status, and i_Slot_t::status.

Referenced by dbo_SelectSlotByKey::Process(), and dbo_SelectSlot::Process().

01944                                                                                             {
01945     i_Slot_t i_s;
01946     try {
01947 
01948         rm_Slot s;
01949 
01950         rm_String libraryName(rmdb_MAX_LIBRARYNAME);
01951         libraryName = a_libraryName;
01952         rm_Library lib;
01953         lib.SelectByName(libraryName);
01954 
01955         rm_String slotAddr(rmdb_MAX_SLOTADDR);
01956         slotAddr = a_slotAddr;
01957 
01958         s.SelectByLibAddrType(lib.libraryKey, slotAddr, a_slotType);
01959 
01960         i_s.libraryName = CORBA::string_dup(a_libraryName.c_str());
01961         i_s.slotAddr    = CORBA::string_dup(a_slotAddr.c_str());
01962         i_s.slotKey     = s.slotKey;
01963         i_s.slotType    = s.slotType;
01964         i_s.status      = s.status;
01965 
01966         return i_s;
01967 
01968     } rm_CATCH_DB_THROW_IVD_m;
01969 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediaPool_t rm_Operator::SelectMediaPool ( string  a_mediaPoolName  )  [private]

Definition at line 2039 of file rm_operator.cpp.

References rm_MediaPool::blockSize, i_MediaPool_t::blockSize, rm_String::cvalue_p, rm_MediaPool::maxMediaAge, i_MediaPool_t::maxMediaAge, rm_MediaPool::maxNrReadWrite, i_MediaPool_t::maxNrReadWrite, rm_MediaPool::mediaFamily, i_MediaPool_t::mediaFamily, rm_MediaPool::mediaPoolKey, i_MediaPool_t::mediaPoolKey, rm_MediaPool::mediaPoolName, i_MediaPool_t::mediaPoolName, rm_MediaPool::mediaPoolType, i_MediaPool_t::mediaPoolType, rm_MediaPool::numOfVolumes, i_MediaPool_t::numOfVolumes, rm_MediaPool::partitionUUIDString, i_MediaPool_t::partitionUUIDString, rm_MediaPool::poolUUIDString, i_MediaPool_t::poolUUIDString, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_MEDIAPOOLNAME, rm_MediaPool::SelectByName(), rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sysVolLocation, and i_MediaPool_t::sysVolLocation.

Referenced by dbo_SelectMediaPoolByKey::Process(), and dbo_SelectMediaPool::Process().

02039                                                                   {
02040     i_MediaPool_t i_mp;
02041     try {
02042 
02043         rm_MediaPool mp;
02044         rm_String poolName(rmdb_MAX_MEDIAPOOLNAME);
02045         poolName = a_mediaPoolName;
02046         mp.SelectByName(poolName);
02047 
02048         i_mp.blockSize      = mp.blockSize;
02049         i_mp.numOfVolumes   = mp.numOfVolumes;
02050         i_mp.sysVolLocation    = mp.sysVolLocation;
02051         i_mp.sizeOfSysVol   = mp.sizeOfSysVol;
02052         i_mp.maxMediaAge    = mp.maxMediaAge;
02053         i_mp.maxNrReadWrite = mp.maxNrReadWrite;
02054         i_mp.mediaFamily    = mp.mediaFamily;
02055         i_mp.mediaPoolKey   = mp.mediaPoolKey;
02056         i_mp.mediaPoolName  = CORBA::string_dup(mp.mediaPoolName.cvalue_p);
02057         i_mp.mediaPoolType  = mp.mediaPoolType;
02058         i_mp.partitionUUIDString  = CORBA::string_dup(mp.partitionUUIDString.cvalue_p);
02059         i_mp.poolUUIDString  = CORBA::string_dup(mp.poolUUIDString.cvalue_p);
02060         i_mp.sizeOfVolume   = mp.sizeOfVolume;
02061 
02062         return i_mp;
02063 
02064     } rm_CATCH_DB_THROW_IVD_m;
02065 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediaPool_t rm_Operator::SelectMediaPoolbyUUID ( string  a_mediaPoolUUID  )  [private]

Definition at line 2067 of file rm_operator.cpp.

References rm_MediaPool::blockSize, i_MediaPool_t::blockSize, rm_String::cvalue_p, rm_MediaPool::maxMediaAge, i_MediaPool_t::maxMediaAge, rm_MediaPool::maxNrReadWrite, i_MediaPool_t::maxNrReadWrite, rm_MediaPool::mediaFamily, i_MediaPool_t::mediaFamily, rm_MediaPool::mediaPoolKey, i_MediaPool_t::mediaPoolKey, rm_MediaPool::mediaPoolName, i_MediaPool_t::mediaPoolName, rm_MediaPool::mediaPoolType, i_MediaPool_t::mediaPoolType, rm_MediaPool::numOfVolumes, i_MediaPool_t::numOfVolumes, rm_MediaPool::partitionUUIDString, i_MediaPool_t::partitionUUIDString, rm_MediaPool::poolUUIDString, i_MediaPool_t::poolUUIDString, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_UUID, rm_MediaPool::SelectByUUID(), rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sysVolLocation, and i_MediaPool_t::sysVolLocation.

Referenced by dbo_SelectMediaPoolbyUUID::Process().

02067                                                                         {
02068     i_MediaPool_t i_mp;
02069     try {
02070         rm_MediaPool mp;
02071         rm_String poolUUID(rmdb_MAX_UUID);
02072         poolUUID = a_mediaPoolUUID;
02073         cmn_UUID_t uuid(poolUUID);
02074         mp.SelectByUUID(uuid);
02075 
02076         i_mp.blockSize          = mp.blockSize;
02077         i_mp.numOfVolumes       = mp.numOfVolumes;
02078         i_mp.sysVolLocation     = mp.sysVolLocation;
02079         i_mp.sizeOfSysVol       = mp.sizeOfSysVol;
02080         i_mp.maxMediaAge        = mp.maxMediaAge;
02081         i_mp.maxNrReadWrite     = mp.maxNrReadWrite;
02082         i_mp.mediaFamily        = mp.mediaFamily;
02083         i_mp.mediaPoolKey       = mp.mediaPoolKey;
02084         i_mp.mediaPoolName      = CORBA::string_dup(mp.mediaPoolName.cvalue_p);
02085         i_mp.mediaPoolType      = mp.mediaPoolType;
02086         i_mp.partitionUUIDString
02087             = CORBA::string_dup(mp.partitionUUIDString.cvalue_p);
02088         i_mp.poolUUIDString
02089             = CORBA::string_dup(mp.poolUUIDString.cvalue_p);
02090         i_mp.sizeOfVolume   = mp.sizeOfVolume;
02091 
02092         return i_mp;
02093 
02094     } rm_CATCH_DB_THROW_IVD_m;
02095 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_Medium_t rm_Operator::SelectMedium ( string  a_mediumBarcode  )  [private]

Definition at line 2203 of file rm_operator.cpp.

References rm_Medium::Convert2Corba(), log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, and rm_Medium::SelectByBarcode().

Referenced by dbo_SetReorgScan::Process(), dbo_MediumStatusClear::Process(), dbo_MediumStatusSet::Process(), dbo_MediumUnusable::Process(), dbo_MediumUnreliable::Process(), dbo_VolumeUsage::Process(), dbo_SelectMediumByKey::Process(), dbo_SelectMedium::Process(), RemoveColMediaVol(), and SelectMedium().

02203                                                            {
02204     log_FUNC_m(SelectMedium);
02205     try {
02206 
02207         rm_Medium medium;
02208         rm_String medBarcode(rmdb_MAX_BARCODE);
02209         medBarcode = a_mediumBarcode;
02210         medium.SelectByBarcode(medBarcode);
02211 
02212         i_Medium_t iMedium;
02213         iMedium = medium.Convert2Corba();
02214         return iMedium;
02215     } rm_CATCH_DB_THROW_IVD_m;
02216 
02217 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumVol_t rm_Operator::SelectMediumVol ( string  a_mediumBarcode,
Int32_t  a_mediumVolNr 
) [private]

Definition at line 2375 of file rm_operator.cpp.

References rm_MediumVol::accessNr, i_MediumVol_t::accessNr, rm_MediumVol::accessTime, i_MediumVol_t::accessTime, rm_TimeStamp::GetTime(), rm_MediumVol::initTime, i_MediumVol_t::initTime, rm_MediumVol::lastVerification, i_MediumVol_t::lastVerification, log_FUNC_m, i_MediumVol_t::mediumBarcode, rm_Medium::mediumKey, rm_MediumVol::medVolId, i_MediumVol_t::medVolId, rm_MediumVol::medVolNr, i_MediumVol_t::medVolNr, rm_MediumVol::owriteNr, i_MediumVol_t::owriteNr, rm_MediumVol::owriteTime, i_MediumVol_t::owriteTime, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rm_MediumVol::Select(), rm_Medium::SelectByBarcode(), rm_MediumVol::status, i_MediumVol_t::status, rm_MediumVol::totalData, i_MediumVol_t::totalData, rm_MediumVol::validData, i_MediumVol_t::validData, rm_MediumVol::volSize, i_MediumVol_t::volSize, rm_MediumVol::volType, i_MediumVol_t::volType, rm_MediumVol::volUsed, i_MediumVol_t::volUsed, rm_MediumVol::writeNr, i_MediumVol_t::writeNr, rm_MediumVol::writeTime, and i_MediumVol_t::writeTime.

Referenced by dbo_MedVolStatusClear::Process(), dbo_MedVolStatusSet::Process(), dbo_VolumeError::Process(), dbo_VolumeUsage::Process(), dbo_UpdateDataSize::Process(), dbo_SelectMediumVolByUUID::Process(), dbo_SelectMediumVolByKey::Process(), dbo_SelectMediumVol::Process(), and SelectMediumVol().

02375                                                                                          {
02376     log_FUNC_m(SelectMediumVol);
02377     try {
02378 
02379         rm_Medium medium;
02380         rm_String medBarcode(rmdb_MAX_BARCODE);
02381         medBarcode = a_mediumBarcode;
02382         medium.SelectByBarcode(medBarcode);
02383 
02384         rm_MediumVol mediumVol;
02385         mediumVol.Select(medium.mediumKey, a_mediumVolNr);
02386 
02387         i_MediumVol_t iMediumVol;
02388 
02389         iMediumVol.medVolNr          = mediumVol.medVolNr;
02390         iMediumVol.mediumBarcode     = CORBA::string_dup(medBarcode.c_str());
02391         iMediumVol.accessNr          = mediumVol.accessNr;
02392         iMediumVol.accessTime        = mediumVol.accessTime.GetTime();
02393         iMediumVol.initTime          = mediumVol.initTime.GetTime();
02394         iMediumVol.lastVerification  = mediumVol.lastVerification.GetTime();
02395         iMediumVol.medVolId          = CORBA::string_dup(mediumVol.medVolId.c_str());
02396         iMediumVol.owriteNr          = mediumVol.owriteNr;
02397         iMediumVol.owriteTime        = mediumVol.owriteTime.GetTime();
02398         iMediumVol.status            = mediumVol.status;
02399         iMediumVol.volSize           = mediumVol.volSize;
02400         iMediumVol.volType           = mediumVol.volType;
02401         iMediumVol.volUsed           = mediumVol.volUsed;
02402         iMediumVol.writeNr           = mediumVol.writeNr;
02403         iMediumVol.writeTime         = mediumVol.writeTime.GetTime();
02404         iMediumVol.totalData         = mediumVol.totalData;
02405         iMediumVol.validData         = mediumVol.validData;
02406 
02407         return iMediumVol;
02408     } rm_CATCH_DB_THROW_IVD_m;
02409 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MinorCol_t rm_Operator::SelectMinorCol ( UInt64_t  a_minColId  )  [private]

Definition at line 1558 of file rm_operator.cpp.

References dbg_LOW, i_MinorCol_t::flags, log_DBG_m, log_FUNC_m, rm_MinorCol::m_flags, rm_MinorCol::m_majColId, rm_MinorCol::m_minColId, i_MinorCol_t::majColId, i_MinorCol_t::minColId, rm_CATCH_DB_THROW_IVD_m, and rm_MinorCol::Select().

Referenced by dbo_SelectMinorCol::Process().

01558                                                             {
01559     log_FUNC_m(SelectMinorCol);
01560     i_MinorCol_t i_minorCol;
01561     try {
01562         rm_MinorCol minorCol;
01563         UInt64_t minColId(a_minColId);
01564 
01565         minorCol.Select(minColId);
01566 
01567         i_minorCol.minColId        = minorCol.m_minColId;
01568         i_minorCol.majColId        = minorCol.m_majColId;
01569         i_minorCol.flags           = minorCol.m_flags;
01570 
01571         log_DBG_m(dbg_LOW,"Select Minor Collocation: " << i_minorCol.minColId << ","
01572                                                        << i_minorCol.majColId << ","
01573                                                        << i_minorCol.flags);
01574         return i_minorCol;
01575 
01576     } rm_CATCH_DB_THROW_IVD_m;
01577 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MajorCol_t rm_Operator::SelectMajorCol ( UInt64_t  a_majColId  )  [private]

Definition at line 1534 of file rm_operator.cpp.

References rm_String::cvalue_p, dbg_LOW, rm_MajorCol::flags, i_MajorCol_t::flags, log_DBG_m, log_FUNC_m, rm_MajorCol::majColId, i_MajorCol_t::majColId, rm_MajorCol::majColSize, i_MajorCol_t::majColSize, rm_MajorCol::partUUID, i_MajorCol_t::partUUID, rm_CATCH_DB_THROW_IVD_m, and rm_MajorCol::Select().

Referenced by dbo_SelectMajorCol::Process().

01534                                                             {
01535     log_FUNC_m(SelectMajorCol);
01536     i_MajorCol_t i_majorCol;
01537     try {
01538         rm_MajorCol majorCol;
01539         UInt64_t majColId;
01540         majColId = a_majColId;
01541 
01542         majorCol.Select(majColId);
01543 
01544         i_majorCol.majColId        = majorCol.majColId;
01545         i_majorCol.majColSize      = majorCol.majColSize;
01546         i_majorCol.partUUID        = majorCol.partUUID.cvalue_p;
01547         i_majorCol.flags           = majorCol.flags;
01548 
01549         log_DBG_m(dbg_LOW,"Select MajorCol: " << i_majorCol.majColId << ","
01550                                               << i_majorCol.majColSize << ","
01551                                               << i_majorCol.partUUID << ","
01552                                               << i_majorCol.flags);
01553         return i_majorCol;
01554 
01555     } rm_CATCH_DB_THROW_IVD_m;
01556 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_Library_t rm_Operator::SelectLibrary ( Int32_t  a_libraryKey  )  [private]

Definition at line 2861 of file rm_operator.cpp.

References rm_Library::auditTime, i_Library_t::auditTime, rm_Library::capabilities, i_Library_t::capabilities, rm_Library::controlDevice, i_Library_t::controlDevice, rm_String::cvalue_p, rm_Library::firmwareRev, i_Library_t::firmwareRev, rm_Library::host, i_Library_t::host, rm_Library::libraryKey, i_Library_t::libraryKey, rm_Library::libraryName, i_Library_t::libraryName, rm_Library::libraryType, i_Library_t::libraryType, rm_Library::loadNr, i_Library_t::loadNr, rm_Library::mediaAccessTime, i_Library_t::mediaAccessTime, rm_Library::mediaFamily, i_Library_t::mediaFamily, rm_Library::mediaXChgTime, i_Library_t::mediaXChgTime, rm_Library::options, i_Library_t::options, rm_Library::productID, i_Library_t::productID, rm_CATCH_DB_THROW_IVD_m, rm_Library::scsiID, i_Library_t::scsiID, rm_Library::Select(), rm_Library::serialNo, i_Library_t::serialNo, rm_Library::status, i_Library_t::status, rm_Library::unloadNr, i_Library_t::unloadNr, rm_Library::vendorID, and i_Library_t::vendorID.

02861                                                               {
02862     i_Library_t i_lib;
02863     try {
02864 
02865         rm_Library lib;
02866 
02867         lib.Select(a_libraryKey);
02868 
02869         i_lib.auditTime        = lib.auditTime;
02870         i_lib.capabilities     = lib.capabilities;
02871         i_lib.libraryKey       = lib.libraryKey;
02872         i_lib.libraryType      = lib.libraryType;
02873         i_lib.loadNr           = lib.loadNr;
02874         i_lib.mediaAccessTime  = lib.mediaAccessTime;
02875         i_lib.mediaFamily      = lib.mediaFamily;
02876         i_lib.mediaXChgTime    = lib.mediaXChgTime;
02877         i_lib.options          = lib.options;
02878         i_lib.status           = lib.status;
02879         i_lib.unloadNr         = lib.unloadNr;
02880 
02881         i_lib.controlDevice    = CORBA::string_dup(lib.controlDevice.cvalue_p);
02882         i_lib.host             = CORBA::string_dup(lib.host.cvalue_p);
02883         i_lib.libraryName      = CORBA::string_dup(lib.libraryName.cvalue_p);
02884         i_lib.productID        = CORBA::string_dup(lib.productID.cvalue_p);
02885         i_lib.serialNo         = CORBA::string_dup(lib.serialNo.cvalue_p);
02886         i_lib.vendorID         = CORBA::string_dup(lib.vendorID.cvalue_p);
02887         i_lib.firmwareRev         = CORBA::string_dup(lib.firmwareRev.cvalue_p);
02888         i_lib.scsiID         = CORBA::string_dup(lib.scsiID.cvalue_p);
02889 
02890         return i_lib;
02891     } rm_CATCH_DB_THROW_IVD_m;
02892 }

Here is the call graph for this function:

i_Drive_t rm_Operator::SelectDrive ( Int32_t  a_driveKey  )  [private]

Definition at line 2894 of file rm_operator.cpp.

References rm_Drive::aveSeekTime, i_Drive_t::aveSeekTime, rm_Drive::capabilities, i_Drive_t::capabilities, rm_Drive::cleanNr, i_Drive_t::cleanNr, rm_String::cvalue_p, rm_Drive::dataThroughput, i_Drive_t::dataThroughput, rm_Drive::driveIndex, i_Drive_t::driveIndex, rm_Drive::driveKey, i_Drive_t::driveKey, rm_Drive::driveName, i_Drive_t::driveName, rm_Drive::firmwareRev, i_Drive_t::firmwareRev, rm_TimeStamp::GetTime(), ipc_nilStr, rm_Drive::lastClean, i_Drive_t::lastClean, rm_Drive::libraryKey, rm_Library::libraryName, i_Drive_t::libraryName, rm_Drive::loadTime, i_Drive_t::loadTime, log_FUNC_m, rm_Drive::mediaFamily, i_Drive_t::mediaFamily, rm_Drive::options, i_Drive_t::options, rm_Drive::productID, i_Drive_t::productID, rm_Drive::rewindTime, i_Drive_t::rewindTime, rm_CATCH_DB_THROW_IVD_m, rm_Drive::scsiID, i_Drive_t::scsiID, rm_Library::Select(), rm_Drive::Select(), SelectDrive(), rm_Drive::serialNo, i_Drive_t::serialNo, rm_Drive::status, i_Drive_t::status, rm_Drive::unloadTime, i_Drive_t::unloadTime, rm_Drive::usageCount, i_Drive_t::usageCount, rm_Drive::vendorID, and i_Drive_t::vendorID.

02894                                                      {
02895     log_FUNC_m(SelectDrive);
02896     i_Drive_t i_drv;
02897     try {
02898 
02899         rm_Drive d;
02900 
02901         d.Select(a_driveKey);
02902 
02903         i_drv.aveSeekTime      = d.aveSeekTime;
02904         i_drv.capabilities     = d.capabilities;
02905         i_drv.cleanNr          = d.cleanNr;
02906         i_drv.dataThroughput   = d.dataThroughput;
02907         i_drv.driveKey         = d.driveKey;
02908         i_drv.lastClean        = d.lastClean.GetTime();
02909         i_drv.loadTime         = d.loadTime;
02910         i_drv.mediaFamily     = d.mediaFamily;
02911         i_drv.options          = d.options;
02912         i_drv.rewindTime       = d.rewindTime;
02913         i_drv.status           = d.status;
02914         i_drv.unloadTime       = d.unloadTime;
02915         i_drv.usageCount       = d.usageCount;
02916         i_drv.driveIndex       = CORBA::string_dup(d.driveIndex.cvalue_p);
02917         i_drv.firmwareRev       = CORBA::string_dup(d.firmwareRev.cvalue_p);
02918         i_drv.scsiID       = CORBA::string_dup(d.scsiID.cvalue_p);
02919 
02920         i_drv.driveName        = CORBA::string_dup(d.driveName.cvalue_p);
02921 
02922         if (d.libraryKey > 0) {
02923             rm_Library lib;
02924             lib.Select(d.libraryKey);
02925             i_drv.libraryName      = CORBA::string_dup(lib.libraryName.cvalue_p);
02926         } else {
02927             i_drv.libraryName      = CORBA::string_dup(ipc_nilStr);
02928         }
02929 
02930         i_drv.productID        = CORBA::string_dup(d.productID.cvalue_p);
02931         i_drv.serialNo         = CORBA::string_dup(d.serialNo.cvalue_p);
02932         i_drv.vendorID         = CORBA::string_dup(d.vendorID.cvalue_p);
02933 
02934         return i_drv;
02935     } rm_CATCH_DB_THROW_IVD_m;
02936 }

Here is the call graph for this function:

i_DriveHost_t rm_Operator::SelectDriveHost ( Int32_t  a_driveKey,
string  a_host 
) [private]

Definition at line 2939 of file rm_operator.cpp.

References rm_DriveHost::controlDevice, i_DriveHost_t::controlDevice, rm_String::cvalue_p, rm_Drive::driveName, i_DriveHost_t::driveName, rm_DriveHost::host, i_DriveHost_t::host, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_HOSTNAME, and rm_DriveHost::Select().

02939                                                                              {
02940     i_DriveHost_t i_dH;
02941     try {
02942 
02943         rm_DriveHost dH;
02944         rm_String host(rmdb_MAX_HOSTNAME);
02945         host = a_host;
02946 
02947         dH.Select(a_driveKey, host);
02948         rm_Drive d(a_driveKey);
02949 
02950         i_dH.controlDevice = CORBA::string_dup(dH.controlDevice.cvalue_p);
02951         i_dH.host = CORBA::string_dup(dH.host.cvalue_p);
02952         i_dH.driveName = CORBA::string_dup(d.driveName.cvalue_p);
02953 
02954         return i_dH;
02955 
02956     } rm_CATCH_DB_THROW_IVD_m;
02957 }

Here is the call graph for this function:

i_DiskSubsys_t rm_Operator::SelectDSS ( Int32_t  a_dssKey  )  [private]

Definition at line 2960 of file rm_operator.cpp.

References ie_NYI, and ivd_Error.

02960                                                       {
02961     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
02962 }

i_Slot_t rm_Operator::SelectSlot ( string  a_slotAddr,
Int32_t  a_libraryKey,
Int32_t  a_slotType 
) [private]

Definition at line 1973 of file rm_operator.cpp.

References rm_Library::libraryKey, rm_Library::libraryName, i_Slot_t::libraryName, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_SLOTADDR, rm_Slot::SelectByLibAddrType(), rm_Library::SelectByName(), i_Slot_t::slotAddr, rm_Slot::slotKey, i_Slot_t::slotKey, rm_Slot::slotType, i_Slot_t::slotType, rm_Slot::status, and i_Slot_t::status.

01973                                                                                             {
01974 
01975     i_Slot_t i_s;
01976     try {
01977 
01978         rm_Slot s;
01979 
01980         rm_Library lib;
01981         lib.SelectByName(a_libraryKey);
01982 
01983         rm_String slotAddr(rmdb_MAX_SLOTADDR);
01984         slotAddr = a_slotAddr;
01985 
01986         s.SelectByLibAddrType(lib.libraryKey, slotAddr, a_slotType);
01987 
01988         i_s.libraryName = CORBA::string_dup(lib.libraryName.c_str());
01989         i_s.slotAddr    = CORBA::string_dup(a_slotAddr.c_str());
01990         i_s.slotKey     = s.slotKey;
01991         i_s.slotType    = s.slotType;
01992         i_s.status      = s.status;
01993 
01994         return i_s;
01995 
01996     } rm_CATCH_DB_THROW_IVD_m;
01997 }

Here is the call graph for this function:

i_MediaPool_t rm_Operator::SelectMediaPool ( Int32_t  a_mediumPoolKey  )  [private]

Definition at line 2964 of file rm_operator.cpp.

References rm_MediaPool::blockSize, i_MediaPool_t::blockSize, rm_String::cvalue_p, rm_MediaPool::maxMediaAge, i_MediaPool_t::maxMediaAge, rm_MediaPool::maxNrReadWrite, i_MediaPool_t::maxNrReadWrite, rm_MediaPool::mediaFamily, i_MediaPool_t::mediaFamily, rm_MediaPool::mediaPoolKey, i_MediaPool_t::mediaPoolKey, rm_MediaPool::mediaPoolName, i_MediaPool_t::mediaPoolName, rm_MediaPool::mediaPoolType, i_MediaPool_t::mediaPoolType, rm_MediaPool::numOfVolumes, i_MediaPool_t::numOfVolumes, rm_MediaPool::partitionUUIDString, i_MediaPool_t::partitionUUIDString, rm_MediaPool::poolUUIDString, i_MediaPool_t::poolUUIDString, rm_CATCH_DB_THROW_IVD_m, rm_MediaPool::Select(), rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sysVolLocation, and i_MediaPool_t::sysVolLocation.

02964                                                                   {
02965     i_MediaPool_t i_mp;
02966     try {
02967 
02968         rm_MediaPool mp;
02969 
02970         mp.Select(a_mediaPoolKey);
02971 
02972         i_mp.blockSize      = mp.blockSize;
02973         i_mp.numOfVolumes   = mp.numOfVolumes;
02974         i_mp.sysVolLocation    = mp.sysVolLocation;
02975         i_mp.sizeOfSysVol   = mp.sizeOfSysVol;
02976         i_mp.maxMediaAge    = mp.maxMediaAge;
02977         i_mp.maxNrReadWrite = mp.maxNrReadWrite;
02978         i_mp.mediaFamily    = mp.mediaFamily;
02979         i_mp.mediaPoolKey   = mp.mediaPoolKey;
02980         i_mp.mediaPoolName  = CORBA::string_dup(mp.mediaPoolName.cvalue_p);
02981         i_mp.mediaPoolType  = mp.mediaPoolType;
02982         i_mp.partitionUUIDString  = CORBA::string_dup(mp.partitionUUIDString.cvalue_p);
02983         i_mp.poolUUIDString  = CORBA::string_dup(mp.poolUUIDString.cvalue_p);
02984         i_mp.sizeOfVolume   = mp.sizeOfVolume;
02985 
02986         return i_mp;
02987 
02988     } rm_CATCH_DB_THROW_IVD_m;
02989 }

Here is the call graph for this function:

i_Medium_t rm_Operator::SelectMedium ( Int32_t  a_mediumKey  )  [private]

Definition at line 2991 of file rm_operator.cpp.

References rm_Medium::barcode, i_Medium_t::barcode, rm_Medium::blockSize, i_Medium_t::blockSize, rm_Medium::currentVolume, i_Medium_t::currentVolume, rm_Medium::diskSubsysKey, rm_DiskSubsys::diskSubsysName, i_Medium_t::diskSubsysName, rm_Medium::driveKey, rm_Drive::driveName, i_Medium_t::driveName, rm_Medium::idxOfSysVol, i_Medium_t::idxOfSysVol, ipc_nilStr, rm_Library::libraryKey, rm_Medium::libraryKey, rm_Library::libraryName, i_Medium_t::libraryName, rm_Medium::location, i_Medium_t::location, log_FUNC_m, rm_Medium::mediaPoolKey, rm_MediaPool::mediaPoolName, i_Medium_t::mediaPoolName, rm_Medium::mediumKey, i_Medium_t::mediumKey, rm_Medium::mediumSerialNo, i_Medium_t::mediumSerialNo, rm_Medium::mediumType, i_Medium_t::mediumType, rm_Medium::numOfVolumes, i_Medium_t::numOfVolumes, rm_Partition::partitionName, i_Medium_t::partitionName, rm_MediaPool::partitionUUIDString, rm_CATCH_DB_THROW_IVD_m, rm_Medium::Select(), rm_Partition::SelectByUuid(), SelectMedium(), rm_Medium::sizeOfSysVol, i_Medium_t::sizeOfSysVol, i_Medium_t::slotAddr, rm_Medium::slotKey, i_Medium_t::slotType, rm_Medium::status, and i_Medium_t::status.

02991                                                         {
02992     log_FUNC_m(SelectMedium);
02993     try {
02994 
02995         rm_Medium medium;
02996         medium.Select(a_mediumKey);
02997 
02998         i_Medium_t iMedium;
02999 
03000         iMedium.mediumKey         = medium.mediumKey;
03001         if (medium.mediaPoolKey > 0 ) {
03002             rm_MediaPool mp(medium.mediaPoolKey);
03003             iMedium.mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
03004             if (!string(mp.partitionUUIDString).empty()){
03005                 rm_Partition part;
03006                 part.SelectByUuid(mp.partitionUUIDString);
03007                 iMedium.partitionName    = CORBA::string_dup(part.partitionName.c_str());
03008             } else {
03009                 iMedium.partitionName    = CORBA::string_dup(ipc_nilStr);
03010             }
03011         } else {
03012             iMedium.mediaPoolName    = CORBA::string_dup(ipc_nilStr);
03013             iMedium.partitionName    = CORBA::string_dup(ipc_nilStr);
03014         }
03015 
03016 
03017 
03018         if (medium.libraryKey > 0) {
03019             rm_Library lib(medium.libraryKey);
03020             iMedium.libraryName       = CORBA::string_dup(lib.libraryName.c_str());
03021 
03022             rm_Slot s(medium.slotKey,lib.libraryKey);
03023 
03024             iMedium.slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
03025             iMedium.slotType          = s.slotType;
03026         } else {
03027             iMedium.libraryName       = CORBA::string_dup(ipc_nilStr);
03028             iMedium.slotAddr          = CORBA::string_dup(ipc_nilStr);
03029             iMedium.slotType          = 0;
03030         }
03031 
03032 
03033         if (medium.driveKey > 0) {
03034             rm_Drive d(medium.driveKey);
03035             iMedium.driveName    = CORBA::string_dup(d.driveName.c_str());
03036         } else {
03037             iMedium.driveName    = CORBA::string_dup(ipc_nilStr);
03038         }
03039 
03040 
03041         if (medium.diskSubsysKey > 0) {
03042             rm_DiskSubsys dss(medium.diskSubsysKey);
03043             iMedium.diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
03044         } else {
03045             iMedium.diskSubsysName    = CORBA::string_dup(ipc_nilStr);
03046         }
03047 
03048         iMedium.barcode          = CORBA::string_dup(medium.barcode.c_str());
03049         iMedium.status           = medium.status;
03050         iMedium.location         = CORBA::string_dup(medium.location.c_str());
03051         iMedium.mediumType       = medium.mediumType;
03052         iMedium.mediumSerialNo   = CORBA::string_dup(medium.mediumSerialNo.c_str());
03053         iMedium.blockSize        = medium.blockSize;
03054         iMedium.numOfVolumes     = medium.numOfVolumes;
03055         iMedium.idxOfSysVol      = medium.idxOfSysVol;
03056         iMedium.sizeOfSysVol     = medium.sizeOfSysVol;
03057         iMedium.currentVolume    = medium.currentVolume;
03058 
03059         return iMedium;
03060     } rm_CATCH_DB_THROW_IVD_m;
03061 
03062 }

Here is the call graph for this function:

i_Medium_t rm_Operator::SelectMediumByDrive ( string  a_driveName  )  [private]

Definition at line 2219 of file rm_operator.cpp.

References rm_Medium::barcode, i_Medium_t::barcode, rm_Medium::blockSize, i_Medium_t::blockSize, rm_Medium::currentVolume, i_Medium_t::currentVolume, rm_Medium::diskSubsysKey, rm_DiskSubsys::diskSubsysName, i_Medium_t::diskSubsysName, rm_Medium::driveKey, rm_Drive::driveKey, rm_Drive::driveName, i_Medium_t::driveName, rm_Medium::idxOfSysVol, i_Medium_t::idxOfSysVol, ipc_nilStr, rm_Library::libraryKey, rm_Medium::libraryKey, rm_Library::libraryName, i_Medium_t::libraryName, rm_Medium::location, i_Medium_t::location, log_FUNC_m, rm_Medium::mediaPoolKey, rm_MediaPool::mediaPoolName, i_Medium_t::mediaPoolName, rm_Medium::mediumKey, i_Medium_t::mediumKey, rm_Medium::mediumSerialNo, i_Medium_t::mediumSerialNo, rm_Medium::mediumType, i_Medium_t::mediumType, rm_Medium::numOfVolumes, i_Medium_t::numOfVolumes, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rm_Medium::SelectByDrive(), rm_Drive::SelectByName(), rm_Medium::sizeOfSysVol, i_Medium_t::sizeOfSysVol, rm_Slot::slotAddr, i_Medium_t::slotAddr, rm_Medium::slotKey, rm_Slot::slotType, i_Medium_t::slotType, rm_Medium::status, and i_Medium_t::status.

Referenced by dbo_SelectMediumByDrive::Process().

02219                                                               {
02220     log_FUNC_m(SelectMediumByDrive);
02221 
02222     try {
02223 
02224         rm_Drive d;
02225         rm_String driveName(rmdb_MAX_DRIVENAME);
02226         driveName = a_driveName;
02227         d.SelectByName(driveName);
02228 
02229 
02230         rm_Medium medium;
02231         medium.SelectByDrive(d.driveKey);
02232 
02233         i_Medium_t iMedium;
02234 
02235         iMedium.mediumKey = medium.mediumKey;
02236 
02237         if (medium.mediaPoolKey > 0 ) {
02238             rm_MediaPool mp(medium.mediaPoolKey);
02239             iMedium.mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
02240         } else {
02241             iMedium.mediaPoolName    = CORBA::string_dup(ipc_nilStr);
02242         }
02243 
02244 
02245         if (medium.libraryKey > 0) {
02246             rm_Library lib(medium.libraryKey);
02247             iMedium.libraryName       = CORBA::string_dup(lib.libraryName.c_str());
02248 
02249             if (medium.slotKey > 0) {
02250                 rm_Slot s(medium.slotKey,lib.libraryKey);
02251                 iMedium.slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
02252                 iMedium.slotType          = s.slotType;
02253             } else {
02254                 iMedium.slotAddr          = CORBA::string_dup(ipc_nilStr);
02255                 iMedium.slotType          = 0;
02256             }
02257 
02258 
02259         } else {
02260             iMedium.libraryName       = CORBA::string_dup(ipc_nilStr);
02261         }
02262 
02263 
02264         if (medium.driveKey > 0) {
02265             iMedium.driveName    = CORBA::string_dup(d.driveName.c_str());
02266         } else {
02267             iMedium.driveName    = CORBA::string_dup(ipc_nilStr);
02268         }
02269 
02270 
02271         if (medium.diskSubsysKey > 0) {
02272             rm_DiskSubsys dss(medium.diskSubsysKey);
02273             iMedium.diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
02274         } else {
02275             iMedium.diskSubsysName    = CORBA::string_dup(ipc_nilStr);
02276         }
02277 
02278         iMedium.barcode          = CORBA::string_dup(medium.barcode.c_str());
02279         iMedium.status           = medium.status;
02280         iMedium.location         = CORBA::string_dup(medium.location.c_str());
02281         iMedium.mediumType       = medium.mediumType;
02282         iMedium.mediumSerialNo   = CORBA::string_dup(medium.mediumSerialNo.c_str() );
02283         iMedium.blockSize        = medium.blockSize;
02284         iMedium.numOfVolumes     = medium.numOfVolumes;
02285         iMedium.idxOfSysVol      = medium.idxOfSysVol;
02286         iMedium.sizeOfSysVol     = medium.sizeOfSysVol;
02287         iMedium.currentVolume    = medium.currentVolume;
02288 
02289         return iMedium;
02290     } rm_CATCH_DB_THROW_IVD_m;
02291 
02292 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumVol_t rm_Operator::SelectMediumVol ( Int32_t  a_mediumKey,
Int32_t  a_mediumVolNr 
) [private]

Definition at line 3065 of file rm_operator.cpp.

References rm_MediumVol::accessNr, i_MediumVol_t::accessNr, rm_MediumVol::accessTime, i_MediumVol_t::accessTime, rm_Medium::barcode, rm_TimeStamp::GetTime(), rm_MediumVol::initTime, i_MediumVol_t::initTime, rm_MediumVol::lastVerification, i_MediumVol_t::lastVerification, log_FUNC_m, i_MediumVol_t::mediumBarcode, rm_MediumVol::medVolId, i_MediumVol_t::medVolId, rm_MediumVol::medVolNr, i_MediumVol_t::medVolNr, rm_MediumVol::owriteNr, i_MediumVol_t::owriteNr, rm_MediumVol::owriteTime, i_MediumVol_t::owriteTime, rm_CATCH_DB_THROW_IVD_m, rm_MediumVol::Select(), rm_Medium::Select(), SelectMediumVol(), rm_MediumVol::status, i_MediumVol_t::status, rm_MediumVol::volSize, i_MediumVol_t::volSize, rm_MediumVol::volType, i_MediumVol_t::volType, rm_MediumVol::volUsed, i_MediumVol_t::volUsed, rm_MediumVol::writeNr, i_MediumVol_t::writeNr, rm_MediumVol::writeTime, and i_MediumVol_t::writeTime.

03065                                                                                         {
03066     log_FUNC_m(SelectMediumVol);
03067     try {
03068 
03069         rm_Medium medium;
03070         medium.Select(a_mediumKey);
03071 
03072         rm_MediumVol mediumVol;
03073         mediumVol.Select(a_mediumKey, a_mediumVolNr);
03074 
03075         i_MediumVol_t iMediumVol;
03076 
03077         iMediumVol.medVolNr          = mediumVol.medVolNr;
03078         iMediumVol.mediumBarcode      = CORBA::string_dup(medium.barcode.c_str());
03079         iMediumVol.accessNr          = mediumVol.accessNr;
03080         iMediumVol.accessTime        = mediumVol.accessTime.GetTime();
03081         iMediumVol.initTime          = mediumVol.initTime.GetTime();
03082         iMediumVol.lastVerification  = mediumVol.lastVerification.GetTime();
03083         iMediumVol.medVolId          = CORBA::string_dup(mediumVol.medVolId.c_str());
03084         iMediumVol.owriteNr          = mediumVol.owriteNr;
03085         iMediumVol.owriteTime        = mediumVol.owriteTime.GetTime();
03086         iMediumVol.status            = mediumVol.status;
03087         iMediumVol.volSize           = mediumVol.volSize;
03088         iMediumVol.volType           = mediumVol.volType;
03089         iMediumVol.volUsed           = mediumVol.volUsed;
03090         iMediumVol.writeNr           = mediumVol.writeNr;
03091         iMediumVol.writeTime         = mediumVol.writeTime.GetTime();
03092 
03093         return iMediumVol;
03094     } rm_CATCH_DB_THROW_IVD_m;
03095 
03096 }

Here is the call graph for this function:

i_MediumVol_t rm_Operator::SelectMediumVol ( string  a_medVolId  )  [private]

Definition at line 2411 of file rm_operator.cpp.

References rm_MediumVol::accessNr, i_MediumVol_t::accessNr, rm_MediumVol::accessTime, i_MediumVol_t::accessTime, rm_Medium::barcode, rm_TimeStamp::GetTime(), rm_MediumVol::initTime, i_MediumVol_t::initTime, ivd_UUID_STR_SIZE_d, rm_MediumVol::lastVerification, i_MediumVol_t::lastVerification, log_FUNC_m, i_MediumVol_t::mediumBarcode, rm_MediumVol::mediumKey, rm_MediumVol::medVolId, i_MediumVol_t::medVolId, rm_MediumVol::medVolNr, i_MediumVol_t::medVolNr, rm_MediumVol::owriteNr, i_MediumVol_t::owriteNr, rm_MediumVol::owriteTime, i_MediumVol_t::owriteTime, rm_CATCH_DB_THROW_IVD_m, rm_MediumVol::SelectByMedVolId(), SelectMediumVol(), rm_MediumVol::status, i_MediumVol_t::status, rm_MediumVol::totalData, i_MediumVol_t::totalData, rm_MediumVol::validData, i_MediumVol_t::validData, rm_MediumVol::volSize, i_MediumVol_t::volSize, rm_MediumVol::volType, i_MediumVol_t::volType, rm_MediumVol::volUsed, i_MediumVol_t::volUsed, rm_MediumVol::writeNr, i_MediumVol_t::writeNr, rm_MediumVol::writeTime, and i_MediumVol_t::writeTime.

02411                                                              {
02412     log_FUNC_m(SelectMediumVol);
02413 
02414     try {
02415         rm_String medVolId(ivd_UUID_STR_SIZE_d);
02416         medVolId = a_medVolId;
02417 
02418         rm_MediumVol mediumVol;
02419         mediumVol.SelectByMedVolId(medVolId);
02420         rm_Medium medium(mediumVol.mediumKey);
02421 
02422         i_MediumVol_t iMediumVol;
02423 
02424         iMediumVol.medVolNr          = mediumVol.medVolNr;
02425         iMediumVol.mediumBarcode     = CORBA::string_dup(medium.barcode.c_str());
02426         iMediumVol.accessNr          = mediumVol.accessNr;
02427         iMediumVol.accessTime        = mediumVol.accessTime.GetTime();
02428         iMediumVol.initTime          = mediumVol.initTime.GetTime();
02429         iMediumVol.lastVerification  = mediumVol.lastVerification.GetTime();
02430         iMediumVol.medVolId          = CORBA::string_dup(mediumVol.medVolId.c_str());
02431         iMediumVol.owriteNr          = mediumVol.owriteNr;
02432         iMediumVol.owriteTime        = mediumVol.owriteTime.GetTime();
02433         iMediumVol.status            = mediumVol.status;
02434         iMediumVol.volSize           = mediumVol.volSize;
02435         iMediumVol.volType           = mediumVol.volType;
02436         iMediumVol.volUsed           = mediumVol.volUsed;
02437         iMediumVol.writeNr           = mediumVol.writeNr;
02438         iMediumVol.writeTime         = mediumVol.writeTime.GetTime();
02439         iMediumVol.totalData         = mediumVol.totalData;
02440         iMediumVol.validData         = mediumVol.validData;
02441 
02442         return iMediumVol;
02443     } rm_CATCH_DB_THROW_IVD_m;
02444 }

Here is the call graph for this function:

i_ColMediaVolSeq_t rm_Operator::SelectAllColVolumes (  )  [private]

Definition at line 1806 of file rm_operator.cpp.

References dbg_NORM, log_DBG_m, log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, and rm_ColMediaVol::SelectAll().

Referenced by dbo_SelectAllColVolumes::Process().

01806                                                     {
01807     log_FUNC_m(AllColVolumes);
01808     i_ColMediaVolSeq_t i_cmvSeq;
01809     try {
01810         rm_ColMediaVol cmv;
01811         vector<rm_ColMediaVol> c;
01812         c = cmv.SelectAll();
01813         log_DBG_m(dbg_NORM,"vector size:" << int(c.size()));
01814         i_cmvSeq.length(c.size());
01815         for (UInt32_t i = 0; i < c.size(); i++ ) {
01816             i_cmvSeq[i].minColId   = c[i].m_minColId;
01817             i_cmvSeq[i].mediaKey   = c[i].m_mediaKey;
01818             i_cmvSeq[i].medVolNr   = c[i].m_medVolNr;
01819 
01820         log_DBG_m(dbg_NORM,"Collocation volume: (" << c[i].m_minColId << ","
01821                                                    << c[i].m_mediaKey << ","
01822                                                    << c[i].m_medVolNr << ")");
01823         }
01824     }rm_CATCH_DB_THROW_IVD_m;
01825     return i_cmvSeq;
01826 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_DriveSeq_t rm_Operator::SelectAllDrives (  )  [private]

Definition at line 1827 of file rm_operator.cpp.

References ipc_nilStr, rm_Library::libraryName, rm_CATCH_DB_THROW_IVD_m, and rm_Drive::SelectAll().

Referenced by dbo_SelectAllDrives::Process().

01827                                           {
01828     i_DriveSeq_t i_drvSeq;
01829     try {
01830 
01831         rm_Drive drv;
01832         vector<rm_Drive> d;
01833         d = drv.SelectAll();
01834         i_drvSeq.length(d.size());
01835 
01836         for (UInt32_t i = 0; i < d.size(); i++) {
01837             i_drvSeq[i].aveSeekTime      = d[i].aveSeekTime;
01838             i_drvSeq[i].capabilities     = d[i].capabilities;
01839             i_drvSeq[i].cleanNr          = d[i].cleanNr;
01840             i_drvSeq[i].dataThroughput   = d[i].dataThroughput;
01841             i_drvSeq[i].driveKey         = d[i].driveKey;
01842             i_drvSeq[i].lastClean        = d[i].lastClean.GetTime();
01843 
01844             if (d[i].libraryKey > 0) {
01845                 rm_Library lib(d[i].libraryKey);
01846                 i_drvSeq[i].libraryName = CORBA::string_dup(lib.libraryName.c_str());
01847             } else {
01848                 i_drvSeq[i].libraryName = CORBA::string_dup(ipc_nilStr);
01849             }
01850 
01851             i_drvSeq[i].loadTime         = d[i].loadTime;
01852             i_drvSeq[i].mediaFamily      = d[i].mediaFamily;
01853             i_drvSeq[i].options          = d[i].options;
01854             i_drvSeq[i].rewindTime       = d[i].rewindTime;
01855             i_drvSeq[i].status           = d[i].status;
01856             i_drvSeq[i].unloadTime       = d[i].unloadTime;
01857             i_drvSeq[i].usageCount       = d[i].usageCount;
01858             i_drvSeq[i].driveName        = CORBA::string_dup(d[i].driveName.cvalue_p);
01859             i_drvSeq[i].driveIndex       = CORBA::string_dup(d[i].driveIndex.cvalue_p);
01860             i_drvSeq[i].productID        = CORBA::string_dup(d[i].productID.cvalue_p);
01861             i_drvSeq[i].serialNo         = CORBA::string_dup(d[i].serialNo.cvalue_p);
01862             i_drvSeq[i].vendorID         = CORBA::string_dup(d[i].vendorID.cvalue_p);
01863             i_drvSeq[i].firmwareRev      = CORBA::string_dup(d[i].firmwareRev.cvalue_p);
01864             i_drvSeq[i].scsiID           = CORBA::string_dup(d[i].scsiID.cvalue_p);
01865         }
01866 
01867         return i_drvSeq;
01868     }rm_CATCH_DB_THROW_IVD_m;
01869 
01870     return i_drvSeq;
01871 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MinorColSeq_t rm_Operator::SelectAllMinorCol (  )  [private]

Definition at line 1748 of file rm_operator.cpp.

References dbg_LOW, ivd_BaseException::GetError(), log_DBG_m, log_FUNC_m, rm_MinorCol::Next(), rm_CATCH_DB_THROW_IVD_m, SelectAllMajorCol(), SQL_NOTFOUND, and rm_MinorCol::StartSelectAll().

Referenced by dbo_SelectAllMinorCol::Process().

01748                                                {
01749     log_FUNC_m(SelectAllMajorCol);
01750 
01751     i_MinorColSeq_t i_minorColSeq;
01752     vector<rm_MinorCol> minorColVec;
01753     try {
01754         rm_MinorCol mc;
01755         mc.StartSelectAll();
01756         bool last = false;
01757         while (!last) {
01758             try {
01759                 mc.Next();
01760                 minorColVec.push_back(mc);
01761             } catch (ivd_DBException& e) {
01762                 if (e.GetError() == SQL_NOTFOUND) {
01763                     last = true;
01764                 } else throw;
01765             }
01766         }
01767         i_minorColSeq.length(minorColVec.size());
01768         for (UInt32_t i = 0; i < minorColVec.size(); i++) {
01769            i_minorColSeq[i].minColId   = minorColVec[i].m_minColId;
01770            i_minorColSeq[i].majColId   = minorColVec[i].m_majColId;
01771            i_minorColSeq[i].flags      = minorColVec[i].m_flags;
01772 
01773         log_DBG_m(dbg_LOW,"Minor Collocation: (" << i_minorColSeq[i].minColId << ","
01774                                                  << i_minorColSeq[i].majColId << ","
01775                                                  << i_minorColSeq[i].flags << ")");
01776         }
01777 
01778     }rm_CATCH_DB_THROW_IVD_m;
01779     return i_minorColSeq;
01780 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MinorColSeq_t rm_Operator::SelectAllMinColByMajCol ( UInt64_t  a_majColId  )  [private]

Definition at line 1782 of file rm_operator.cpp.

References dbg_NORM, log_DBG_m, log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, and rm_MinorCol::SelectByMajCol().

Referenced by dbo_SelectMinColByMajCol::Process(), and RemoveColIDs().

01782                                                                         {
01783     log_FUNC_m(SelectAllMinColByMajCol);
01784 
01785     i_MinorColSeq_t iMinorColSeq;
01786     vector<rm_MinorCol> minorColVec;
01787 
01788     try {
01789         rm_MinorCol mcVec;
01790         minorColVec = mcVec.SelectByMajCol(a_majColId);
01791         iMinorColSeq.length(minorColVec.size());
01792         for (UInt32_t i = 0; i < minorColVec.size(); i++) {
01793             iMinorColSeq[i].minColId = minorColVec[i].m_minColId;
01794             iMinorColSeq[i].majColId = minorColVec[i].m_majColId;
01795             iMinorColSeq[i].flags    = minorColVec[i].m_flags;
01796 
01797             log_DBG_m(dbg_NORM,"MinorCol for majColId: (" << iMinorColSeq[i].minColId << ","
01798                                                           << iMinorColSeq[i].majColId << ","
01799                                                           << iMinorColSeq[i].flags << ")");
01800         }
01801     }rm_CATCH_DB_THROW_IVD_m;
01802 
01803     return iMinorColSeq;
01804 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MajorColSeq_t rm_Operator::SelectAllMajorCol (  )  [private]

Definition at line 1708 of file rm_operator.cpp.

References dbg_LOW, ivd_BaseException::GetError(), log_DBG_m, log_FUNC_m, rm_MajorCol::Next(), rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, and rm_MajorCol::StartSelectAll().

Referenced by dbo_SelectAllMajorCol::Process(), RemoveColIDs(), and SelectAllMinorCol().

01708                                                {
01709     log_FUNC_m(SelectAllMajorCol);
01710 
01711     i_MajorColSeq_t i_majorColSeq;
01712     vector<rm_MajorCol> majorColVec;
01713     try {
01714         rm_MajorCol mc;
01715         mc.StartSelectAll();
01716         try {
01717             while (true) {
01718                 mc.Next();
01719                 majorColVec.push_back(mc);
01720             }
01721         }
01722         catch (ivd_DBException& e) {
01723             if (e.GetError() == SQL_NOTFOUND) {
01724                 // end of entries in RMDB
01725             }
01726             else {
01727                 throw;
01728             }
01729         }
01730         i_majorColSeq.length(majorColVec.size());
01731 
01732         for (UInt32_t i = 0; i < majorColVec.size(); i++) {
01733            i_majorColSeq[i].majColId   = majorColVec[i].majColId;
01734            i_majorColSeq[i].majColSize = majorColVec[i].majColSize;
01735            i_majorColSeq[i].partUUID   = CORBA::string_dup(majorColVec[i].partUUID.c_str());
01736            i_majorColSeq[i].flags      = majorColVec[i].flags;
01737 
01738         log_DBG_m(dbg_LOW,"Major Collocation: (" << i_majorColSeq[i].majColId << ","
01739                                                  << i_majorColSeq[i].majColSize << ","
01740                                                  << i_majorColSeq[i].partUUID << ", "
01741                                                  << i_majorColSeq[i].flags << ")");
01742         }
01743 
01744     }rm_CATCH_DB_THROW_IVD_m;
01745     return i_majorColSeq;
01746 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_LibrarySeq_t rm_Operator::SelectAllLibraries (  )  [private]

Definition at line 1614 of file rm_operator.cpp.

References ivd_BaseException::GetError(), log_FUNC_m, rm_Library::Next(), rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, and rm_Library::StartSelectAll().

Referenced by dbo_SelectAllLibraries::Process().

01614                                                {
01615     log_FUNC_m(SelectAllLibraries);
01616 
01617     i_LibrarySeq_t iLibSeq;
01618     vector<rm_Library> rmLibVec;
01619     try {
01620         rm_Library lib;
01621 
01622         lib.StartSelectAll();
01623 
01624         bool last = false;
01625         while (!last) {
01626             try {
01627                 lib.Next();
01628                 rmLibVec.push_back(lib);
01629 
01630             } catch (ivd_DBException& e) {
01631                 if (e.GetError() == SQL_NOTFOUND) {
01632                     last = true;
01633                 } else throw;
01634             }
01635         }
01636         iLibSeq.length(rmLibVec.size());
01637         for (UInt32_t i = 0; i < rmLibVec.size(); i++ ) {
01638             iLibSeq[i].auditTime        = rmLibVec[i].auditTime;
01639             iLibSeq[i].capabilities     = rmLibVec[i].capabilities;
01640             iLibSeq[i].libraryKey       = rmLibVec[i].libraryKey;
01641             iLibSeq[i].libraryType      = rmLibVec[i].libraryType;
01642             iLibSeq[i].loadNr           = rmLibVec[i].loadNr;
01643             iLibSeq[i].mediaAccessTime  = rmLibVec[i].mediaAccessTime;
01644             iLibSeq[i].mediaFamily      = rmLibVec[i].mediaFamily;
01645             iLibSeq[i].mediaXChgTime    = rmLibVec[i].mediaXChgTime;
01646             iLibSeq[i].options          = rmLibVec[i].options;
01647             iLibSeq[i].status           = rmLibVec[i].status;
01648             iLibSeq[i].unloadNr         = rmLibVec[i].unloadNr;
01649 
01650             iLibSeq[i].controlDevice    = CORBA::string_dup(rmLibVec[i].controlDevice.cvalue_p);
01651             iLibSeq[i].host             = CORBA::string_dup(rmLibVec[i].host.cvalue_p);
01652             iLibSeq[i].libraryName      = CORBA::string_dup(rmLibVec[i].libraryName.cvalue_p);
01653             iLibSeq[i].productID        = CORBA::string_dup(rmLibVec[i].productID.cvalue_p);
01654             iLibSeq[i].serialNo         = CORBA::string_dup(rmLibVec[i].serialNo.cvalue_p);
01655             iLibSeq[i].vendorID         = CORBA::string_dup(rmLibVec[i].vendorID.cvalue_p);
01656             iLibSeq[i].firmwareRev      = CORBA::string_dup(rmLibVec[i].firmwareRev.cvalue_p);
01657             iLibSeq[i].scsiID           = CORBA::string_dup(rmLibVec[i].scsiID.cvalue_p);
01658         }
01659 
01660     } rm_CATCH_DB_THROW_IVD_m;
01661     return iLibSeq;
01662 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_DriveHostSeq_t rm_Operator::SelectAllDriveHosts (  )  [private]

Definition at line 1900 of file rm_operator.cpp.

References rm_String::cvalue_p, rm_Drive::driveName, ivd_BaseException::GetError(), log_FUNC_m, rm_DriveHost::Next(), rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, and rm_DriveHost::StartSelectAll().

Referenced by dbo_SelectAllDriveHosts::Process().

01900                                                   {
01901     log_FUNC_m(SelectAllDriveHosts);
01902 
01903     i_DriveHostSeq_t iDriveHostSeq;
01904     vector<rm_DriveHost> rmDHVec;
01905     try {
01906         rm_DriveHost dH;
01907 
01908         dH.StartSelectAll();
01909         bool last = false;
01910 
01911         while (!last) {
01912             try {
01913                 dH.Next();
01914                 rmDHVec.push_back(dH);
01915             } catch (ivd_DBException& e) {
01916                 if (e.GetError() == SQL_NOTFOUND) {
01917                     last = true;
01918                 } else throw;
01919             }
01920         }
01921         iDriveHostSeq.length(rmDHVec.size());
01922 
01923         for (UInt32_t i = 0; i < rmDHVec.size(); i++ ) {
01924             iDriveHostSeq[i].controlDevice  = CORBA::string_dup(rmDHVec[i].controlDevice.cvalue_p);
01925             iDriveHostSeq[i].host           = CORBA::string_dup(rmDHVec[i].host.cvalue_p);
01926             rm_Drive d(rmDHVec[i].driveKey);
01927             iDriveHostSeq[i].driveName      = CORBA::string_dup(d.driveName.cvalue_p);
01928         }
01929     } rm_CATCH_DB_THROW_IVD_m;
01930 
01931     return iDriveHostSeq;
01932 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_DssSeq_t rm_Operator::SelectAllDSS (  )  [private]

Definition at line 1939 of file rm_operator.cpp.

References ie_NYI, and ivd_Error.

Referenced by dbo_SelectAllDiskSubsys::Process().

01939                                      {
01940     throw ivd_Error( ie_NYI, "Not Yet Implemented" );
01941 }

Here is the caller graph for this function:

i_SlotSeq_t rm_Operator::SelectAllSlots (  )  [private]

Definition at line 2000 of file rm_operator.cpp.

References ivd_BaseException::GetError(), ipc_nilStr, rm_Library::libraryName, log_FUNC_m, rm_Slot::Next(), rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, and rm_Slot::StartSelectAll().

Referenced by dbo_SelectAllSlots::Process().

02000                                         {
02001     log_FUNC_m(SelectAllSlots);
02002 
02003     i_SlotSeq_t iSlotSeq;
02004     vector<rm_Slot> rmSlotVec;
02005     try {
02006         rm_Slot slot;
02007         slot.StartSelectAll();
02008         bool last = false;
02009 
02010         while (!last) {
02011             try {
02012                 slot.Next();
02013                 rmSlotVec.push_back(slot);
02014             } catch (ivd_DBException& e) {
02015                 if (e.GetError() == SQL_NOTFOUND) {
02016                     last = true;
02017                 } else throw;
02018             }
02019         }
02020         iSlotSeq.length(rmSlotVec.size());
02021         for (UInt32_t i = 0; i < rmSlotVec.size(); i++ ) {
02022             if (rmSlotVec[i].libraryKey > 0) {
02023                 rm_Library lib(rmSlotVec[i].libraryKey);
02024                 iSlotSeq[i].libraryName = CORBA::string_dup(lib.libraryName.c_str());
02025             } else {
02026                 iSlotSeq[i].libraryName = CORBA::string_dup(ipc_nilStr);
02027             }
02028             iSlotSeq[i].slotAddr    = CORBA::string_dup(rmSlotVec[i].slotAddr.c_str());
02029             iSlotSeq[i].slotKey     = rmSlotVec[i].slotKey;
02030             iSlotSeq[i].slotType    = rmSlotVec[i].slotType;
02031             iSlotSeq[i].status      = rmSlotVec[i].status;
02032         }
02033     } rm_CATCH_DB_THROW_IVD_m;
02034     return iSlotSeq;
02035 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediaPoolSeq_t rm_Operator::SelectAllMediaPools (  )  [private]

Definition at line 2097 of file rm_operator.cpp.

References ivd_BaseException::GetError(), log_FUNC_m, rm_MediaPool::Next(), rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, and rm_MediaPool::StartSelectAll().

Referenced by dbo_SelectAllMediaPool::Process().

02097                                                    {
02098     log_FUNC_m(SelectAllMediaPools);
02099 
02100     i_MediaPoolSeq_t iMediaPoolSeq;
02101     vector<rm_MediaPool> rmMPVec;
02102     try {
02103         rm_MediaPool mp;
02104         mp.StartSelectAll();
02105         bool last = false;
02106 
02107         while (!last) {
02108             try {
02109                 mp.Next();
02110                 rmMPVec.push_back(mp);
02111             } catch (ivd_DBException& e) {
02112                 if (e.GetError() == SQL_NOTFOUND) {
02113                     last = true;
02114                 } else throw;
02115             }
02116         }
02117         iMediaPoolSeq.length(rmMPVec.size());
02118         for (UInt32_t i = 0; i < rmMPVec.size(); i++ ) {
02119             iMediaPoolSeq[i].blockSize      = rmMPVec[i].blockSize;
02120             iMediaPoolSeq[i].numOfVolumes   = rmMPVec[i].numOfVolumes;
02121             iMediaPoolSeq[i].sysVolLocation    = rmMPVec[i].sysVolLocation;
02122             iMediaPoolSeq[i].sizeOfSysVol   = rmMPVec[i].sizeOfSysVol;
02123             iMediaPoolSeq[i].maxMediaAge    = rmMPVec[i].maxMediaAge;
02124             iMediaPoolSeq[i].maxNrReadWrite = rmMPVec[i].maxNrReadWrite;
02125             iMediaPoolSeq[i].mediaFamily    = rmMPVec[i].mediaFamily;
02126             iMediaPoolSeq[i].mediaPoolKey   = rmMPVec[i].mediaPoolKey;
02127             iMediaPoolSeq[i].mediaPoolName  = CORBA::string_dup(rmMPVec[i].mediaPoolName.cvalue_p);
02128             iMediaPoolSeq[i].mediaPoolType  = rmMPVec[i].mediaPoolType;
02129             iMediaPoolSeq[i].partitionUUIDString  = CORBA::string_dup(rmMPVec[i].partitionUUIDString.cvalue_p);
02130             iMediaPoolSeq[i].poolUUIDString  = CORBA::string_dup(rmMPVec[i].poolUUIDString.cvalue_p);
02131             iMediaPoolSeq[i].sizeOfVolume   = rmMPVec[i].sizeOfVolume;
02132 
02133         }
02134     } rm_CATCH_DB_THROW_IVD_m;
02135 
02136     return iMediaPoolSeq;
02137 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumSeq_t rm_Operator::SelectAllMedium (  )  [private]

Definition at line 2294 of file rm_operator.cpp.

References rm_DiskSubsys::diskSubsysName, rm_Drive::driveName, ivd_BaseException::GetError(), ipc_nilStr, rm_Library::libraryKey, rm_Library::libraryName, log_FUNC_m, rm_MediaPool::mediaPoolName, rm_Medium::Next(), rm_CATCH_DB_THROW_IVD_m, rm_Slot::slotAddr, rm_Slot::slotType, SQL_NOTFOUND, and rm_Medium::StartSelectAll().

Referenced by InventoryUpdate(), and dbo_SelectAllMedium::Process().

02294                                            {
02295     log_FUNC_m(SelectAllMedium);
02296 
02297     i_MediumSeq_t iMediumSeq;
02298     vector<rm_Medium> rmMedVec;
02299     try {
02300         rm_Medium m;
02301 
02302         m.StartSelectAll();
02303         bool last = false;
02304 
02305         while (!last) {
02306             try {
02307                 m.Next();
02308                 rmMedVec.push_back(m);
02309             } catch (ivd_DBException& e) {
02310                 if (e.GetError() == SQL_NOTFOUND) {
02311                     last = true;
02312                 } else throw;
02313             }
02314         }
02315         iMediumSeq.length( rmMedVec.size() );
02316 
02317         for (UInt32_t i = 0; i < rmMedVec.size(); i++ ) {
02318 
02319             iMediumSeq[i].mediumKey         = rmMedVec[i].mediumKey;
02320             if (rmMedVec[i].mediaPoolKey > 0 ) {
02321                 rm_MediaPool mp(rmMedVec[i].mediaPoolKey);
02322                 iMediumSeq[i].mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
02323             } else {
02324                 iMediumSeq[i].mediaPoolName    = CORBA::string_dup(ipc_nilStr);
02325             }
02326 
02327 
02328             if (rmMedVec[i].libraryKey > 0) {
02329                 rm_Library lib(rmMedVec[i].libraryKey);
02330                 iMediumSeq[i].libraryName       = CORBA::string_dup(lib.libraryName.c_str());
02331                 if (rmMedVec[i].slotKey > 0) {
02332                     rm_Slot s(rmMedVec[i].slotKey,lib.libraryKey);
02333                     iMediumSeq[i].slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
02334                     iMediumSeq[i].slotType          = s.slotType;
02335                 } else {
02336                     iMediumSeq[i].slotAddr          = CORBA::string_dup(ipc_nilStr);
02337                     iMediumSeq[i].slotType          = 0;
02338                 }
02339             } else {
02340                 iMediumSeq[i].libraryName       = CORBA::string_dup(ipc_nilStr);
02341             }
02342 
02343 
02344             if (rmMedVec[i].driveKey > 0) {
02345                 rm_Drive d(rmMedVec[i].driveKey);
02346                 iMediumSeq[i].driveName    = CORBA::string_dup(d.driveName.c_str());
02347             } else {
02348                 iMediumSeq[i].driveName    = CORBA::string_dup(ipc_nilStr);
02349             }
02350 
02351 
02352             if (rmMedVec[i].diskSubsysKey > 0) {
02353                 rm_DiskSubsys dss(rmMedVec[i].diskSubsysKey);
02354                 iMediumSeq[i].diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
02355             } else {
02356                 iMediumSeq[i].diskSubsysName    = CORBA::string_dup(ipc_nilStr);
02357             }
02358 
02359             iMediumSeq[i].barcode          = CORBA::string_dup(rmMedVec[i].barcode.c_str());
02360             iMediumSeq[i].status           = rmMedVec[i].status;
02361             iMediumSeq[i].location         = CORBA::string_dup(rmMedVec[i].location.c_str());
02362             iMediumSeq[i].mediumType        = rmMedVec[i].mediumType;
02363             iMediumSeq[i].mediumSerialNo   = CORBA::string_dup(rmMedVec[i].mediumSerialNo.c_str());
02364             iMediumSeq[i].blockSize        = rmMedVec[i].blockSize;
02365             iMediumSeq[i].numOfVolumes     = rmMedVec[i].numOfVolumes;
02366             iMediumSeq[i].idxOfSysVol      = rmMedVec[i].idxOfSysVol;
02367             iMediumSeq[i].sizeOfSysVol     = rmMedVec[i].sizeOfSysVol;
02368             iMediumSeq[i].currentVolume    = rmMedVec[i].currentVolume;
02369         }
02370     }rm_CATCH_DB_THROW_IVD_m;
02371     return iMediumSeq;
02372 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumVolSeq_t rm_Operator::SelectAllMediumVol (  )  [private]

Definition at line 2447 of file rm_operator.cpp.

References rm_Medium::barcode, ivd_BaseException::GetError(), log_FUNC_m, rm_MediumVol::Next(), rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, and rm_MediumVol::StartSelectAll().

Referenced by dbo_SelectAllMediumVol::Process().

02447                                                  {
02448     log_FUNC_m(SelectAllMediumVol);
02449 
02450     i_MediumVolSeq_t iMediumVolSeq;
02451     vector<rm_MediumVol> rmMVVec;
02452     try {
02453         rm_MediumVol mv;
02454         mv.StartSelectAll();
02455         bool last = false;
02456         while (!last) {
02457             try {
02458                 mv.Next();
02459                 rmMVVec.push_back(mv);
02460             } catch (ivd_DBException& e) {
02461                 if (e.GetError() == SQL_NOTFOUND) {
02462                     last = true;
02463                 } else throw;
02464             }
02465         }
02466         iMediumVolSeq.length(rmMVVec.size());
02467         for (UInt32_t i = 0; i < rmMVVec.size(); i++ ) {
02468             iMediumVolSeq[i].medVolNr          = rmMVVec[i].medVolNr;
02469             rm_Medium m(rmMVVec[i].mediumKey);
02470             iMediumVolSeq[i].mediumBarcode      = CORBA::string_dup(m.barcode.c_str());
02471             iMediumVolSeq[i].accessNr          = rmMVVec[i].accessNr;
02472             iMediumVolSeq[i].accessTime        = rmMVVec[i].accessTime.GetTime();
02473             iMediumVolSeq[i].initTime          = rmMVVec[i].initTime.GetTime();
02474             iMediumVolSeq[i].lastVerification  = rmMVVec[i].lastVerification.GetTime();
02475             iMediumVolSeq[i].medVolId          = CORBA::string_dup(rmMVVec[i].medVolId.c_str());
02476             iMediumVolSeq[i].owriteNr          = rmMVVec[i].owriteNr;
02477             iMediumVolSeq[i].owriteTime        = rmMVVec[i].owriteTime.GetTime();
02478             iMediumVolSeq[i].status            = rmMVVec[i].status;
02479             iMediumVolSeq[i].volSize           = rmMVVec[i].volSize;
02480             iMediumVolSeq[i].volType           = rmMVVec[i].volType;
02481             iMediumVolSeq[i].volUsed           = rmMVVec[i].volUsed;
02482             iMediumVolSeq[i].writeNr           = rmMVVec[i].writeNr;
02483             iMediumVolSeq[i].writeTime         = rmMVVec[i].writeTime.GetTime();
02484             iMediumVolSeq[i].totalData         = rmMVVec[i].totalData;
02485             iMediumVolSeq[i].validData         = rmMVVec[i].validData;
02486         }
02487     }rm_CATCH_DB_THROW_IVD_m;
02488     return iMediumVolSeq;
02489 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumVolSeq_t rm_Operator::SelectAllMediumVolByMedium ( string  a_barcode  )  [private]

Definition at line 2556 of file rm_operator.cpp.

References rm_Medium::barcode, log_FUNC_m, rm_Medium::mediumKey, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rm_Medium::SelectByBarcode(), and rm_MediumVol::SelectByMedium().

Referenced by dbo_SelectAllMediumVolByBarcode::Process().

02556                                                                          {
02557     log_FUNC_m(SelectAllMediumVolByMedium);
02558 
02559     i_MediumVolSeq_t iMediumVolSeq;
02560     vector<rm_MediumVol> rmMVVec;
02561     try {
02562         rm_Medium m;
02563         rm_String barcode(rmdb_MAX_BARCODE);
02564         barcode = a_barcode;
02565         m.SelectByBarcode(barcode);
02566         rm_MediumVol mv;
02567         rmMVVec = mv.SelectByMedium(m.mediumKey);
02568         iMediumVolSeq.length(rmMVVec.size());
02569         for (UInt32_t i = 0; i < rmMVVec.size(); i++ ) {
02570             iMediumVolSeq[i].medVolNr          = rmMVVec[i].medVolNr;
02571             rm_Medium m(rmMVVec[i].mediumKey);
02572             iMediumVolSeq[i].mediumBarcode      = CORBA::string_dup(m.barcode.c_str());
02573             iMediumVolSeq[i].accessNr          = rmMVVec[i].accessNr;
02574             iMediumVolSeq[i].accessTime        = rmMVVec[i].accessTime.GetTime();
02575             iMediumVolSeq[i].initTime          = rmMVVec[i].initTime.GetTime();
02576             iMediumVolSeq[i].lastVerification  = rmMVVec[i].lastVerification.GetTime();
02577             iMediumVolSeq[i].medVolId          = CORBA::string_dup(rmMVVec[i].medVolId.c_str());
02578             iMediumVolSeq[i].owriteNr          = rmMVVec[i].owriteNr;
02579             iMediumVolSeq[i].owriteTime        = rmMVVec[i].owriteTime.GetTime();
02580             iMediumVolSeq[i].status            = rmMVVec[i].status;
02581             iMediumVolSeq[i].volSize           = rmMVVec[i].volSize;
02582             iMediumVolSeq[i].volType           = rmMVVec[i].volType;
02583             iMediumVolSeq[i].volUsed           = rmMVVec[i].volUsed;
02584             iMediumVolSeq[i].writeNr           = rmMVVec[i].writeNr;
02585             iMediumVolSeq[i].writeTime         = rmMVVec[i].writeTime.GetTime();
02586             iMediumVolSeq[i].totalData         = rmMVVec[i].totalData;
02587             iMediumVolSeq[i].validData         = rmMVVec[i].validData;
02588         }
02589     }rm_CATCH_DB_THROW_IVD_m;
02590     return iMediumVolSeq;
02591 
02592 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumSeqByVol_t rm_Operator::SelectAllMediumVolByPart ( string &  a_partName,
bool  a_unRecovered 
) [private]

!! Do not increase i ! volume should be inserted in next loop

Definition at line 2594 of file rm_operator.cpp.

References dbg_DETAIL, dbg_LOW, ivd_BaseException::GetError(), log_DBG_m, log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_PARTITIONNAME, rmdb_MEDVOL_RECOVER, rm_MediumVol::SelectByPartition(), size, and SQL_NOTFOUND.

Referenced by dbo_ClearReorgScan::Process(), dbo_SetReorgScan::Process(), and dbo_SelectAllMediumVolByPart::Process().

02594                                                                                                {
02595     log_FUNC_m(SelectAllMediumVolByPart);
02596 
02597 
02598     typedef vector<rm_MediumVol> rm_MedVec_t;
02599     rm_MedVec_t rmMVVec;
02600     i_MediumSeqByVol_t iMedSeq;
02601     try {
02602 
02603         iMedSeq.length(0);
02604 
02605         rm_MediumVol mv;
02606         rm_String partName(rmdb_MAX_PARTITIONNAME);
02607         partName = a_partName;
02608 
02609         try {
02610             rmMVVec = mv.SelectByPartition(partName);
02611         } catch (ivd_DBException& e) {
02612             if (e.GetError() == SQL_NOTFOUND) {
02613 
02614                 //no volumes found for this partition
02615                 log_DBG_m(dbg_LOW, "No volumes found for partition");
02616                 return iMedSeq;
02617             } else throw;
02618         }
02619         if (rmMVVec.empty()) {
02620             return iMedSeq;
02621         }
02622 
02623         vector<rm_MedVec_t> rmMedVec;
02624         vector<rm_MediumVol> tmpMedVolVec;
02625 
02626         UInt32_t i = 0;
02627         Int32_t currentMedKey = rmMVVec[i].mediumKey;
02628         log_DBG_m(dbg_LOW, "Found: " << rmMVVec.size() << " volumes for partition: " << a_partName);
02629 
02630         while (i < rmMVVec.size()) {
02631 
02632             if (currentMedKey == rmMVVec[i].mediumKey){
02633                 if (!a_unRecovered || ((rmMVVec[i].status & rmdb_MEDVOL_RECOVER) != 0)) {
02634                     log_DBG_m(dbg_DETAIL,"push_back volume");
02635                     tmpMedVolVec.push_back(rmMVVec[i]);
02636                     log_DBG_m(dbg_DETAIL, "Inserting Volume for existing medKey: " <<
02637                                           currentMedKey);
02638                 }
02639 
02640                 i++;
02641                 log_DBG_m(dbg_DETAIL, "increased i = " << i);
02642 
02643             } else {
02644                 //current medium finished
02645                 log_DBG_m(dbg_DETAIL, "Inserting medium");
02646                 rmMedVec.push_back(tmpMedVolVec);
02647 
02648                 //clear volume vector for next medium
02649                 tmpMedVolVec.clear();
02650                 //set key of next medium
02651                 currentMedKey = rmMVVec[i].mediumKey;
02652 
02654             };
02655         }
02656 
02657         if (tmpMedVolVec.size() > 0) {
02658             //last medium should be inserted
02659             log_DBG_m(dbg_DETAIL, "Inserting last medium");
02660             rmMedVec.push_back(tmpMedVolVec);
02661         }
02662 
02663         log_DBG_m(dbg_DETAIL, "Found " << rmMedVec.size() << " mediums");
02664 
02665         iMedSeq.length(rmMedVec.size());
02666 
02667         for (UInt32_t k = 0; k < rmMedVec.size(); k++) {
02668             log_DBG_m(dbg_DETAIL,"k = " << k);
02669 
02670             i_MediumVolSeq_t iMediumVolSeq;
02671             iMediumVolSeq.length(rmMedVec[k].size());
02672             log_DBG_m(dbg_DETAIL, "iMediumVolSeq.length() =  " << iMediumVolSeq.length());
02673 
02674             rm_Medium m;
02675 
02676             if (rmMedVec[k].size() > 0)
02677                 m.Select(rmMedVec[k][0].mediumKey);
02678 
02679             for (UInt32_t l = 0; l < rmMedVec[k].size(); l++ ) {
02680                 log_DBG_m(dbg_DETAIL, "rmMedVec[k][l].medVolNr = " << rmMedVec[k][l].medVolNr);
02681 
02682                 iMediumVolSeq[l].medVolNr          = rmMedVec[k][l].medVolNr;
02683                 iMediumVolSeq[l].mediumBarcode      = CORBA::string_dup(m.barcode.c_str());
02684                 iMediumVolSeq[l].accessNr          = rmMedVec[k][l].accessNr;
02685                 iMediumVolSeq[l].accessTime        = rmMedVec[k][l].accessTime.GetTime();
02686                 iMediumVolSeq[l].initTime          = rmMedVec[k][l].initTime.GetTime();
02687                 iMediumVolSeq[l].lastVerification  = rmMedVec[k][l].lastVerification.GetTime();
02688                 iMediumVolSeq[l].medVolId          = CORBA::string_dup(rmMedVec[k][l].medVolId.c_str());
02689                 iMediumVolSeq[l].owriteNr          = rmMedVec[k][l].owriteNr;
02690                 iMediumVolSeq[l].owriteTime        = rmMedVec[k][l].owriteTime.GetTime();
02691                 iMediumVolSeq[l].status            = rmMedVec[k][l].status;
02692                 iMediumVolSeq[l].volSize           = rmMedVec[k][l].volSize;
02693                 iMediumVolSeq[l].volType           = rmMedVec[k][l].volType;
02694                 iMediumVolSeq[l].volUsed           = rmMedVec[k][l].volUsed;
02695                 iMediumVolSeq[l].writeNr           = rmMedVec[k][l].writeNr;
02696                 iMediumVolSeq[l].writeTime         = rmMedVec[k][l].writeTime.GetTime();
02697                 iMediumVolSeq[l].totalData         = rmMedVec[k][l].totalData;
02698                 iMediumVolSeq[l].validData         = rmMedVec[k][l].validData;
02699             }
02700             log_DBG_m(dbg_DETAIL, "filling iMedSeq[k] ");
02701             iMedSeq[k] = iMediumVolSeq;
02702         } //for k =
02703     }rm_CATCH_DB_THROW_IVD_m;
02704 
02705     return iMedSeq;
02706 
02707 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediumSeq_t rm_Operator::SelectAllMediaByPart ( string &  a_partName  )  [private]

Definition at line 2709 of file rm_operator.cpp.

References dbg_LOW, rm_DiskSubsys::diskSubsysName, rm_Drive::driveName, ivd_BaseException::GetError(), ipc_nilStr, rm_Library::libraryKey, rm_Library::libraryName, log_DBG_m, log_FUNC_m, rm_MediaPool::mediaPoolName, rmdb_MAX_PARTITIONNAME, rm_Medium::SelectByPartition(), rm_Slot::slotAddr, rm_Slot::slotType, and SQL_NOTFOUND.

Referenced by dbo_SelectAllMediaByPart::Process().

02709                                                                   {
02710     log_FUNC_m(SelectAllMediaByPart);
02711 
02712 
02713     typedef vector<rm_Medium> rm_Medium_t;
02714     rm_Medium_t rmMediumVec;
02715     i_MediumSeq_t iMediumSeq;
02716 
02717     iMediumSeq.length(0);
02718 
02719     rm_Medium medium;
02720     rm_String partName(rmdb_MAX_PARTITIONNAME);
02721     partName = a_partName;
02722 
02723     try {
02724         rmMediumVec = medium.SelectByPartition(partName);
02725     } catch (ivd_DBException& e) {
02726         if (e.GetError() == SQL_NOTFOUND) {
02727 
02728             //no media found for this partition
02729             log_DBG_m(dbg_LOW, "No media found for partition");
02730             return iMediumSeq;
02731         } else throw;
02732     }
02733     if (rmMediumVec.empty()) {
02734         return iMediumSeq;
02735     }
02736 
02737     iMediumSeq.length(rmMediumVec.size());
02738 
02739     for (UInt32_t i = 0; i < rmMediumVec.size(); i++) {
02740 
02741         // iMediumSeq[i] = rmMediumVec[i];
02742         iMediumSeq[i].mediumKey  = rmMediumVec[i].mediumKey;
02743 
02744         if (rmMediumVec[i].mediaPoolKey > 0 ) {
02745             rm_MediaPool mp(rmMediumVec[i].mediaPoolKey);
02746             iMediumSeq[i].mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
02747         } else {
02748             iMediumSeq[i].mediaPoolName    = CORBA::string_dup(ipc_nilStr);
02749         }
02750 
02751 
02752         if (rmMediumVec[i].libraryKey > 0) {
02753             rm_Library lib(rmMediumVec[i].libraryKey);
02754             iMediumSeq[i].libraryName       = CORBA::string_dup(lib.libraryName.c_str());
02755             if (rmMediumVec[i].slotKey > 0) {
02756                 rm_Slot s(rmMediumVec[i].slotKey,lib.libraryKey);
02757                 iMediumSeq[i].slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
02758                 iMediumSeq[i].slotType          = s.slotType;
02759             } else {
02760                 iMediumSeq[i].slotAddr          = CORBA::string_dup(ipc_nilStr);
02761                 iMediumSeq[i].slotType          = 0;
02762             }
02763         } else {
02764             iMediumSeq[i].libraryName       = CORBA::string_dup(ipc_nilStr);
02765         }
02766 
02767 
02768         if (rmMediumVec[i].driveKey > 0) {
02769             rm_Drive d(rmMediumVec[i].driveKey);
02770             iMediumSeq[i].driveName    = CORBA::string_dup(d.driveName.c_str());
02771         } else {
02772             iMediumSeq[i].driveName    = CORBA::string_dup(ipc_nilStr);
02773         }
02774 
02775 
02776         if (rmMediumVec[i].diskSubsysKey > 0) {
02777             rm_DiskSubsys dss(rmMediumVec[i].diskSubsysKey);
02778             iMediumSeq[i].diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
02779         } else {
02780             iMediumSeq[i].diskSubsysName    = CORBA::string_dup(ipc_nilStr);
02781         }
02782 
02783         iMediumSeq[i].barcode          = CORBA::string_dup(rmMediumVec[i].barcode.c_str());
02784         iMediumSeq[i].status           = rmMediumVec[i].status;
02785         iMediumSeq[i].location         = CORBA::string_dup(rmMediumVec[i].location.c_str());
02786         iMediumSeq[i].mediumType       = rmMediumVec[i].mediumType;
02787         iMediumSeq[i].mediumSerialNo   = CORBA::string_dup(rmMediumVec[i].mediumSerialNo.c_str());
02788         iMediumSeq[i].blockSize        = rmMediumVec[i].blockSize;
02789         iMediumSeq[i].numOfVolumes     = rmMediumVec[i].numOfVolumes;
02790         iMediumSeq[i].idxOfSysVol      = rmMediumVec[i].idxOfSysVol;
02791         iMediumSeq[i].sizeOfSysVol     = rmMediumVec[i].sizeOfSysVol;
02792         iMediumSeq[i].currentVolume    = rmMediumVec[i].currentVolume;
02793     }
02794 
02795     return iMediumSeq;
02796 
02797 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_MediaInfoSeq_t rm_Operator::GetMediaInfo ( rm_String a_partName  )  [private]

Definition at line 2491 of file rm_operator.cpp.

References rm_Medium::Convert2Corba(), dbg_NORM, log_DBG_m, log_FUNC_m, rm_MinorCol::m_flags, rm_MinorCol::m_majColId, rm_MinorCol::m_minColId, i_Medium_t::mediaPoolName, rm_CATCH_DB_THROW_IVD_m, rm_MinorCol::Select(), rm_MediumVol::SelectByMedium(), rm_Medium::SelectByPartition(), rm_ColMediaVol::SelectByVolume(), and i_Medium_t::status.

Referenced by dbo_GetMediaInfo::Process().

02491                                                                 {
02492     log_FUNC_m(GetMediaInfo);
02493     i_MediaInfoSeq_t i_medInfoSeq;
02494     try {
02495         rm_Medium medium;
02496         vector<rm_Medium> mediumVec;
02497         mediumVec = medium.SelectByPartition(a_partName);
02498         i_Medium_t media;
02499         media = medium.Convert2Corba();
02500         i_medInfoSeq.length(mediumVec.size());
02501         // all media on partition
02502         for (UInt32_t i = 0; i < mediumVec.size(); i++) {
02503             rm_MediumVol mediumVol;
02504             vector<rm_MediumVol> mVVec;
02505             mVVec = mediumVol.SelectByMedium(mediumVec[i].mediumKey);
02506             i_medInfoSeq[i].media.mediumKey     = mediumVec[i].mediumKey;
02507             i_medInfoSeq[i].media.mediaPoolName = media.mediaPoolName;
02508             i_medInfoSeq[i].media.barcode       = CORBA::string_dup(mediumVec[i].barcode.c_str());
02509             i_medInfoSeq[i].media.status        = media.status;
02510 
02511             i_medInfoSeq[i].volumeInfoList.length(mVVec.size());
02512             // all medium volumes for selected medium
02513             for (UInt32_t j = 0; j < mVVec.size(); j++) {
02514                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.medVolNr  = mVVec[j].medVolNr;
02515                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.status    = mVVec[j].status;
02516                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.medVolId  = CORBA::string_dup(mVVec[j].medVolId.c_str());
02517                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.volSize   = mVVec[j].volSize;
02518                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.volUsed   = mVVec[j].volUsed;
02519                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.validData = mVVec[j].validData;
02520                 i_medInfoSeq[i].volumeInfoList[j].mediaVol.totalData = mVVec[j].totalData;
02521 
02522                 rm_ColMediaVol cmv;
02523                 vector<rm_ColMediaVol> cmvVec;
02524                 cmvVec = cmv.SelectByVolume(mediumVec[i].mediumKey, mVVec[j].medVolNr);
02525                 // all entries in colmediavol table for selected medium volume
02526                 i_medInfoSeq[i].volumeInfoList[j].minorColList.length(cmvVec.size());
02527                 for (UInt32_t k = 0; k < cmvVec.size(); k++) {
02528                     rm_MinorCol minCol;
02529                     minCol.Select(cmvVec[k].m_minColId);
02530                     log_DBG_m(dbg_NORM, "Available nr." << k << " :" << endl
02531                                                << " mediaKey  : " << mediumVec[i].mediumKey <<  endl
02532                                                << " Pool      : " << media.mediaPoolName << endl
02533                                                << " barcode   : " << mediumVec[i].barcode << endl
02534                                                << " MedStatus : " << media.status << endl
02535                                                << " medVolId  : " << mVVec[j].medVolId << endl
02536                                                << " medVolNr  : " << mVVec[j].medVolNr << endl
02537                                                << " VolStatus : " << mVVec[j].status << endl
02538                                                << " VolSize   : " << mVVec[j].volSize << endl
02539                                                << " VolUsed   : " << mVVec[j].volUsed << endl
02540                                                << " validData : " << mVVec[j].validData << endl
02541                                                << " totalData : " << mVVec[j].totalData << endl
02542                                                << " minColId  : " << minCol.m_minColId << endl
02543                                                << " flags     : " << minCol.m_flags << endl
02544                                                << " majColId  : " << minCol.m_majColId << endl );
02545 
02546                     i_medInfoSeq[i].volumeInfoList[j].minorColList[k].minColId = minCol.m_minColId;
02547                     i_medInfoSeq[i].volumeInfoList[j].minorColList[k].flags = minCol.m_flags;
02548                     i_medInfoSeq[i].volumeInfoList[j].minorColList[k].majColId = minCol.m_majColId;
02549                 }
02550             }
02551         }
02552         return i_medInfoSeq;
02553     }rm_CATCH_DB_THROW_IVD_m;
02554 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::IsSomeVolumeUsed ( string &  a_partName  )  [private]

Definition at line 2799 of file rm_operator.cpp.

References dbg_LOW, ivd_BaseException::GetError(), log_DBG_m, log_FUNC_m, rmdb_MAX_PARTITIONNAME, rm_MediumVol::SelectByPartition(), and SQL_NOTFOUND.

Referenced by dbo_IsSomeVolumeUsed::Process().

02799                                                      {
02800 
02801     log_FUNC_m(IsSomeVolumeUsed);
02802 
02803     vector<rm_MediumVol> rmMVVec;
02804 
02805     rm_String partName(rmdb_MAX_PARTITIONNAME);
02806     partName = a_partName;
02807 
02808     try {
02809         rm_MediumVol mv;
02810         rmMVVec = mv.SelectByPartition(partName);
02811     } catch (ivd_DBException& e) {
02812         if (e.GetError() == SQL_NOTFOUND) {
02813 
02814             //no volumes found for this partition
02815             log_DBG_m(dbg_LOW, "No volumes found for partition");
02816             return false;
02817         } else throw;
02818     }
02819     if (rmMVVec.empty()) {
02820         return false;
02821     }
02822 
02823     for (UInt32_t i = 0; i < rmMVVec.size(); i++) {
02824         if (rmMVVec[i].volUsed > 0) {
02825             return true;
02826         }
02827     }
02828     return false;
02829 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::SetRecoveryFlag ( string &  a_medVolId  )  [private]

Definition at line 2831 of file rm_operator.cpp.

References ivd_UUID_STR_SIZE_d, log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MEDVOL_RECOVER, rm_MediumVol::SelectByMedVolId(), rm_MediumVol::status, and rm_MediumVol::Update().

Referenced by dbo_SetRecoveryFlag::Process().

02831                                                     {
02832     log_FUNC_m(SetRecoveryFlag);
02833     try {
02834 
02835         rm_String medVolId(ivd_UUID_STR_SIZE_d);
02836         medVolId = a_medVolId;
02837         rm_MediumVol mv;
02838         mv.SelectByMedVolId(medVolId);
02839         mv.status = mv.status | rmdb_MEDVOL_RECOVER;
02840         mv.Update();
02841     } rm_CATCH_DB_THROW_IVD_m;
02842 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::ClearRecoveryFlag ( string &  a_medVolId  )  [private]

Definition at line 2844 of file rm_operator.cpp.

References dbg_DETAIL, ivd_UUID_STR_SIZE_d, log_DBG_m, log_FUNC_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MEDVOL_RECOVER, rm_MediumVol::SelectByMedVolId(), rm_MediumVol::status, and rm_MediumVol::Update().

Referenced by dbo_ClearRecoveryFlag::Process().

02844                                                       {
02845 
02846     log_FUNC_m(ClearRecoveryFlag);
02847     try {
02848         rm_String medVolId(ivd_UUID_STR_SIZE_d);
02849         medVolId = a_medVolId;
02850         rm_MediumVol mv;
02851         mv.SelectByMedVolId(medVolId);
02852         log_DBG_m(dbg_DETAIL,"before mv.status = " << mv.status );
02853         mv.status = mv.status & ~(rmdb_MEDVOL_RECOVER);
02854         log_DBG_m(dbg_DETAIL,"after mv.status = " << mv.status );
02855         mv.Update();
02856     } rm_CATCH_DB_THROW_IVD_m;
02857 
02858 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::Update ( i_Library_t a_library  )  [private]

Definition at line 3137 of file rm_operator.cpp.

References i_Library_t::auditTime, rm_Library::auditTime, AutoDetect(), i_Library_t::capabilities, rm_Library::capabilities, i_Library_t::controlDevice, rm_Library::controlDevice, i_Library_t::firmwareRev, rm_Library::firmwareRev, i_Library_t::host, rm_Library::host, i_Library_t::libraryName, i_Library_t::libraryType, rm_Library::libraryType, i_Library_t::loadNr, rm_Library::loadNr, log_FUNC_A_m, i_Library_t::mediaAccessTime, rm_Library::mediaAccessTime, i_Library_t::mediaFamily, rm_Library::mediaFamily, i_Library_t::mediaXChgTime, rm_Library::mediaXChgTime, i_Library_t::options, rm_Library::options, i_Library_t::productID, rm_Library::productID, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, i_Library_t::scsiID, rm_Library::scsiID, rm_Library::SelectByName(), i_Library_t::serialNo, rm_Library::serialNo, i_Library_t::status, rm_Library::status, i_Library_t::unloadNr, rm_Library::unloadNr, rm_Library::Update(), i_Library_t::vendorID, and rm_Library::vendorID.

Referenced by InventoryUpdate(), dbo_ClearReorgScan::Process(), dbo_SetReorgScan::Process(), dbo_LibraryStatusClear::Process(), dbo_LibraryStatusSet::Process(), dbo_DriveStatusClear::Process(), dbo_DriveStatusSet::Process(), dbo_MedVolStatusClear::Process(), dbo_MedVolStatusSet::Process(), dbo_MediumStatusClear::Process(), dbo_MediumStatusSet::Process(), dbo_MediumUnusable::Process(), dbo_MediumUnreliable::Process(), dbo_DriveError::Process(), dbo_VolumeError::Process(), dbo_VolumeUsage::Process(), dbo_UpdateDataSize::Process(), dbo_UpdateMediumVol::Process(), dbo_UpdateMedium::Process(), dbo_UpdateMediaPool::Process(), dbo_UpdateSlot::Process(), dbo_UpdateDiskSubsys::Process(), dbo_UpdateDriveHost::Process(), dbo_UpdateDrive::Process(), dbo_UpdateMinorCol::Process(), dbo_UpdateMajorCol::Process(), dbo_UpdateLibrary::Process(), and Update().

03137                                                {
03138     log_FUNC_A_m(Update, "Library");
03139 
03140     try {
03141         rm_Library library;
03142         rm_String libraryName(rmdb_MAX_LIBRARYNAME);
03143         libraryName = a_library.libraryName;
03144         library.SelectByName(libraryName);
03145 
03146         library.auditTime       =   a_library.auditTime;
03147         library.capabilities    =   a_library.capabilities;
03148         library.controlDevice   =   a_library.controlDevice;
03149         library.host            =   a_library.host;
03150         library.libraryType     =   a_library.libraryType;
03151         library.loadNr          =   a_library.loadNr;
03152         library.mediaAccessTime =   a_library.mediaAccessTime;
03153         library.mediaAccessTime =   a_library.mediaAccessTime;
03154         library.mediaFamily     =   a_library.mediaFamily;
03155         library.mediaXChgTime   =   a_library.mediaXChgTime;
03156         library.options         =   a_library.options;
03157         library.status          =   a_library.status;
03158         library.unloadNr        =   a_library.unloadNr;
03159         library.vendorID        =   a_library.vendorID;
03160         library.productID       =   a_library.productID;
03161         library.serialNo        =   a_library.serialNo;
03162         library.firmwareRev     =   a_library.firmwareRev;
03163         library.scsiID          =   a_library.scsiID;
03164 
03165 
03166         AutoDetect(library);
03167         library.Update();
03168     } rm_CATCH_DB_THROW_IVD_m;
03169 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::Update ( i_Drive_t  a_drive  )  [private]

Definition at line 3171 of file rm_operator.cpp.

References AutoDetect(), i_Drive_t::aveSeekTime, rm_Drive::aveSeekTime, i_Drive_t::capabilities, rm_Drive::capabilities, i_Drive_t::cleanNr, rm_Drive::cleanNr, i_Drive_t::dataThroughput, rm_Drive::dataThroughput, dbg_DETAIL, i_Drive_t::driveIndex, rm_Drive::driveIndex, rm_Drive::driveName, i_Drive_t::driveName, i_Drive_t::firmwareRev, rm_Drive::firmwareRev, ivd_BaseException::GetError(), ie_DRIVE_INDEX_DUPL, ivd_Error, i_Drive_t::lastClean, rm_Drive::lastClean, rm_Library::libraryKey, rm_Drive::libraryKey, i_Drive_t::libraryName, i_Drive_t::loadTime, rm_Drive::loadTime, log_DBG_m, log_FUNC_A_m, i_Drive_t::mediaFamily, rm_Drive::mediaFamily, i_Drive_t::options, rm_Drive::options, i_Drive_t::productID, rm_Drive::productID, i_Drive_t::rewindTime, rm_Drive::rewindTime, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rmdb_MAX_LIBRARYNAME, i_Drive_t::scsiID, rm_Drive::scsiID, rm_Drive::SelectByAddr(), rm_Library::SelectByName(), rm_Drive::SelectByName(), i_Drive_t::serialNo, rm_Drive::serialNo, SQL_NOTFOUND, i_Drive_t::status, rm_Drive::status, i_Drive_t::unloadTime, rm_Drive::unloadTime, rm_Drive::Update(), Update(), i_Drive_t::usageCount, rm_Drive::usageCount, i_Drive_t::vendorID, and rm_Drive::vendorID.

03171                                           {
03172     log_FUNC_A_m(Update, "Drive");
03173     try {
03174 
03175         rm_Drive drive;
03176 
03177         rm_String driveName(rmdb_MAX_DRIVENAME);
03178         driveName = a_drive.driveName;
03179         drive.SelectByName(driveName);
03180 
03181         drive.aveSeekTime       = a_drive.aveSeekTime;
03182         drive.capabilities      = a_drive.capabilities;
03183         drive.cleanNr           = a_drive.cleanNr;
03184         drive.dataThroughput    = a_drive.dataThroughput;
03185         drive.driveIndex        = a_drive.driveIndex;
03186         drive.lastClean         = a_drive.lastClean;
03187         drive.loadTime          = a_drive.loadTime;
03188         drive.mediaFamily       = a_drive.mediaFamily;
03189         drive.options           = a_drive.options;
03190         drive.rewindTime        = a_drive.rewindTime;
03191         drive.status            = a_drive.status;
03192         drive.unloadTime        = a_drive.unloadTime;
03193         drive.usageCount        = a_drive.usageCount;
03194         drive.vendorID          = a_drive.vendorID;
03195         drive.productID         = a_drive.productID;
03196         drive.serialNo          = a_drive.serialNo;
03197         drive.firmwareRev     =   a_drive.firmwareRev;
03198         drive.scsiID          =   a_drive.scsiID;
03199 
03200         if (strlen(a_drive.libraryName) > 0) {
03201             rm_Library lib;
03202 
03203             rm_String libName(rmdb_MAX_LIBRARYNAME);
03204             libName = a_drive.libraryName;
03205             lib.SelectByName(libName);
03206 
03207             drive.libraryKey = lib.libraryKey;
03208 
03209         } else {
03210             drive.libraryKey = -1;
03211         }
03212         rm_Drive tmpDrv;
03213         bool driveUnique = false;
03214         if (drive.libraryKey > 0) {
03215             try {
03216                 tmpDrv.SelectByAddr(drive.libraryKey, drive.driveIndex);
03217             } catch (ivd_DBException& dbe) {
03218                 if (dbe.GetError() == SQL_NOTFOUND) {
03219                     log_DBG_m(dbg_DETAIL,"DriveIndexCheck is OK");
03220                     driveUnique = true;
03221                 } else throw;
03222 
03223             }
03224             if ((tmpDrv.driveName.compare(a_drive.driveName) != 0) &&
03225                 (driveUnique == false)) {
03226                 ostringstream errDescStream;
03227                 errDescStream << "There is already a drive in that Library with the same index" << endl;
03228                 errDescStream << "Drive: " << tmpDrv.driveName << "  has already index " << tmpDrv.driveIndex;
03229                 errDescStream << endl;
03230                 throw ivd_Error (ie_DRIVE_INDEX_DUPL, errDescStream.str());
03231             }
03232         }
03233         AutoDetect(drive);
03234         drive.Update();
03235     } rm_CATCH_DB_THROW_IVD_m;
03236 }

Here is the call graph for this function:

void rm_Operator::Update ( i_DriveHost_t  a_driveHost  )  [private]

Definition at line 3238 of file rm_operator.cpp.

References AutoDetect(), i_DriveHost_t::controlDevice, rm_DriveHost::controlDevice, rm_Drive::driveKey, rm_DriveHost::driveKey, i_DriveHost_t::driveName, i_DriveHost_t::host, rm_DriveHost::host, log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DRIVENAME, rm_Drive::SelectByName(), rm_DriveHost::Update(), and Update().

03238                                                   {
03239     log_FUNC_A_m(Update, "DriveHost");
03240     try {
03241         rm_DriveHost driveHost;
03242         driveHost.controlDevice = a_driveHost.controlDevice;
03243         driveHost.host          = a_driveHost.host;
03244 
03245         rm_Drive d;
03246         rm_String driveName(rmdb_MAX_DRIVENAME);
03247         driveName = a_driveHost.driveName;
03248         d.SelectByName(driveName);
03249         driveHost.driveKey = d.driveKey;
03250         AutoDetect(driveHost);
03251         driveHost.Update();
03252     } rm_CATCH_DB_THROW_IVD_m;
03253 }

Here is the call graph for this function:

void rm_Operator::Update ( i_DiskSubsys_t  a_dss  )  [private]

Definition at line 3255 of file rm_operator.cpp.

References AutoDetect(), rm_DiskSubsys::diskSubsysName, i_DiskSubsys_t::diskSubsysName, i_DiskSubsys_t::diskSubsysType, rm_DiskSubsys::diskSubsysType, i_DiskSubsys_t::host, rm_DiskSubsys::host, log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_DSSNAME, rm_DiskSubsys::SelectByName(), i_DiskSubsys_t::status, rm_DiskSubsys::status, rm_DiskSubsys::Update(), and Update().

03255                                              {
03256     log_FUNC_A_m(Update, "DiskSubsys");
03257     try {
03258 
03259         rm_DiskSubsys dss;
03260 
03261         rm_String dssName(rmdb_MAX_DSSNAME);
03262         dssName = a_dss.diskSubsysName;
03263         dss.SelectByName(dssName);
03264 
03265         dss.diskSubsysName  = a_dss.diskSubsysName;
03266         dss.diskSubsysType  = a_dss.diskSubsysType;
03267         dss.host            = a_dss.host;
03268         dss.status          = a_dss.status;
03269         AutoDetect(dss);
03270         dss.Update();
03271     } rm_CATCH_DB_THROW_IVD_m;
03272 }

Here is the call graph for this function:

void rm_Operator::Update ( i_Slot_t  a_slot  )  [private]

Definition at line 3274 of file rm_operator.cpp.

References AutoDetect(), rm_Library::libraryKey, i_Slot_t::libraryName, log_FUNC_A_m, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, rm_Slot::SelectByLibAddrType(), rm_Library::SelectByName(), i_Slot_t::slotAddr, i_Slot_t::slotType, i_Slot_t::status, rm_Slot::status, rm_Slot::Update(), and Update().

03274                                         {
03275     log_FUNC_A_m(Update, "Slot");
03276     try {
03277 
03278         rm_Slot slot;
03279 
03280         rm_Library library;
03281         rm_String libraryName(rmdb_MAX_LIBRARYNAME);
03282         libraryName = a_slot.libraryName;
03283         library.SelectByName(libraryName);
03284 
03285         rm_String slotAddr(rmdb_MAX_SLOTADDR);
03286         slotAddr = a_slot.slotAddr;
03287         slot.SelectByLibAddrType(library.libraryKey, slotAddr, a_slot.slotType);
03288 
03289         slot.status     = a_slot.status;
03290 
03291         AutoDetect(slot);
03292         slot.Update();
03293     } rm_CATCH_DB_THROW_IVD_m;
03294 }

Here is the call graph for this function:

void rm_Operator::Update ( i_MediaPool_t  a_mediaPool  )  [private]

Definition at line 3296 of file rm_operator.cpp.

References AutoDetect(), i_MediaPool_t::blockSize, rm_MediaPool::blockSize, log_FUNC_A_m, i_MediaPool_t::maxMediaAge, rm_MediaPool::maxMediaAge, i_MediaPool_t::maxNrReadWrite, rm_MediaPool::maxNrReadWrite, i_MediaPool_t::mediaFamily, rm_MediaPool::mediaFamily, rm_MediaPool::mediaPoolName, i_MediaPool_t::mediaPoolName, i_MediaPool_t::mediaPoolType, rm_MediaPool::mediaPoolType, i_MediaPool_t::numOfVolumes, rm_MediaPool::numOfVolumes, i_MediaPool_t::partitionUUIDString, rm_MediaPool::partitionUUIDString, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_MEDIAPOOLNAME, rm_MediaPool::SelectByName(), i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sysVolLocation, rm_MediaPool::sysVolLocation, rm_MediaPool::Update(), and Update().

03296                                                   {
03297     log_FUNC_A_m(Update, "MediaPool");
03298     try {
03299 
03300         rm_MediaPool mediaPool;
03301         rm_String mediaPoolName(rmdb_MAX_MEDIAPOOLNAME);
03302         mediaPoolName = a_mediaPool.mediaPoolName;
03303         mediaPool.SelectByName(mediaPoolName);
03304 
03305         mediaPool.maxMediaAge       = a_mediaPool.maxMediaAge;
03306         mediaPool.maxNrReadWrite    = a_mediaPool.maxNrReadWrite;
03307         mediaPool.mediaFamily       = a_mediaPool.mediaFamily;
03308         mediaPool.mediaPoolName     = a_mediaPool.mediaPoolName;
03309         mediaPool.mediaPoolType     = a_mediaPool.mediaPoolType;
03310         mediaPool.partitionUUIDString     = a_mediaPool.partitionUUIDString;
03311         mediaPool.blockSize         = a_mediaPool.blockSize;
03312         mediaPool.numOfVolumes      = static_cast<Int16_t>(a_mediaPool.numOfVolumes);
03313         mediaPool.sysVolLocation       = static_cast<Int16_t>(a_mediaPool.sysVolLocation);
03314         mediaPool.sizeOfSysVol      = a_mediaPool.sizeOfSysVol;
03315         mediaPool.sizeOfVolume      = a_mediaPool.sizeOfVolume;
03316 
03317         AutoDetect(mediaPool);
03318         mediaPool.Update();
03319     } rm_CATCH_DB_THROW_IVD_m;
03320 }

Here is the call graph for this function:

void rm_Operator::Update ( i_Medium_t  a_medium  )  [private]

Definition at line 3322 of file rm_operator.cpp.

References AutoDetect(), i_Medium_t::barcode, i_Medium_t::blockSize, rm_Medium::blockSize, rm_Medium::currentVolume, i_Medium_t::currentVolume, rm_DiskSubsys::diskSubsysKey, rm_Medium::diskSubsysKey, i_Medium_t::diskSubsysName, rm_Drive::driveKey, rm_Medium::driveKey, i_Medium_t::driveName, i_Medium_t::idxOfSysVol, rm_Medium::idxOfSysVol, rm_Library::libraryKey, rm_Medium::libraryKey, i_Medium_t::libraryName, i_Medium_t::location, rm_Medium::location, log_FUNC_A_m, rm_MediaPool::mediaPoolKey, rm_Medium::mediaPoolKey, i_Medium_t::mediaPoolName, i_Medium_t::mediumSerialNo, rm_Medium::mediumSerialNo, i_Medium_t::mediumType, rm_Medium::mediumType, i_Medium_t::numOfVolumes, rm_Medium::numOfVolumes, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rmdb_MAX_DRIVENAME, rmdb_MAX_DSSNAME, rmdb_MAX_LIBRARYNAME, rmdb_MAX_MEDIAPOOLNAME, rmdb_MAX_SLOTADDR, rm_Medium::SelectByBarcode(), rm_Slot::SelectByLibAddrType(), rm_MediaPool::SelectByName(), rm_Library::SelectByName(), rm_Drive::SelectByName(), rm_DiskSubsys::SelectByName(), i_Medium_t::sizeOfSysVol, rm_Medium::sizeOfSysVol, i_Medium_t::slotAddr, rm_Slot::slotKey, rm_Medium::slotKey, i_Medium_t::slotType, i_Medium_t::status, rm_Medium::status, rm_Medium::Update(), and Update().

03322                                             {
03323     log_FUNC_A_m(Update, "Medium");
03324     try {
03325 
03326         rm_Medium medium;
03327         rm_String mediumBarcode(rmdb_MAX_BARCODE);
03328         mediumBarcode = a_medium.barcode;
03329         medium.SelectByBarcode(mediumBarcode);
03330 
03331         if (strlen(a_medium.diskSubsysName) > 0 ) {
03332             rm_DiskSubsys dss;
03333             rm_String dssName(rmdb_MAX_DSSNAME);
03334             dssName = a_medium.diskSubsysName;
03335             dss.SelectByName(dssName);
03336             medium.diskSubsysKey = dss.diskSubsysKey;
03337         }else {
03338             medium.diskSubsysKey = -1;
03339         };
03340 
03341         if (strlen(a_medium.driveName) > 0 ) {
03342             rm_Drive d;
03343             rm_String dName(rmdb_MAX_DRIVENAME);
03344             dName = a_medium.driveName;
03345             d.SelectByName(dName);
03346             medium.driveKey = d.driveKey;
03347         } else {
03348             medium.driveKey = -1;
03349         };
03350 
03351         if (strlen(a_medium.libraryName) > 0 ) {
03352             rm_Library l;
03353             rm_String lName(rmdb_MAX_LIBRARYNAME);
03354             lName = a_medium.libraryName;
03355             l.SelectByName(lName);
03356             medium.libraryKey = l.libraryKey;
03357         } else {
03358             medium.libraryKey = -1;
03359         };
03360 
03361         medium.location     = a_medium.location ;
03362 
03363         if (strlen(a_medium.mediaPoolName) > 0 ) {
03364             rm_MediaPool mp;
03365             rm_String mpName(rmdb_MAX_MEDIAPOOLNAME);
03366             mpName = a_medium.mediaPoolName;
03367             mp.SelectByName(mpName);
03368             medium.mediaPoolKey = mp.mediaPoolKey;
03369         } else {
03370             medium.mediaPoolKey = -1;
03371         };
03372 
03373         medium.mediumSerialNo = a_medium.mediumSerialNo ;
03374         medium.mediumType     = a_medium.mediumType ;
03375 
03376         if (strlen(a_medium.slotAddr) > 0 ) {
03377             rm_Slot s;
03378             rm_String sAddr(rmdb_MAX_SLOTADDR);
03379             sAddr = a_medium.slotAddr;
03380             s.SelectByLibAddrType(medium.libraryKey, sAddr, a_medium.slotType);
03381             medium.slotKey = s.slotKey;
03382         } else {
03383             medium.slotKey = -1;
03384         };
03385 
03386         if (a_medium.currentVolume < 1) {
03387             medium.currentVolume = -1; //setting indicator bi6
03388         } else {
03389             medium.currentVolume = static_cast<Int16_t>(a_medium.currentVolume);
03390         }
03391 
03392         medium.status        = a_medium.status ;
03393         medium.blockSize     = a_medium.blockSize;
03394         medium.numOfVolumes  = static_cast<Int16_t>(a_medium.numOfVolumes);
03395         medium.idxOfSysVol   = static_cast<Int16_t>(a_medium.idxOfSysVol);
03396         medium.sizeOfSysVol  = a_medium.sizeOfSysVol;
03397 
03398         AutoDetect(medium);
03399         medium.Update();
03400     } rm_CATCH_DB_THROW_IVD_m;
03401 }

Here is the call graph for this function:

void rm_Operator::Update ( i_MediumVol_t  a_mediumVol  )  [private]

Definition at line 3403 of file rm_operator.cpp.

References i_MediumVol_t::accessNr, rm_MediumVol::accessNr, i_MediumVol_t::accessTime, rm_MediumVol::accessTime, AutoDetect(), i_MediumVol_t::initTime, rm_MediumVol::initTime, i_MediumVol_t::lastVerification, rm_MediumVol::lastVerification, log_FUNC_A_m, i_MediumVol_t::mediumBarcode, rm_Medium::mediumKey, i_MediumVol_t::medVolId, rm_MediumVol::medVolId, i_MediumVol_t::medVolNr, i_MediumVol_t::owriteNr, rm_MediumVol::owriteNr, i_MediumVol_t::owriteTime, rm_MediumVol::owriteTime, rm_CATCH_DB_THROW_IVD_m, rmdb_MAX_BARCODE, rm_MediumVol::Select(), rm_Medium::SelectByBarcode(), i_MediumVol_t::status, rm_MediumVol::status, i_MediumVol_t::totalData, rm_MediumVol::totalData, rm_MediumVol::Update(), Update(), i_MediumVol_t::validData, rm_MediumVol::validData, i_MediumVol_t::volSize, rm_MediumVol::volSize, i_MediumVol_t::volType, rm_MediumVol::volType, i_MediumVol_t::volUsed, rm_MediumVol::volUsed, i_MediumVol_t::writeNr, rm_MediumVol::writeNr, i_MediumVol_t::writeTime, and rm_MediumVol::writeTime.

03403                                                   {
03404     log_FUNC_A_m(Update, "MediumVol");
03405     try {
03406 
03407         rm_MediumVol mediumVol;
03408 
03409         rm_Medium medium;
03410         rm_String medBarcode(rmdb_MAX_BARCODE);
03411         medBarcode = a_mediumVol.mediumBarcode;
03412         medium.SelectByBarcode(medBarcode);
03413         mediumVol.Select(medium.mediumKey, a_mediumVol.medVolNr);
03414 
03415         mediumVol.accessNr       = a_mediumVol.accessNr;
03416         mediumVol.accessTime     = a_mediumVol.accessTime;
03417         mediumVol.initTime       = a_mediumVol.initTime;
03418         mediumVol.lastVerification = a_mediumVol.lastVerification;
03419         mediumVol.medVolId       = a_mediumVol.medVolId;
03420         mediumVol.owriteNr       = a_mediumVol.owriteNr;
03421         mediumVol.owriteTime     = a_mediumVol.owriteTime;
03422         mediumVol.status         = a_mediumVol.status;
03423         mediumVol.volSize        = a_mediumVol.volSize;
03424         mediumVol.volType        = a_mediumVol.volType;
03425         mediumVol.volUsed        = a_mediumVol.volUsed;
03426         mediumVol.writeNr        = a_mediumVol.writeNr;
03427         mediumVol.writeTime      = a_mediumVol.writeTime;
03428         mediumVol.totalData      = a_mediumVol.totalData;
03429         mediumVol.validData      = a_mediumVol.validData;
03430 
03431 
03432         AutoDetect(mediumVol);
03433         mediumVol.Update();
03434     } rm_CATCH_DB_THROW_IVD_m;
03435 }

Here is the call graph for this function:

void rm_Operator::Update ( i_MajorCol_t a_majorCol  )  [private]

Definition at line 3098 of file rm_operator.cpp.

References dbg_LOW, i_MajorCol_t::flags, rm_MajorCol::flags, log_DBG_m, log_FUNC_A_m, rm_MajorCol::majColId, i_MajorCol_t::majColId, i_MajorCol_t::majColSize, rm_MajorCol::majColSize, i_MajorCol_t::partUUID, rm_MajorCol::partUUID, rm_CATCH_DB_THROW_IVD_m, rm_MajorCol::Select(), rm_MajorCol::Update(), and Update().

03098                                                 {
03099     log_FUNC_A_m(Update, "MajorCollocation");
03100     try {
03101         rm_MajorCol majorCol;
03102         UInt64_t majColId;
03103         majColId = a_majorCol.majColId;
03104         majorCol.Select(majColId);
03105 
03106         majorCol.majColId   = a_majorCol.majColId;
03107         majorCol.majColSize = a_majorCol.majColSize;
03108         majorCol.partUUID   = a_majorCol.partUUID;
03109         majorCol.flags      = a_majorCol.flags;
03110 
03111         majorCol.Update();
03112         log_DBG_m(dbg_LOW,"Updating Major Collocation: " << majorCol.majColId
03113                                                          << "," << majorCol.majColSize
03114                                                          << "," << majorCol.partUUID
03115                                                          << "," << majorCol.flags);
03116     } rm_CATCH_DB_THROW_IVD_m;
03117 }

Here is the call graph for this function:

void rm_Operator::Update ( i_MinorCol_t a_minorCol  )  [private]

Definition at line 3119 of file rm_operator.cpp.

References dbg_LOW, i_MinorCol_t::flags, log_DBG_m, log_FUNC_A_m, rm_MinorCol::m_flags, rm_MinorCol::m_majColId, rm_MinorCol::m_minColId, i_MinorCol_t::minColId, rm_CATCH_DB_THROW_IVD_m, rm_MinorCol::Select(), rm_MinorCol::Update(), and Update().

03119                                                  {
03120     log_FUNC_A_m(Update, "MinorCollocation");
03121     try {
03122         rm_MinorCol minorCol;
03123         minorCol.Select(a_minorCol.minColId);
03124 
03125         minorCol.m_flags = a_minorCol.flags;
03126 
03127         minorCol.Update();
03128 
03129         log_DBG_m(dbg_LOW,"Updating Minor Collocation: " << "(" << minorCol.m_minColId
03130                                                          << "," << minorCol.m_majColId
03131                                                          << "," << minorCol.m_flags << ")");
03132 
03133 
03134     } rm_CATCH_DB_THROW_IVD_m;
03135 }

Here is the call graph for this function:

void rm_Operator::AutoDetect ( rm_Library  a_library  )  [private]

Definition at line 3481 of file rm_operator.cpp.

References rm_Library::auditTime, rm_Library::capabilities, rm_Library::libraryName, rm_Library::libraryType, rm_Library::mediaAccessTime, rm_Library::mediaFamily, rm_Library::mediaXChgTime, rmdb_INIT_LIBRARY_STATUS, and rm_Library::status.

Referenced by Update().

03481                                                  {
03482     if ( a_library.libraryName.length() == 0 ) {
03483         //libraryName = makeLibraryName();
03484     };
03485 
03486     a_library.status = rmdb_INIT_LIBRARY_STATUS;
03487 
03488     if ( a_library.libraryType == 0 ) {
03489         //libraryIndex = detectlibraryType();
03490     };
03491 
03492     if ( a_library.mediaFamily == 0 ) {
03493         //dataThroughput = detectmediaFamily();
03494     };
03495 
03496     if ( a_library.capabilities == 0 ) {
03497         //loadTime = detectcapabilitie();
03498     };
03499 
03500     if ( a_library.auditTime == 0 ) {
03501         //unloadTime = detectauditTime();
03502     };
03503 
03504     if ( a_library.mediaAccessTime == 0 ) {
03505         //aveSeekTime = detectmediumAccessTime();
03506     };
03507 
03508     if ( a_library.mediaXChgTime == 0 ) {
03509         //rewindTime = detectmediumXChgTime();
03510     };
03511 
03512     //a_library.vendorID  = DetectVendorID();
03513     //a_library.productID = DetectProductID();
03514     //a_library.serialNo = DetectSerialNo();
03515 }

Here is the caller graph for this function:

void rm_Operator::AutoDetect ( rm_Drive  a_drive  )  [private]

Definition at line 3518 of file rm_operator.cpp.

References rm_Drive::aveSeekTime, rm_Drive::dataThroughput, rm_Drive::driveIndex, rm_Drive::driveName, rm_Drive::loadTime, rm_Drive::rewindTime, rmdb_INIT_DRIVE_STATUS, rm_Drive::status, rm_Drive::unloadTime, and rm_Drive::usageCount.

03518                                              {
03519     if ( a_drive.driveName.length() == 0 ) {
03520         //driveName = makeDriveName();
03521     };
03522 
03523     a_drive.status = rmdb_INIT_DRIVE_STATUS;
03524 
03525     if ( a_drive.driveIndex.length() == 0 ) {
03526         //driveIndex = detectDriveIndex();
03527     };
03528 
03529     if ( a_drive.dataThroughput == 0 ) {
03530         //dataThroughput = detectDataThroughput();
03531     };
03532 
03533     if ( a_drive.loadTime == 0 ) {
03534         //loadTime = detectLoadTime();
03535     };
03536 
03537     if ( a_drive.unloadTime == 0 ) {
03538         //unloadTime = detectUnloadTime();
03539     };
03540 
03541     if ( a_drive.aveSeekTime == 0 ) {
03542         //aveSeekTime = detectAveSeekTime();
03543     };
03544 
03545     if ( a_drive.rewindTime == 0 ) {
03546         //rewindTime = detectRewindTime();
03547     };
03548 
03549     if ( a_drive.usageCount == 0 ) {
03550         //usageCount = detectUsageTime();
03551     };
03552 
03553     //a_drive.vendorID  = DetectVendorID();
03554     //a_drive.productID = DetectProductID();
03555     //a_drive.serialNo = DetectSerialNo();
03556 }

void rm_Operator::AutoDetect ( rm_DriveHost  a_driveHost  )  [private]

Definition at line 3558 of file rm_operator.cpp.

03558                                                      {
03559     //empty
03560 
03561 }

void rm_Operator::AutoDetect ( rm_DiskSubsys  a_dss  )  [private]

Definition at line 3563 of file rm_operator.cpp.

References rm_DiskSubsys::diskSubsysName, rmdb_INIT_DSS_STATUS, and rm_DiskSubsys::status.

03563                                                 {
03564 
03565     if ( a_dss.diskSubsysName.length() == 0 ) {
03566         //diskSubsysName = makeDssName();
03567     };
03568     a_dss.status = rmdb_INIT_DSS_STATUS;
03569 }

void rm_Operator::AutoDetect ( rm_Slot  a_slot  )  [private]

Definition at line 3571 of file rm_operator.cpp.

References rmdb_SLOT_FREE, and rm_Slot::status.

03571                                            {
03572     a_slot.status = rmdb_SLOT_FREE;
03573 }

void rm_Operator::AutoDetect ( rm_MediaPool  a_mediaPool  )  [private]

Definition at line 3575 of file rm_operator.cpp.

03575                                                      {
03576     //empty
03577 }

void rm_Operator::AutoDetect ( rm_Medium  a_medium  )  [private]

Definition at line 3579 of file rm_operator.cpp.

References rm_Medium::barcode, rmdb_INIT_MEDIUM_STATUS, and rm_Medium::status.

03579                                                {
03580     if ( a_medium.barcode.length() == 0 ) {
03581         //a_medium.barcode = makeBarcode();
03582     };
03583     a_medium.status = rmdb_INIT_MEDIUM_STATUS;
03584 }

void rm_Operator::AutoDetect ( rm_MediumVol  a_mediumVol  )  [private]

Definition at line 3586 of file rm_operator.cpp.

References rmdb_INIT_MEDIUMVOL_STATUS, and rm_MediumVol::status.

03586                                                      {
03587 
03588     a_mediumVol.status = rmdb_INIT_MEDIUMVOL_STATUS;
03589 }

UInt32_t rm_Operator::GetBestCopy ( rm_CopiesPos_v_t a_mediumTable  )  [private]

Definition at line 4142 of file rm_operator.cpp.

References rm_Medium::barcode, rm_MediumPos_t::blockOffset, dbg_DETAIL, dbg_LOW, dbg_NORM, rm_Medium::driveKey, rm_Drive::driveName, evt_WARNING, ivd_BaseException::GetError(), ie_FATAL_ERROR, ie_NO_RESOURCE_FOUND, ipc_EXEC_m, ivd_Error, rm_Medium::libraryKey, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), rm_MediumPos_t::medium, rm_Medium::mediumKey, rm_MediumPos_t::mediumKey, rm_Medium::mediumType, rm_MediumPos_t::medVolNr, mt_DISK, rm_CATCH_DB_THROW_IVD_m, rmdb_DRIVE_DISABLED, rmdb_DRIVE_ERROR, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_UNUSABLE, rmdb_MEDVOL_REORG_INREORG, rmdb_MEDVOL_REORG_RECYCLED, rm_Medium::Select(), rm_MediumPos_t::splitOffset, rm_MediumPos_t::splitSize, SQL_NOTFOUND, rm_MediumVol::status, rm_Drive::status, and rm_Medium::status.

Referenced by dbo_GetBestCopy::Process().

04142                                                                 {
04143     log_FUNC_m(GetBestCopy);
04144 
04145     try {
04146 
04147         //Filter if Copy is on a set of usable Medium
04148         rm_CopiesPos_v_t selMediumTable;
04149         bool allMediumUsable = true;
04150 
04151         log_DBG_m(dbg_DETAIL,"Search for set of splits on usable medium");
04152 
04153         //*** Search for set of splits on free medium
04154         log_DBG_m(dbg_DETAIL,"a_mediumTable.size()" << a_mediumTable.size());
04155 
04156         for (unsigned int i = 0; i < a_mediumTable.size() ; i++ ){ //for each copy (set of splits)
04157 
04158             for (unsigned int j = 0; j < a_mediumTable[i].mediumPos.size(); j++){ //for each split
04159 
04160                 rm_MediumPos_t & medPos = a_mediumTable[i].mediumPos[j];
04161 
04162                 log_DBG_m(dbg_DETAIL,"Check if medium with following info exists:" << endl <<
04163                     "Media Key: " << medPos.mediumKey << endl <<
04164                     "Medium Volume number: " << medPos.medVolNr << endl <<
04165                     "Block Offset: " << medPos.blockOffset << endl <<
04166                     "Split Offset: " << medPos.splitOffset << endl <<
04167                     "Split Size: " << medPos.splitSize);
04168 
04169                 try {
04170                     ipc_EXEC_m(
04171                         medPos.medium.Select(medPos.mediumKey);
04172                     )
04173                 } catch(ivd_Exception &e) {
04174                     log_DBG_m(dbg_DETAIL,e);
04175                     if (e.GetError() == SQL_NOTFOUND){
04176                         allMediumUsable = false;
04177                         log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum);
04178                         log_DBG_m(dbg_NORM,"Medium does not exist in RMDB. Will try recall from additioanl copy");
04179                         break;
04180                     }
04181                     else {
04182                         throw;
04183                     }
04184                 }
04185 
04186                 if ( (medPos.medium.status & rmdb_MEDIUM_UNUSABLE) != 0 ) {
04187                     log_DBG_m(dbg_LOW,"medium:" << medPos.medium.mediumKey <<
04188                                         " is marked as UNUSABLE");
04189 
04190                     allMediumUsable = false;
04191                     log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
04192                     break;
04193                 }
04194 
04195                 // if it is not disk media
04196                 if (ivd_MediaType_e(medPos.medium.mediumType) != mt_DISK) {
04197                     //check if medium is offline
04198                     log_DBG_m(dbg_NORM,"medPos.medium.libraryKey:" << medPos.medium.libraryKey );
04199                     if ( medPos.medium.libraryKey  == -1 ) {
04200                         log_DBG_m(dbg_LOW,"medium:" << medPos.medium.mediumKey <<
04201                                             " is OFFLINE");
04202 
04203                         allMediumUsable = false;
04204                         log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
04205                         break;
04206                     }
04207                 }
04208 
04209                 if (medPos.medium.driveKey > 0){ //check if medium is in unusable drive
04210                     rm_Drive d(medPos.medium.driveKey);
04211                     if ( (d.status & rmdb_DRIVE_DISABLED) ||
04212                         (d.status & rmdb_DRIVE_ERROR) ) {
04213 
04214                         ostringstream msg;
04215                         msg << "Medium " << medPos.medium.barcode <<
04216                             " is inserted in unusable drive. Please unload.";
04217 
04218                         log_WriteEvent(msg.str(), "DRIVE", 0, string(d.driveName));
04219                         log_ERR_m(msg.str());
04220 
04221                         allMediumUsable = false;
04222                         log_DBG_m(dbg_NORM,"Can not use row:" <<
04223                                             a_mediumTable[i].rowNum <<
04224                                             " drive is unusable");
04225                         break;
04226                     }
04227                 }
04228                 //select volume and check if it is in reorg
04229                 rm_MediumVol mv(medPos.mediumKey, medPos.medVolNr);
04230                 if ( (mv.status & rmdb_MEDVOL_REORG_INREORG) ||
04231                     (mv.status & rmdb_MEDVOL_REORG_RECYCLED) ){
04232                     log_DBG_m(dbg_LOW,"mediumVol for medium:" << medPos.medium.mediumKey <<
04233                         " is marked as in_reorg or recycled");
04234 
04235                     allMediumUsable = false;
04236                     log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
04237                     break;
04238                 }
04239             }
04240             if ( allMediumUsable ) {
04241                     log_DBG_m(dbg_DETAIL, "Row " << a_mediumTable[i].rowNum << " can be used");
04242                     if (a_mediumTable[i].mediumPos.size() == 0)
04243                         throw ivd_InternalError(ie_FATAL_ERROR, "position without split");
04244                     //is this copy on Disk medium?
04245                     if (ivd_MediaType_e(a_mediumTable[i].mediumPos[0].medium.mediumType) == mt_DISK) {
04246                         //Yes it is. Give it to me baby ...
04247                         return i;
04248                     }
04249 
04250                     selMediumTable.push_back(a_mediumTable[i]);
04251             }
04252             allMediumUsable = true;
04253         }
04254 
04255         //Filter out set with least number of splits
04256         if (selMediumTable.size() == 0) {
04257         stringstream sStr;
04258         sStr << "No usable (marked good, unreliable or online) media found for recall!";
04259         log_WriteEvent(evt_WARNING, sStr.str());
04260         throw ivd_Error(ie_NO_RESOURCE_FOUND, "No copy is on a usable set of media");
04261         }
04262 
04263 
04264         //Filter out set with least number of splits
04265         log_DBG_m(dbg_DETAIL,"will filter out set with at least splits");
04266 
04267         UInt32_t minNumOfSplits = selMediumTable[0].mediumPos.size();
04268         UInt32_t bestTmp(selMediumTable[0].rowNum);
04269 
04270         for (UInt32_t i = 0; i < selMediumTable.size(); i++) {
04271             if ( selMediumTable[i].mediumPos.size() < minNumOfSplits ) {
04272                 minNumOfSplits = selMediumTable[i].mediumPos.size();
04273                 bestTmp = selMediumTable[i].rowNum;
04274             }
04275         }
04276 
04277         log_DBG_m(dbg_DETAIL,"Selected copy by NumOfSplits " << bestTmp);
04278 
04279 
04280         //select split with first medium not in use and loaded
04281         for (UInt32_t i = 0; i < selMediumTable.size(); i++) {
04282             if (    (selMediumTable[i].mediumPos.size() == minNumOfSplits) &&
04283                     ((selMediumTable[i].mediumPos[0].medium.status & rmdb_MEDIUM_IN_USE) == 0 ) &&
04284                     (selMediumTable[i].mediumPos[0].medium.driveKey > 0) ) {
04285                 log_DBG_m(dbg_DETAIL, "first medium not in use and loaded "
04286                                         << selMediumTable[i].rowNum);
04287                 return selMediumTable[i].rowNum;
04288             }
04289         }
04290         //select split with first medium not in use
04291         for (UInt32_t i = 0; i < selMediumTable.size(); i++) {
04292             if (    (selMediumTable[i].mediumPos.size() == minNumOfSplits) &&
04293                 ((selMediumTable[i].mediumPos[0].medium.status & rmdb_MEDIUM_IN_USE) == 0 )) {
04294                     return selMediumTable[i].rowNum;
04295                 }
04296         }
04297         return bestTmp;
04298     } rm_CATCH_DB_THROW_IVD_m;
04299 
04300 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_DriveHost_t rm_Operator::GetHost ( Int32_t  a_driveKey  )  [private]

Definition at line 931 of file rm_operator.cpp.

References i_DriveHost_t::controlDevice, rm_DriveHost::controlDevice, rm_String::cvalue_p, dbg_DETAIL, rm_DriveHost::driveKey, rm_Drive::driveName, i_DriveHost_t::driveName, rm_DriveHost::EndSelectAll(), ivd_BaseException::GetError(), i_DriveHost_t::host, rm_DriveHost::host, log_DBG_m, log_ERR_m, log_FUNC_m, rm_DriveHost::Next(), and rm_DriveHost::StartSelectAll().

Referenced by dbo_GetHost::Process().

00931                                                      {
00932     log_FUNC_m(GetHost);
00933 
00934     rm_DriveHost dh;
00935     dh.StartSelectAll();
00936     dh.driveKey = 0;
00937     try {
00938         while (dh.driveKey != a_driveKey) {
00939             dh.Next();
00940         }
00941         dh.EndSelectAll();
00942 
00943     } catch (ivd_DBException e) {
00944         if (e.GetError() == 100) {
00945             log_ERR_m("ADMIN JOB: No DriveHost found for selected device." << e);
00946         }
00947         else {
00948             throw;
00949         }
00950     }
00951     log_DBG_m(dbg_DETAIL,   endl <<
00952                             "Found ctrlDevice for Drive: " << a_driveKey << endl <<
00953                             "ControlDevice: " << dh.controlDevice <<
00954                             " on Host: " << dh.host );
00955     i_DriveHost_t idh;
00956     idh.controlDevice = CORBA::string_dup(dh.controlDevice.cvalue_p);
00957     rm_Drive d(a_driveKey);
00958     idh.driveName = CORBA::string_dup(d.driveName.cvalue_p);
00959     idh.host = CORBA::string_dup(dh.host.cvalue_p);
00960     return idh;
00961 
00962 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::AllocateRecall ( rm_Resource_t a_resource  )  [private]

Definition at line 4303 of file rm_operator.cpp.

References rm_Resource_t::barcode, rm_Medium::barcode, rm_Medium::blockSize, rm_Resource_t::blockSize, dbg_DETAIL, dbg_LOW, dbg_NORM, rm_Drive::driveIndex, rm_Resource_t::driveIndex, rm_Drive::driveKey, rm_Resource_t::driveKey, rm_Medium::driveKey, ivd_BaseException::GetError(), rm_Library::host, i_DRIVE_BUSY, i_DRIVE_NOT_AVAILABLE, i_LIBRARY_NOT_AVAILABLE, i_MEDIUM_BUSY, i_MEDIUM_NOT_AVAILABLE, rm_Resource_t::libraryHost, rm_Drive::libraryKey, rm_Medium::libraryKey, rm_Library::libraryName, rm_Resource_t::libraryName, rm_Resource_t::load, rm_Resource_t::loadSlotAddr, log_DBG_m, log_FUNC_m, rm_MediaPool::mediaFamily, rm_Medium::mediaPoolKey, rm_MediaPool::mediaPoolType, rm_Resource_t::mediumFamily, rm_Medium::mediumKey, rm_Resource_t::mediumKey, rm_Medium::mediumType, mt_DISK, rm_Resource_t::poolKey, rm_Resource_t::poolType, rm_Resource_t::poolUUID, rm_MediaPool::poolUUIDString, rm_Resource_t::resAllocated, rm_Resource_t::resourceBusyStatus, rm_CATCH_DB_THROW_IVD_m, rmdb_DRIVE_IN_USE, rmdb_INIT_LIBRARY_STATUS, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_UNUSABLE, rm_Slot::Select(), rm_Library::Select(), rm_Medium::SelectByDrive(), rm_Drive::SelectForOperation(), rm_Slot::slotAddr, rm_Medium::slotKey, SQL_NOTFOUND, rm_Drive::status, rm_Library::status, rm_Medium::status, rm_Resource_t::unloadBarcode, rm_Resource_t::unloadSlotAddr, rm_Drive::Update(), and rm_Medium::Update().

Referenced by dbo_AllocateRec::Process().

04303                                                          {
04304     log_FUNC_m(AllocateRecall);
04305 
04306     try {
04307 
04308         rm_Medium recMedium(a_resource.mediumKey);
04309         if ((recMedium.status & rmdb_MEDIUM_UNUSABLE) == rmdb_MEDIUM_UNUSABLE){
04310             log_DBG_m(dbg_NORM,"Medium is unusable, can not use it for recall.");
04311             a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
04312             return;
04313         }
04314 
04315         rm_MediaPool pool(recMedium.mediaPoolKey);
04316 
04317         if (recMedium.mediumType != mt_DISK) {
04318             rm_Drive drives;
04319             vector<rm_Drive> selDrive;
04320 
04321             if (recMedium.libraryKey == -1){
04322                 log_DBG_m(dbg_NORM,"Medium is offline, can not use it for recall.");
04323                 return;
04324             }
04325 
04326             rm_Library lib(recMedium.libraryKey);
04327             if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
04328                 log_DBG_m(dbg_LOW,"Library disabled or Error. Can not allocate resources.");
04329                 a_resource.resourceBusyStatus = i_LIBRARY_NOT_AVAILABLE;
04330                 return;
04331             }
04332 
04333             selDrive = drives.SelectForOperation(   recMedium.libraryKey,
04334                                                     pool.mediaFamily,
04335                                                     0,
04336                                                     false);
04337             if (selDrive.size() == 0) {
04338                 log_DBG_m(dbg_LOW,"No drives available for recall");
04339                 selDrive = drives.SelectForOperation(   recMedium.libraryKey,
04340                                                         pool.mediaFamily,
04341                                                         0,
04342                                                         true);
04343                 if (selDrive.size() == 0) {
04344                     a_resource.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
04345                 } else {
04346                     a_resource.resourceBusyStatus = i_DRIVE_BUSY;
04347                 }
04348                 return;
04349             }
04350 
04351             if ((recMedium.status & rmdb_MEDIUM_IN_USE) == rmdb_MEDIUM_IN_USE){
04352                 log_DBG_m(dbg_NORM,"Medium is in use, can NOT recall now");
04353                 a_resource.resourceBusyStatus = i_MEDIUM_BUSY;
04354                 return;
04355             }
04356             //*** Fill up output with results found
04357 
04358             rm_Drive* selectedDrive = &(selDrive[0]);
04359             log_DBG_m(dbg_DETAIL,"Will select drive for medium:" << recMedium.mediumKey <<
04360                                 "which is in drive:" << recMedium.driveKey);
04361 
04362             if (recMedium.driveKey > 0) { //if medium is in drive select it
04363                 log_DBG_m(dbg_DETAIL,"Medium is in Drive");
04364 
04365                 //find the drive into which media is inserted
04366                 bool found = false;
04367                 for (UInt32_t j = 0; j < selDrive.size(); j++){
04368 
04369                     log_DBG_m(dbg_DETAIL,"recMedium.driveKey:"<< recMedium.driveKey <<
04370                                         "selDrive[j].driveKey:" << selDrive[j].driveKey        );
04371 
04372                     if (recMedium.driveKey == selDrive[j].driveKey) {
04373                         selectedDrive = &(selDrive[j]);
04374                         found = true;
04375                         log_DBG_m(dbg_NORM,"selected Drive:" << selDrive[j].driveKey);
04376                         break;
04377                     } //if
04378                 } //for
04379 
04380                 //medium is in drive, but drive was not found in list (maybe it's in use)
04381                 if (!found) {
04382                     return;
04383                 }
04384             } else {
04385                 log_DBG_m(dbg_DETAIL,"Medium is NOT in Drive");
04386                 rm_Medium m;
04387                 for(UInt32_t i(0); i < selDrive.size(); i++){
04388                     try {
04389                         m.SelectByDrive(selDrive[i].driveKey);
04390                     } catch (ivd_DBException& dbe){
04391                         if (dbe.GetError() == SQL_NOTFOUND){
04392                             selectedDrive = &(selDrive[i]);
04393                             log_DBG_m(dbg_DETAIL,"Selected empty drive:" << selDrive[i].driveKey);
04394                             break;
04395                         } //if
04396                     } //catch
04397                 } //for
04398             }//else
04399 
04400             // updating Medium to status rmdb_MEDIUM_IN_USE
04401             recMedium.status = recMedium.status | rmdb_MEDIUM_IN_USE;
04402             recMedium.Update();
04403 
04404             // updating drive to status rmdb_DRIVE_IN_USE
04405             selectedDrive->status = selectedDrive->status | rmdb_DRIVE_IN_USE;
04406             selectedDrive->Update();
04407             a_resource.driveKey = selectedDrive->driveKey;
04408             a_resource.driveIndex = selectedDrive->driveIndex;
04409 
04410             if (selectedDrive->libraryKey > 0) {
04411 
04412                 rm_Library selLib;
04413                 selLib.Select(selectedDrive->libraryKey);
04414                 a_resource.libraryName = selLib.libraryName;
04415                 a_resource.libraryHost = selLib.host;
04416 
04417                 if (recMedium.slotKey > 0) { // if in slot ok select it
04418                     rm_Slot selSlot;
04419                     selSlot.Select(
04420                         recMedium.slotKey,
04421                         recMedium.libraryKey
04422                         );
04423 
04424                     a_resource.loadSlotAddr = selSlot.slotAddr;
04425                 } else {
04426                     a_resource.loadSlotAddr = "";
04427                     log_DBG_m( dbg_LOW,  "Selected Medium: " << recMedium.barcode <<
04428                         "  for Recall without SlotKey. Assuming Manual Robot");
04429                 }
04430             }
04431             if (recMedium.driveKey != selectedDrive->driveKey){ //medium is not in selected drive
04432                 a_resource.load = true;
04433                 rm_Medium unloadMedium;
04434                 try {
04435                     unloadMedium.SelectByDrive(selectedDrive->driveKey);
04436                 } catch ( ivd_DBException& e) {
04437                     if (e.GetError() == SQL_NOTFOUND) {
04438                         unloadMedium.mediumKey = 0;
04439                     } else
04440                         throw;
04441                 }
04442                 if (unloadMedium.mediumKey > 0){ // a medium is in the drive that should be unloaded
04443                     unloadMedium.status = unloadMedium.status | rmdb_MEDIUM_IN_USE;
04444                     unloadMedium.Update();
04445                     a_resource.unloadBarcode = unloadMedium.barcode;
04446                     if (unloadMedium.slotKey > 0) { // if in slot ok select it
04447                         rm_Slot selSlot;
04448                         selSlot.Select(unloadMedium.slotKey, unloadMedium.libraryKey);
04449                         a_resource.unloadSlotAddr = selSlot.slotAddr;
04450                     } else {
04451                         a_resource.unloadSlotAddr = "";
04452                         log_DBG_m( dbg_LOW,  "Unload Medium: " << unloadMedium.barcode <<
04453                             "  for Recall without SlotKey. Assuming Manual Robot");
04454                     }
04455                 } else {
04456                     a_resource.unloadSlotAddr = "";
04457                     a_resource.unloadBarcode = "";
04458                 }
04459             }
04460         }
04461 
04462 
04463         // If it gets down to here, the resources are successfully allocated
04464         a_resource.resAllocated = true;
04465 
04466         a_resource.poolKey = recMedium.mediaPoolKey;
04467         a_resource.poolType = pool.mediaPoolType;
04468         a_resource.mediumFamily = pool.mediaFamily;
04469         a_resource.mediumKey = recMedium.mediumKey;
04470         a_resource.blockSize = recMedium.blockSize;
04471         a_resource.poolUUID = pool.poolUUIDString;
04472         a_resource.barcode = recMedium.barcode;
04473     } rm_CATCH_DB_THROW_IVD_m;
04474 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::AllocateMigCollocation ( bool  a_online,
rm_Resource_t a_resource 
) [private]

Definition at line 3766 of file rm_operator.cpp.

References AllocateMigDefault(), rm_Medium::barcode, rm_Resource_t::barcode, rm_Medium::blockSize, rm_Resource_t::blockSize, cmn_Num2Str(), dbg_DETAIL, dbg_NORM, rm_Medium::driveKey, rm_Resource_t::driveKey, i_COL_GRP_SIZE_EXC, i_DRIVE_NOT_AVAILABLE, i_MEDIUM_BUSY, i_MEDIUM_NOT_AVAILABLE, log_DBG_m, log_FUNC_m, log_WriteEvent(), rm_ColMediaVol::m_mediaKey, rm_ColMediaVol::m_medVolNr, rm_ColMediaVol::m_minColId, rm_MajorCol::majColId, rm_Resource_t::majColId, rm_MajorCol::majColSize, rm_Medium::mediaPoolKey, rm_Resource_t::mediumFamily, rm_Resource_t::mediumKey, rm_Medium::mediumKey, rm_Medium::mediumType, rm_MediumVol::medVolId, rm_Resource_t::medVolId, rm_Resource_t::medVolNr, rm_MediumVol::medVolNr, mf_DISK, rm_Resource_t::minColId, mt_DISK, rm_Resource_t::poolKey, rm_Resource_t::resourceBusyStatus, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_OPEN, rmdb_MEDIUM_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, rmdb_MEDVOL_FULL, rmdb_MEDVOL_REORG_INREORG, rm_MajorCol::Select(), rm_Medium::Select(), rm_MediumVol::Select(), rm_ColMediaVol::SelectAll(), SelectColAlloc(), SelectDriveForMig(), SelectOpenedVolume(), rm_Medium::status, rm_MediumVol::status, UpdateCollocation(), and rm_MediumVol::volSize.

03766                                                                                 {
03767     log_FUNC_m(AllocateMigCollocation);
03768 
03769     // check if there is already a volume with that minColId
03770     rm_ColMediaVol cmv;
03771     vector<rm_ColMediaVol> cmvList;
03772     cmvList = cmv.SelectAll();
03773 
03774     bool foundRes(false);
03775     log_DBG_m(dbg_NORM, "cmvList.size():" << cmvList.size());
03776 
03777     for (UInt32_t i(0); i < cmvList.size(); i++) {
03778         rm_ColMediaVol &current = cmvList[i];
03779         log_DBG_m(dbg_NORM, "current.m_minColId: " << current.m_minColId <<
03780                             ", a_resource.minColId: " << a_resource.minColId);
03781         if (current.m_minColId == a_resource.minColId) {
03782             log_DBG_m(dbg_NORM, "found colID on medium:" << current.m_mediaKey <<
03783                                 ", volume " << current.m_medVolNr);
03784             rm_MediumVol mv;
03785             mv.Select(current.m_mediaKey, current.m_medVolNr);
03786             rm_Medium m;
03787             m.Select(current.m_mediaKey);
03788             if (mv.status & rmdb_MEDVOL_FULL) {
03789                 log_DBG_m(dbg_NORM, "volume full.");
03790                 continue;
03791             }
03792             if (m.mediaPoolKey != a_resource.poolKey) {
03793                 log_DBG_m(dbg_NORM, "Incorrect pool " << m.mediaPoolKey
03794                     << " (looking for: " << a_resource.poolKey << ").");
03795                 continue;
03796             }
03797             else {
03798                 log_DBG_m(dbg_NORM, "Volume not full and in correct pool, check medium ...");
03799                 //check if medium is available
03800                 if ((m.status & rmdb_MEDIUM_UNUSABLE) || (m.status & rmdb_MEDIUM_UNRELIABLE)){
03801                     a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
03802                     log_DBG_m(dbg_NORM, "medStatus:" << m.status << ". continue with next ...");
03803                     continue;
03804                 }
03805                 else if (mv.status & rmdb_MEDVOL_REORG_INREORG) {
03806                     log_DBG_m(dbg_NORM, "In reorg. volStatus:" << mv.status << ", mediumKey: "
03807                         << m.mediumKey << ", medVolNr: " << mv.medVolNr << ". continue with next ...");
03808                     continue;
03809                 }
03810                 else if ((m.status == rmdb_MEDIUM_OPEN)) {
03811                     //use it
03812                     a_resource.mediumKey = m.mediumKey;
03813                     a_resource.medVolNr = mv.medVolNr;
03814                     a_resource.medVolId = mv.medVolId;
03815 
03816                     a_resource.barcode   = m.barcode;
03817                     a_resource.blockSize = m.blockSize;
03818                     a_resource.driveKey  = m.driveKey;
03819 
03820                     if (m.mediumType == mt_DISK){
03821                         a_resource.mediumFamily = mf_DISK;
03822                         foundRes = true;
03823                     } else {
03824                         //medium can be used, now search for drive
03825                         foundRes = SelectDriveForMig(a_resource);
03826                     }
03827 
03828                     if (foundRes){
03829                         UpdateCollocation(a_resource);
03830                         log_DBG_m(dbg_NORM, "found medium and drive ...");
03831                         return true;
03832                     }
03833                     else {
03834                         log_DBG_m(dbg_NORM, "drive not available ...");
03835                         a_resource.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
03836                         return false;
03837                     }
03838 
03839                 } else {
03840                     if (m.status & rmdb_MEDIUM_IN_USE) {
03841                         //do not continue with allocation
03842                         log_DBG_m(dbg_NORM, "Medium is in use.");
03843                         a_resource.resourceBusyStatus = i_MEDIUM_BUSY;
03844                         return false;
03845                     } else {
03846                         // medium is unsusable or unreliable
03847                         log_DBG_m(dbg_NORM, "m.status:" << m.status << ". medium is empty but should contain some data. next ...");
03848                         continue;
03849                     }
03850                 }
03851             }
03852         }
03853     }
03854     log_DBG_m(dbg_NORM, "did not found any volumes with that minColID");
03855     // allocate new volume
03856 
03857     // check current size of collocation group
03858     rm_MajorCol majCol;
03859     majCol.Select(a_resource.majColId);
03860 
03861     rm_MediumVol mv;
03862 
03863     vector<rm_ColAlloc> colAlloc = SelectColAlloc(majCol.majColId, a_resource.poolKey);
03864     log_DBG_m(dbg_NORM, "colAlloc.size(): " << colAlloc.size());
03865 
03866     UInt32_t currentSize(0);
03867 
03868     {
03869         vector<Int32_t> mediumKeyCounted;
03870         vector<Int32_t> medVolNrCounted;
03871         Int32_t lastmediumKeyCounted(0);
03872         Int32_t lastmedVolNrCounted(0);
03873 
03874         for (UInt32_t i(0); i < colAlloc.size(); i++) {
03875             if ( (lastmediumKeyCounted != colAlloc[i].mediumKey)
03876               && (lastmedVolNrCounted != colAlloc[i].medVolNr) ) {
03877                 bool alreadyCounted(false);
03878                 for (UInt32_t j(0); j < mediumKeyCounted.size(); j++) {
03879                     if ( (mediumKeyCounted[j] == colAlloc[i].mediumKey)
03880                       && (medVolNrCounted[j] == colAlloc[i].medVolNr) ) {
03881                         alreadyCounted = true;
03882                         break;
03883                     }
03884                 }
03885                 if (!alreadyCounted) {
03886                     mediumKeyCounted.push_back(colAlloc[i].mediumKey);
03887                     medVolNrCounted.push_back(colAlloc[i].medVolNr);
03888                     log_DBG_m(dbg_DETAIL, "Counting Medium key: " << colAlloc[i].mediumKey
03889                         << ", medVolNr: " << colAlloc[i].medVolNr
03890                         << ", volSize: " << colAlloc[i].volSize);
03891                     currentSize += colAlloc[i].volSize;
03892                 }
03893             }
03894         }
03895     }
03896     log_DBG_m(dbg_NORM, "Size of all volumes is: " << currentSize << "MB ("
03897                         << "MajorColSize: " << majCol.majColSize << "MB).");
03898 
03899     if (currentSize > majCol.majColSize) {
03900         bool ret_val = SelectOpenedVolume(a_resource, colAlloc);
03901         if ((!ret_val) && (a_resource.resourceBusyStatus != i_MEDIUM_BUSY)) {
03902             a_resource.resourceBusyStatus = i_COL_GRP_SIZE_EXC;
03903         }
03904         return ret_val;
03905     }
03906     else { //group size is not exceeded, find a new volume
03907         foundRes = AllocateMigDefault(a_online, true, a_resource);
03908 
03909         if (foundRes) {
03910             UpdateCollocation(a_resource);
03911             rm_MediumVol mds(a_resource.mediumKey, a_resource.medVolNr);
03912             UInt32_t newSize = mds.volSize + currentSize;
03913             ostringstream sstr;
03914             if (newSize > majCol.majColSize) {
03915                 //[2009/10/22 13:18:09, ivd-test-02, 003308, RMG, , 0, 99] WARNING: Collocation group size exceeded. Usage: 100MB, max size: 50MB
03916                 sstr << "Collocation group size exceeded. Usage: " << newSize << "MB, ";
03917                 sstr << "max size " << majCol.majColSize << "MB";
03918                 log_WriteEvent(sstr.str(), "", 0, cmn_Num2Str(majCol.majColId) );
03919             }
03920             else {
03921                 //[2009/10/22 13:21:04, ivd-test-02, 003308, RMG, , 0, 86] Collocation group usage: 300MB, max size: 500MB
03922                 sstr << "Collocation group usage: " << newSize << "MB, ";
03923                 sstr << "max size " << majCol.majColSize << "MB";
03924                 log_WriteEvent(sstr.str(), "", 0, cmn_Num2Str(majCol.majColId) );
03925             }
03926             return true;
03927         }
03928         else {
03929             //size is not exceeded and no free volumes available
03930             //select volume with non-exlusive col for migration
03931             bool ret_val = SelectOpenedVolume(a_resource, colAlloc);
03932             if ((!ret_val) && (a_resource.resourceBusyStatus != i_MEDIUM_BUSY)) {
03933                 a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
03934             }
03935             return ret_val;
03936         }
03937     }
03938 
03939     return foundRes;
03940 }

Here is the call graph for this function:

void rm_Operator::UpdateCollocation ( rm_Resource_t a_resource  )  [private]

Definition at line 4013 of file rm_operator.cpp.

References CheckAndAdd(), cmn_Num2Str(), ivd_BaseException::GetError(), rm_MinorCol::Insert(), log_FUNC_m, log_WriteEvent(), rm_MinorCol::m_flags, rm_MinorCol::m_majColId, rm_MinorCol::m_minColId, rm_Resource_t::majColId, i_ColMediaVol_t::mediaKey, rm_Resource_t::mediumKey, rm_Resource_t::medVolNr, i_ColMediaVol_t::medVolNr, i_ColMediaVol_t::minColId, rm_Resource_t::minColId, rm_Resource_t::minFlags, rm_MinorCol::Select(), and SQL_NOTFOUND.

Referenced by AllocateMigCollocation(), and SelectOpenedVolume().

04013                                                             {
04014     log_FUNC_m(UpdateCollocation);
04015     rm_MinorCol mc;
04016     try {
04017         mc.Select(a_resource.minColId);
04018     }
04019     catch (ivd_Exception &e){
04020         if (e.GetError() == SQL_NOTFOUND){
04021             //not found INSERT!
04022             mc.m_minColId = a_resource.minColId;
04023             mc.m_majColId = a_resource.majColId;
04024             mc.m_flags = a_resource.minFlags;
04025             mc.Insert();
04026             //inserted new minor collocationID
04027             ostringstream sstr;
04028             sstr << "Added new collocation set: " << mc.m_minColId;
04029             log_WriteEvent(sstr.str(), "", 0, cmn_Num2Str(mc.m_majColId) );
04030         }
04031         else {
04032             throw;
04033         }
04034     }
04035 
04036     //update ColMediaVol table if needed
04037     i_ColMediaVol_t colMediaVol;
04038     colMediaVol.minColId = a_resource.minColId;
04039     colMediaVol.mediaKey = a_resource.mediumKey;
04040     colMediaVol.medVolNr = a_resource.medVolNr;
04041     CheckAndAdd(colMediaVol, a_resource.minFlags);
04042 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::AllocateMigDefault ( bool  a_online,
bool  a_newVol,
rm_Resource_t a_resource 
) [private]

Definition at line 4044 of file rm_operator.cpp.

References CheckForAnyResourceForMig(), dbg_LOW, log_DBG_m, log_FUNC_m, rm_Resource_t::poolKey, and SelectMediumForMig().

Referenced by AllocateMigCollocation().

04044                                                                                         {
04045     log_FUNC_m(AllocateMigDefault);
04046 
04047 
04048     bool foundAll(false);
04049     foundAll = SelectMediumForMig( a_online, a_col, a_resource);
04050     if (foundAll) {
04051         log_DBG_m(dbg_LOW,"Resources Found for pool " << a_resource.poolKey);
04052         return true;
04053     } else {
04054         log_DBG_m(dbg_LOW,"No Resources Found for pool " << a_resource.poolKey);
04055         CheckForAnyResourceForMig(a_resource, a_col);
04056         return false;
04057     };
04058 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::AllocateMig ( bool  a_online,
rm_ResourceTable_t a_resourceTable 
) [private]

Referenced by dbo_AllocateMig::Process().

Here is the caller graph for this function:

vector< rm_ColAlloc > rm_Operator::SelectColAlloc ( UInt64_t  a_majColId,
UInt32_t  a_poolKey 
) [private]

Definition at line 4316 of file librmdb.exx.

References dbg_DETAIL, errorDesc(), log_DBG_m, log_FUNC_m, rm_ColAlloc::majColId, rm_ColAlloc::majSize, rm_ColAlloc::mediumKey, rm_ColAlloc::medStatus, rm_ColAlloc::medVolNr, rm_ColAlloc::minColId, rm_ColAlloc::minFlags, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, rm_ColAlloc::volSize, rm_ColAlloc::volStatus, and rm_ColAlloc::volUsed.

Referenced by AllocateMigCollocation().

04316                                                                                       {
04317     log_FUNC_m(SelectColAlloc);
04318 
04319     Int32_t majHi = RMDB_COL_ID_HI(a_majColId);
04320     Int32_t majLo = RMDB_COL_ID_LO(a_majColId);
04321 
04322 
04323     EXEC SQL
04324         SET TRANSACTION NAME readTrans;
04325 
04326     EXEC SQL
04327         DECLARE COLALLOC CURSOR FOR
04328             SELECT
04329                 MINORCOL.MINCOLIDHI,
04330                 MINORCOL.MINCOLIDLO,
04331                 MINORCOL.FLAGS,
04332                 MAJORCOL.MAJCOLSIZE,
04333                 MEDIA.MEDIAKEY,
04334                 MEDIA.STATUS,
04335                 MEDIAVOL.MEDVOLNR,
04336                 MEDIAVOL.STATUS,
04337                 MEDIAVOL.VOLUSED,
04338                 MEDIAVOL.VOLSIZE
04339             FROM
04340                 MEDIA, MEDIAVOL, MAJORCOL, MINORCOL, COLMEDIAVOL, MEDIAPOOL
04341             WHERE
04342                 MAJORCOL.MAJCOLIDHI = :majHi AND
04343                 MAJORCOL.MAJCOLIDLO = :majLo AND
04344                 MEDIAVOL.MEDIAKEY = MEDIA.MEDIAKEY AND
04345                 MEDIAVOL.MEDVOLNR = COLMEDIAVOL.MEDVOLNR AND
04346                 MEDIA.MEDIAKEY = COLMEDIAVOL.MEDIAKEY AND
04347                 MAJORCOL.MAJCOLIDHI = MINORCOL.MAJCOLIDHI AND
04348                 MAJORCOL.MAJCOLIDLO = MINORCOL.MAJCOLIDLO AND
04349                 MINORCOL.MINCOLIDHI = COLMEDIAVOL.MINCOLIDHI AND
04350                 MINORCOL.MINCOLIDLO = COLMEDIAVOL.MINCOLIDLO AND
04351                 MEDIAPOOL.MEDIAPOOLKEY = :a_poolKey AND
04352                 MEDIA.MEDIAPOOLKEY = MEDIAPOOL.MEDIAPOOLKEY
04353             ORDER BY MEDIAVOL.VOLUSED DESC;
04354 
04355     EXEC SQL
04356         OPEN TRANSACTION readTrans COLALLOC;
04357 
04358     vector<rm_ColAlloc> colAllVec;
04359     rm_ColAlloc colAll;
04360 
04361     Int32_t minHi(0);
04362     Int32_t minLo(0);
04363 
04364     while (1) {     // get all volumes
04365         EXEC SQL
04366             FETCH
04367             COLALLOC INTO
04368                 :minHi,
04369                 :minLo,
04370                 :colAll.minFlags,
04371                 :colAll.majSize,
04372                 :colAll.mediumKey,
04373                 :colAll.medStatus,
04374                 :colAll.medVolNr,
04375                 :colAll.volStatus,
04376                 :colAll.volUsed,
04377                 :colAll.volSize;
04378 
04379         log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on COLALLOC: " << SQLCODE);
04380         if (SQLCODE != 0) break;
04381         colAll.majColId = a_majColId;
04382         colAll.minColId = RMDB_COL_ID(minHi, minLo);
04383 
04384         log_DBG_m(dbg_DETAIL,"colAll.mediumKey: " << colAll.mediumKey <<
04385                             " colAll.medVolNr:" << colAll.medVolNr );
04386 
04387         colAllVec.push_back(colAll);
04388     } // while end
04389 
04390     EXEC SQL
04391         CLOSE COLALLOC;
04392     string sqlErrDesc = errorDesc(SQLCODE, "CLOSE COLALLOC");
04393     SQL_CHECKREAD_M( sqlErrDesc );
04394 
04395     return colAllVec;
04396 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::SelectMediumForMig ( bool  a_online,
bool  a_newVol,
rm_Resource_t a_resource 
) [private]

Definition at line 4734 of file librmdb.exx.

References rm_Resource_t::barcode, rm_Medium::barcode, rm_Resource_t::blockSize, rm_Medium::blockSize, CheckMediumFull(), cmn_Num2Str(), rm_Medium::currentVolume, dbg_DETAIL, dbg_LOW, dbg_NORM, rm_Medium::diskSubsysKey, rm_Resource_t::driveKey, rm_Medium::driveKey, rm_Library::host, i_MEDIUM_NOT_AVAILABLE, rm_Medium::idxOfSysVol, ie_NO_RESOURCE_FOUND, ivd_Error, rm_Resource_t::libraryHost, rm_Medium::libraryKey, rm_Resource_t::libraryName, rm_Library::libraryName, rm_Medium::location, log_DBG_m, log_FUNC_m, log_WRN_m, rm_Medium::mediaPoolKey, rm_Resource_t::mediumFamily, rm_Resource_t::mediumKey, rm_Medium::mediumKey, rm_Medium::mediumSerialNo, rm_Medium::mediumType, rm_MediumVol::medVolId, rm_Resource_t::medVolId, rm_MediumVol::medVolNr, rm_Resource_t::medVolNr, mf_DISK, mt_DISK, NAME, NULL, rm_Medium::numOfVolumes, rm_Resource_t::poolKey, rm_Resource_t::resourceBusyStatus, rmdb_INIT_LIBRARY_STATUS, rmdb_MAX_BARCODE, rmdb_MAX_LOCATION, rmdb_MAX_MEDIUMSERIALNO, rmdb_MEDIUM_FULL, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, rm_MediumVol::Select(), SelectDriveForMig(), SelectMediumVolumeCol(), SelectMediumVolumeMig(), rm_Medium::sizeOfSysVol, rm_Medium::slotKey, SQL_NOERROR, SQL_NOTFOUND, rm_Library::status, and rm_Medium::status.

Referenced by AllocateMigDefault().

04736                                                                    {
04737     log_FUNC_m(SelectMediumForMig);
04738     rm_Medium med;
04739     //Declare cursor for Select operation
04740     UInt32_t mms = rmdb_MEDIUM_FULL | rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_UNUSABLE | rmdb_MEDIUM_IN_USE;
04741     UInt32_t mt = mt_DISK;
04742     EXEC SQL
04743         DECLARE SELECT_MEDIA_FOR_MIGRATION CURSOR FOR
04744         SELECT * FROM MEDIA
04745             WHERE
04746                 ( MEDIA.MEDIAPOOLKEY = :a_resource.poolKey AND
04747                   bin_and(MEDIA.STATUS, :mms) = 0 )
04748 
04749                   AND
04750 
04751                 ( (bin_and(:a_online, 1) = 0) OR
04752                   (MEDIA.DRIVEKEY IS NOT NULL)  OR
04753                   (bin_and(MEDIA.MEDIATYPE, :mt) != 0 )
04754                  )
04755 
04756             ORDER BY DRIVEKEY, STATUS DESC;
04757 
04758     if (SQLCODE < SQL_NOERROR){
04759         throw ivd_DBException(SQLCODE,"EXEC SQL DECLARE SELECT_MEDIA_FOR_MIGRATION", true);
04760     }
04761 
04762     EXEC SQL
04763         SET TRANSACTION NAME allocTrans
04764         ISOLATION LEVEL READ COMMITTED;
04765 
04766     EXEC SQL
04767         OPEN TRANSACTION allocTrans
04768         SELECT_MEDIA_FOR_MIGRATION;
04769 
04770     if (SQLCODE < SQL_NOERROR){
04771         throw ivd_DBException(SQLCODE,"EXEC SQL OPEN SELECT__MEDIA_FOR_MIGRATION", true);
04772     }
04773 
04774     char barcodeVal[rmdb_MAX_BARCODE];
04775     char locationVal[rmdb_MAX_LOCATION];
04776     char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];
04777 
04778     bool allFound = false;
04779     while (!allFound) {
04780         EXEC SQL
04781             FETCH SELECT_MEDIA_FOR_MIGRATION
04782                 INTO
04783                    :med.mediumKey,
04784                    :med.mediaPoolKey,
04785                    :med.libraryKey,
04786                    :med.slotKey,
04787                    :med.diskSubsysKey,
04788                    :med.driveKey,
04789                    :barcodeVal,
04790                    :med.status,
04791                    :locationVal,
04792                    :med.mediumType,
04793                    :mediumSerialNoVal,
04794                    :med.blockSize,
04795                    :med.numOfVolumes,
04796                    :med.idxOfSysVol,
04797                    :med.sizeOfSysVol,
04798                    :med.currentVolume;
04799 
04800         Int32_t sqlCode = SQLCODE;
04801         if (sqlCode == 0) {
04802             log_DBG_m(dbg_DETAIL, "Selected Medium:" << med.mediumKey << " Status: " << med.status );
04803         }
04804         else {
04805             log_DBG_m(dbg_DETAIL, "No more rows");
04806         }
04807 
04808         if (sqlCode == SQL_NOERROR) {
04809 
04810             med.barcode         = barcodeVal;
04811             med.location        = locationVal;
04812             med.mediumSerialNo  = mediumSerialNoVal;
04813 
04814             a_resource.barcode    = med.barcode;
04815             a_resource.blockSize  = med.blockSize;
04816             a_resource.mediumKey  = med.mediumKey;
04817             a_resource.driveKey   = med.driveKey;
04818 
04819             if (med.mediumType == mt_DISK){
04820                 a_resource.mediumFamily = mf_DISK;
04821             }
04822 
04823             bool failed(false);
04824             if (med.libraryKey > 0){
04825                 rm_Library lib(med.libraryKey);
04826                 if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
04827                     log_WRN_m("Library disabled or Error. Can not allocate resources. " <<
04828                                        lib.libraryName);
04829                     failed = true;
04830                 } else {
04831                     a_resource.libraryName = lib.libraryName;
04832                     a_resource.libraryHost = lib.host;
04833                 }
04834             }
04835             else {
04836                 log_DBG_m(dbg_LOW, "Medium is not inserted in any library. BC:" << med.barcode);
04837             }
04838 
04839             // extended with Plasmon patch
04840             if (!failed) {
04841                 bool foundVolume = false;
04842                 try {
04843                     rm_MediumVol mv;
04844                     if (a_col) {
04845                         UInt32_t volNum;
04846                         foundVolume = SelectMediumVolumeCol(med, volNum);
04847                         if (foundVolume) {
04848                             log_DBG_m(dbg_LOW, "found volNum:" << volNum);
04849                             mv.Select(med.mediumKey, volNum);
04850                         }
04851                     }
04852                     else {
04853                         foundVolume = SelectMediumVolumeMig(med, mv);
04854                     }
04855                     if (foundVolume){
04856                         a_resource.medVolNr = mv.medVolNr;
04857                         a_resource.medVolId = mv.medVolId;
04858                     }
04859                     else {
04860                         bool mediumFull = CheckMediumFull(med.mediumKey);
04861                         if (mediumFull) {
04862                             a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
04863                         }
04864                     }
04865                 }
04866                 catch (...) {
04867                     foundVolume = false;
04868                 }
04869 
04870                 if (med.mediumType == mt_DISK ) {
04871                     allFound = foundVolume;
04872                 }
04873                 else {
04874                     try {
04875                         if (foundVolume) {
04876                             //medium can be used, now search for drive
04877                             allFound = SelectDriveForMig(a_resource);
04878                         }
04879                     }
04880                     catch (...) {
04881                         allFound = false;
04882                     }
04883                 }
04884              }
04885         } //if (sqlCode == SQL_NOERROR)
04886         else if (sqlCode == SQL_NOTFOUND) {
04887             log_DBG_m(dbg_LOW, "No Medium found for Migration");
04888 
04889             EXEC SQL
04890                 CLOSE SELECT_MEDIA_FOR_MIGRATION;
04891 
04892             isc_commit_transaction (isc_status, &allocTrans);
04893             SQLCODE = isc_sqlcode (isc_status);
04894 
04895             // Removing media info
04896             a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
04897             a_resource.mediumKey = 0;
04898             a_resource.barcode.empty();
04899             return false;
04900 
04901         } //else if (sqlCode == SQL_NOTFOUND)
04902         else {
04903             log_DBG_m(dbg_NORM,"Fatal Allocation error sqlcode:" << SQLCODE);
04904 
04905             EXEC SQL
04906                 CLOSE SELECT_MEDIA_FOR_MIGRATION;
04907 
04908             isc_commit_transaction (isc_status, &allocTrans);
04909             SQLCODE = isc_sqlcode (isc_status);
04910 
04911             throw ivd_Error (
04912                     ie_NO_RESOURCE_FOUND,
04913                     "Fatal Allocation error sqlcode:" +
04914                     cmn_Num2Str((Int32_t)SQLCODE));
04915 
04916         } //else (fatal error occured)
04917     } //while !found
04918 
04919     EXEC SQL
04920         CLOSE SELECT_MEDIA_FOR_MIGRATION;
04921     log_DBG_m(dbg_DETAIL,"Closing SELECT_MEDIA_FOR_MIGRATION:" << SQLCODE);
04922 
04923     isc_commit_transaction (isc_status, &allocTrans);
04924     SQLCODE = isc_sqlcode (isc_status);
04925     return allFound;
04926 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::IsDriveWORM ( rm_Drive a_drv  )  [private]

Definition at line 3628 of file rm_operator.cpp.

References rm_Drive::capabilities, and dc_WORM.

Referenced by AllocateAdmin(), and SelectDriveForMig().

03628                                              {
03629     return (a_drv.capabilities & dc_WORM);
03630 }

Here is the caller graph for this function:

bool rm_Operator::IsMediumWORM ( rm_Medium a_med  )  [private]

Definition at line 3633 of file rm_operator.cpp.

References rm_Medium::mediumType.

Referenced by AllocateAdmin(), and SelectDriveForMig().

03633                                                {
03634     return ivd_IsMediumTypeWORM(ivd_MediaType_e(a_med.mediumType));
03635 }

Here is the caller graph for this function:

bool rm_Operator::SelectDriveForMig ( rm_Resource_t a_resource  )  [private]

Definition at line 3638 of file rm_operator.cpp.

References rm_Medium::barcode, dbg_DETAIL, dbg_LOW, dbg_NORM, dc_WORM, rm_Drive::driveIndex, rm_Resource_t::driveIndex, rm_Drive::driveKey, rm_Resource_t::driveKey, rm_Drive::driveName, ivd_BaseException::GetError(), rm_Library::host, IsDriveWORM(), IsMediumWORM(), rm_Resource_t::libraryHost, rm_Medium::libraryKey, rm_Resource_t::libraryName, rm_Library::libraryName, rm_Resource_t::load, rm_Resource_t::loadSlotAddr, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, rm_MediaPool::mediaFamily, rm_Medium::mediaPoolKey, rm_Resource_t::mediumFamily, rm_Resource_t::mediumKey, mf_DISK, rmdb_DRIVE_DISABLED, rmdb_DRIVE_ERROR, rmdb_DRIVE_IN_USE, rmdb_INIT_LIBRARY_STATUS, rm_Slot::Select(), rm_Drive::Select(), rm_Medium::SelectByDrive(), rm_Drive::SelectForOperation(), rm_Slot::slotAddr, rm_Medium::slotKey, SQL_NOTFOUND, rm_Library::status, rm_Drive::status, rm_Resource_t::unload, rm_Resource_t::unloadBarcode, and rm_Resource_t::unloadSlotAddr.

Referenced by AllocateMigCollocation(), SelectMediumForMig(), and SelectOpenedVolume().

03638                                                             {
03639     log_FUNC_m(SelectDriveForMig);
03640 
03641     if (a_resource.mediumFamily == mf_DISK){
03642         return true;
03643     }
03644 
03645     rm_Drive drv;
03646     rm_Medium med(a_resource.mediumKey);
03647 
03648     if (a_resource.driveKey > 0) {
03649         drv.Select(a_resource.driveKey);
03650         log_DBG_m(dbg_DETAIL, "drive: " << drv.driveName <<
03651                                 " status:" << drv.status);
03652 
03653         if ( (drv.status & (rmdb_DRIVE_IN_USE | rmdb_DRIVE_DISABLED | rmdb_DRIVE_ERROR)) != 0 ){
03654             ostringstream msg;
03655             msg << "Medium " << med.barcode <<
03656                     " is inserted in unusable drive. Please unload manually.";
03657 
03658             log_WriteEvent(msg.str(), "DRIVE", 0, string(drv.driveName));
03659             log_ERR_m(msg.str());
03660             return false;
03661         } else {
03662 
03663             //status ok checking WORM capabilities
03664             if ( !IsMediumWORM(med) || IsDriveWORM(drv) ) {
03665                 log_DBG_m(dbg_LOW,"Found drive usable: " << drv.driveName);
03666                 return true;
03667             } else {
03668                 log_DBG_m(dbg_LOW,  "Found drive, but WORM check failed: " <<
03669                                     drv.driveName);
03670                 return false;
03671             }
03672         }
03673         return true;
03674     }
03675     else if (med.libraryKey > 0) { // nearline
03676 
03677         // select a drive that is in same library as medium and is preferably empty
03678         rm_MediaPool pool(med.mediaPoolKey);
03679         UInt32_t reqCapability(0);
03680         if (IsMediumWORM(med)) {
03681             reqCapability |= dc_WORM;
03682         }
03683         vector<rm_Drive> drvVec = drv.SelectForOperation(
03684                                                 med.libraryKey,
03685                                                 pool.mediaFamily,
03686                                                 reqCapability,
03687                                                 false);
03688 
03689         if (drvVec.size() == 0) {
03690             log_DBG_m(dbg_LOW,"No Drives available for operation");
03691             return false;
03692         }
03693 
03694         rm_Library lib(med.libraryKey);
03695         if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
03696             log_WRN_m("Library disabled or Error. Can not allocate resources. " <<
03697                             lib.libraryName);
03698             return false;
03699         } else {
03700             a_resource.libraryName = lib.libraryName;
03701             a_resource.libraryHost = lib.host;
03702         }
03703 
03704         //check if any is empty and select it
03705         vector<rm_Drive>::iterator it;
03706 
03707         bool emptyDrvFound(false);
03708 
03709         for ( it = drvVec.begin(); it != drvVec.end(); it++ ){
03710             rm_Medium tempMedium;
03711             try {
03712                 tempMedium.SelectByDrive(it->driveKey);
03713             } catch (ivd_DBException& dbe){
03714                 if (dbe.GetError() == SQL_NOTFOUND){
03715                     log_DBG_m(dbg_LOW,"Found empty drive: " << it->driveKey);
03716                     drv = *it;
03717                     emptyDrvFound = true;
03718                     a_resource.load = true;
03719                     break;
03720                 }
03721                 else throw;
03722             }
03723         }
03724 
03725         if (!emptyDrvFound){
03726             //just take first
03727             drv = *drvVec.begin();
03728             a_resource.load = true;
03729             a_resource.unload= true;
03730             rm_Medium medUnload;
03731             medUnload.SelectByDrive(drv.driveKey);
03732             if (medUnload.slotKey > 0) {
03733                 rm_Slot unloadSlot;
03734                 unloadSlot.Select(medUnload.slotKey, medUnload.libraryKey);
03735                 a_resource.unloadSlotAddr = unloadSlot.slotAddr;
03736                 a_resource.unloadBarcode = medUnload.barcode;
03737             }
03738         }
03739 
03740         if (a_resource.load && med.slotKey > 0) { // if in slot ok select it
03741             rm_Slot selSlot;
03742             selSlot.Select(med.slotKey, med.libraryKey);
03743             a_resource.loadSlotAddr = selSlot.slotAddr;
03744         }
03745         else {
03746             a_resource.loadSlotAddr = "";
03747             log_DBG_m( dbg_LOW,  "Selected Medium: " << med.barcode <<
03748                         "  for migration without SlotKey. Assuming Manual Robot");
03749         }
03750         a_resource.driveKey = drv.driveKey;
03751         a_resource.driveIndex = drv.driveIndex;
03752 
03753         log_DBG_m(dbg_LOW,"Found Drive: " << drv.driveKey);
03754         return true;
03755     } else { //offline
03756         ostringstream sstr;
03757         sstr << "Medium " << med.barcode <<
03758             " is offline. Please insert into Library Manually";
03759         log_WriteEvent(sstr.str());
03760         log_DBG_m(dbg_NORM, sstr.str());
03761         return false;
03762     }
03763 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::CheckForAnyResourceForMig ( rm_Resource_t res,
bool  a_online 
) [private]

Definition at line 4606 of file librmdb.exx.

References dbg_LOW, dbg_NORM, errorDesc(), evt_WARNING, i_DRIVE_BUSY, i_DRIVE_NOT_AVAILABLE, i_LIBRARY_NOT_AVAILABLE, i_MEDIUM_BUSY, i_MEDIUM_NOT_AVAILABLE, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), rm_MediaPool::mediaFamily, rm_MediaPool::mediaPoolKey, rm_MediaPool::mediaPoolName, mf_DISK, NAME, rm_Resource_t::poolKey, rm_Resource_t::resourceBusyStatus, rmdb_INIT_LIBRARY_STATUS, rmdb_MEDIUM_FULL, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, rm_Drive::SelectForOperation(), SQL_CHECK_M, SQL_NOTFOUND, and rm_Library::status.

Referenced by AllocateMigDefault().

04606                                                                             {
04607     log_FUNC_m(CheckForAnyResourceForMig);
04608 
04609     bool statusSet(false);
04610     rm_MediaPool pool(res.poolKey);
04611 
04612     //this work only if all media are in the same library
04613     EXEC SQL
04614         SET TRANSACTION NAME readWriteTrans;
04615 
04616     UInt32_t mms = rmdb_MEDIUM_FULL | rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_UNUSABLE ;
04617 
04618     EXEC SQL
04619         DECLARE IS_THERE_MEDIA_FOR_MIGRATION CURSOR FOR
04620         SELECT LIBRARYKEY FROM MEDIA
04621             WHERE
04622                 MEDIA.MEDIAPOOLKEY = :res.poolKey AND
04623                 bin_and(MEDIA.STATUS, :mms) = 0
04624             ORDER BY DRIVEKEY;
04625     EXEC SQL
04626         OPEN TRANSACTION readWriteTrans
04627         IS_THERE_MEDIA_FOR_MIGRATION;
04628 
04629 
04630     UInt32_t libraryKey(0);
04631 
04632     EXEC SQL
04633         FETCH IS_THERE_MEDIA_FOR_MIGRATION
04634         INTO :libraryKey;
04635 
04636     if (SQLCODE == SQL_NOTFOUND) {
04637         rm_MediaPool mp(res.poolKey);
04638         string poolName(mp.mediaPoolName);
04639         log_DBG_m(dbg_LOW,"No media available for migration");
04640 
04641         if (!a_online || (mp.mediaFamily == mf_DISK) ){
04642             //report only when doing second run (offline/nearline media)
04643             // for disk we do only one run, so report immediately
04644             log_WriteEvent(evt_WARNING, "No media available for migration.", "", 0, poolName);
04645         }
04646         res.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
04647         statusSet = true;
04648     }
04649 
04650     EXEC SQL
04651         CLOSE IS_THERE_MEDIA_FOR_MIGRATION;
04652     string sqlErrDesc = errorDesc(SQLCODE, "Check for any medium");
04653     try {
04654         SQL_CHECK_M( sqlErrDesc );
04655     } catch (ivd_Exception &e) {
04656         log_ERR_m(e);
04657     }
04658 
04659     if (statusSet) return;
04660 
04661     //check if media are busy but are not full/unusable/unreliable
04662 
04663     //this work only if all media are in the same library
04664     EXEC SQL
04665         SET TRANSACTION NAME readWriteTrans;
04666 
04667     UInt32_t mmsuse = rmdb_MEDIUM_IN_USE;
04668 
04669     EXEC SQL
04670         DECLARE IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY CURSOR FOR
04671         SELECT LIBRARYKEY FROM MEDIA
04672             WHERE
04673                 MEDIA.MEDIAPOOLKEY = :pool.mediaPoolKey AND
04674                 bin_and(MEDIA.STATUS, :mms) = 0 AND
04675                 bin_and(MEDIA.STATUS, :mmsuse) = 0
04676 
04677             ORDER BY DRIVEKEY;
04678     EXEC SQL
04679         OPEN TRANSACTION readWriteTrans
04680         IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY;
04681 
04682     EXEC SQL
04683         FETCH IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY
04684         INTO :libraryKey;
04685 
04686     if (SQLCODE == SQL_NOTFOUND) {
04687         string poolName(pool.mediaPoolName);
04688         log_DBG_m(dbg_LOW,"No notbusy media available for migration");
04689 
04690         res.resourceBusyStatus = i_MEDIUM_BUSY;
04691         statusSet = true;
04692     }
04693 
04694     EXEC SQL
04695         CLOSE IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY;
04696 
04697     string sqlErrDesc1 = errorDesc(SQLCODE, "Check for busy medium");
04698     try {
04699         SQL_CHECK_M( sqlErrDesc1 );
04700     } catch (ivd_Exception &e) {
04701         log_ERR_m(e);
04702     }
04703 
04704     if (statusSet) return;
04705 
04706     //there are media, now check for drives
04707     rm_Drive drives;
04708     vector<rm_Drive> selDrive;
04709 
04710     if (libraryKey > 0) {
04711         rm_Library lib(libraryKey);
04712         if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
04713             log_DBG_m(dbg_LOW,"Library disabled or Error. Can not allocate resources.");
04714             res.resourceBusyStatus = i_LIBRARY_NOT_AVAILABLE;
04715             return;
04716         }
04717 
04718         selDrive = drives.SelectForOperation(   libraryKey,
04719                                                 pool.mediaFamily,
04720                                                 0,
04721                                                 true);
04722         if (selDrive.size() == 0){
04723             log_DBG_m(dbg_NORM, "Setting i_DRIVE_NOT_AVAILABLE ");
04724             res.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
04725         } else {
04726             log_DBG_m(dbg_NORM, "Setting i_DRIVE_BUSY");
04727             res.resourceBusyStatus = i_DRIVE_BUSY;
04728         }
04729     }
04730 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::SelectMediumVolumeMig ( rm_Medium a_med,
rm_MediumVol a_mv 
) [private]

Definition at line 4400 of file librmdb.exx.

References rm_Medium::barcode, rm_Medium::currentVolume, dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ivd_Error, log_DBG_m, log_FUNC_m, rm_MediumVol::mediumKey, rm_Medium::mediumKey, rm_MediumVol::medVolNr, NAME, rmdb_DATA_VOLUME, rmdb_MEDVOL_EMPTY, rmdb_MEDVOL_REORG_SCANNED, rmdb_MEDVOL_USED, rm_MediumVol::Select(), SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, rm_MediumVol::status, and rm_MediumVol::volType.

Referenced by SelectMediumForMig().

04400                                                                            {
04401     log_FUNC_m(SelectMediumVolumeMig);
04402 
04403     bool volFound(false);
04404     log_DBG_m(dbg_DETAIL, "a_med.mediumKey: " << a_med.mediumKey);
04405     a_mv.mediumKey = a_med.mediumKey;
04406 
04407     if (a_med.currentVolume > 0){
04408 
04409         log_DBG_m(dbg_DETAIL,"a_med.currentVolume: " << a_med.currentVolume);
04410 
04411         rm_MediumVol mv;
04412         mv.Select(a_med.mediumKey, a_med.currentVolume);
04413         log_DBG_m(dbg_DETAIL, "Selected: mv.status:" << mv.status << ", mv.volType:" << mv.volType );
04414         if (    (
04415                     (mv.status == rmdb_MEDVOL_EMPTY) ||
04416                     (mv.status == rmdb_MEDVOL_USED) ||
04417                     (mv.status == (rmdb_MEDVOL_USED | rmdb_MEDVOL_REORG_SCANNED))
04418                 )
04419                 &&
04420                 (mv.volType == rmdb_DATA_VOLUME)
04421            )
04422         {
04423             //current volume is usable
04424             log_DBG_m(dbg_DETAIL,"Current Volume is usable");
04425             a_mv.medVolNr = a_med.currentVolume;
04426             volFound = true;
04427         }
04428         else {
04429             log_DBG_m(dbg_NORM,"Current mediumVolume is not suitable for Migration.");
04430         }
04431     }
04432 
04433     if (!volFound) {
04434         UInt32_t mve = rmdb_MEDVOL_EMPTY;
04435         UInt32_t mvu(0);
04436         UInt32_t mvus(0);
04437         mvu = rmdb_MEDVOL_USED;
04438         mvus = rmdb_MEDVOL_USED | rmdb_MEDVOL_REORG_SCANNED;
04439         UInt32_t rdv = rmdb_DATA_VOLUME;
04440 
04441         //declare transaction
04442         EXEC SQL
04443             SET TRANSACTION NAME readTrans
04444                 READ ONLY
04445                 ISOLATION LEVEL READ COMMITTED;
04446 
04447         EXEC SQL
04448             DECLARE SEL_MEDVOL CURSOR FOR
04449                 SELECT MEDVOLNR FROM MEDIAVOL
04450                 WHERE
04451                     MEDIAKEY = :a_med.mediumKey
04452 
04453                     AND
04454                     (
04455                         (STATUS = :mve)
04456                         OR
04457                         (STATUS = :mvu)
04458                         OR
04459                         (STATUS = :mvus)
04460                     )
04461                     AND
04462                     (VOLTYPE = :rdv)
04463 
04464                 ORDER BY VOLUSED DESC;
04465 
04466         if (SQLCODE < SQL_NOERROR) {
04467             throw ivd_DBException(SQLCODE,"DECLARE SEL_MEDVOL CURSOR", true);
04468         }
04469 
04470         //open cursor
04471 
04472         EXEC SQL
04473             OPEN TRANSACTION readTrans
04474             SEL_MEDVOL;
04475 
04476         if (SQLCODE < SQL_NOERROR) {
04477             throw ivd_Error(SQLCODE,"EXEC SQL OPEN SEL_MEDVOL", true);
04478         }
04479 
04480         EXEC SQL
04481             FETCH SEL_MEDVOL INTO :a_mv.medVolNr;
04482 
04483         if (SQLCODE < SQL_NOERROR) {
04484             throw ivd_Error(SQLCODE,"EXEC SQL FETCH SEL_MEDVOL", true);
04485         }
04486 
04487         Int32_t fetchCode = SQLCODE;
04488 
04489         EXEC SQL
04490             CLOSE SEL_MEDVOL;
04491 
04492         log_DBG_m(dbg_DETAIL,"Closing SEL_MEDVOL: " << SQLCODE);
04493 
04494         string sqlErrDesc = errorDesc(SQLCODE, "Selecting usable volume");
04495         SQL_CHECKREAD_M( sqlErrDesc );
04496 
04497         if (fetchCode == SQL_NOERROR) {
04498             volFound = true;
04499         }
04500         else if (fetchCode == SQL_NOTFOUND) {
04501 
04502             log_DBG_m(dbg_LOW, "Medium (BC:" << a_med.barcode <<
04503                                 ") has no usable volumes for migration");
04504         }
04505     }
04506     if (volFound)
04507         a_mv.Select(a_mv.mediumKey, a_mv.medVolNr);
04508 
04509     return volFound;
04510 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::SelectMediumVolumeCol ( rm_Medium a_med,
UInt32_t a_volNum 
) [private]

Definition at line 4512 of file librmdb.exx.

References rm_Medium::currentVolume, dbg_DETAIL, dbg_NORM, errorDesc(), ivd_Error, log_DBG_m, log_FUNC_m, rm_Medium::mediumKey, NAME, rmdb_DATA_VOLUME, rmdb_MEDVOL_EMPTY, rm_MediumVol::Select(), SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, and rm_MediumVol::status.

Referenced by SelectMediumForMig().

04512                                                                            {
04513     log_FUNC_m(SelectMediumVolumeCol);
04514 
04515     bool volFound(false);
04516     log_DBG_m(dbg_DETAIL, "a_med.mediumKey: " << a_med.mediumKey);
04517 
04518     if (a_med.currentVolume > 0){
04519         log_DBG_m(dbg_DETAIL,"a_med.currentVolume: " << a_med.currentVolume);
04520         rm_MediumVol mv;
04521         mv.Select(a_med.mediumKey, a_med.currentVolume);
04522         if ( mv.status == rmdb_MEDVOL_EMPTY){
04523             //current volume is usable
04524             log_DBG_m(dbg_DETAIL,"Current Volume is usable");
04525             a_volNum = a_med.currentVolume;
04526             volFound = true;
04527         }
04528         else {
04529             log_DBG_m(dbg_NORM,"Current mediumVolume is not suitable for Migration.");
04530         }
04531     }
04532 
04533     if (!volFound) {
04534         UInt32_t mve = rmdb_MEDVOL_EMPTY;
04535         UInt32_t rdv = rmdb_DATA_VOLUME;
04536 
04537         //declare transaction
04538         EXEC SQL
04539             SET TRANSACTION NAME readTrans
04540                 READ ONLY
04541                 ISOLATION LEVEL READ COMMITTED;
04542 
04543         EXEC SQL
04544             DECLARE SEL_MEDVOLCOL CURSOR FOR
04545                 SELECT MEDVOLNR
04546                     FROM MEDIAVOL
04547                 WHERE
04548                     (MEDIAKEY = :a_med.mediumKey)
04549                     AND
04550                     (STATUS = :mve)
04551                     AND
04552                     (VOLTYPE = :rdv)
04553                 ORDER BY VOLSIZE ASC;
04554 
04555         if (SQLCODE < SQL_NOERROR) {
04556             throw ivd_DBException(SQLCODE,"DECLARE SEL_MEDVOLCOL CURSOR", true);
04557         }
04558 
04559         //open cursor
04560         EXEC SQL
04561             OPEN TRANSACTION readTrans
04562             SEL_MEDVOLCOL;
04563 
04564         if (SQLCODE < SQL_NOERROR) {
04565             throw ivd_Error(SQLCODE,"EXEC SQL OPEN SEL_MEDVOLCOL", true);
04566         }
04567         log_DBG_m(dbg_NORM,"SEL_MEDVOLCOL ready.");
04568 
04569         while (true) {
04570             UInt32_t volNum(0);
04571             EXEC SQL
04572                 FETCH SEL_MEDVOLCOL INTO :volNum;
04573             log_DBG_m(dbg_NORM, "SQLCODE: " << SQLCODE );
04574 
04575             if (SQLCODE == SQL_NOERROR){
04576                 a_volNum = volNum;
04577                 log_DBG_m(dbg_NORM,"a_volNum: " << a_volNum);
04578                 volFound = true;
04579                 break;
04580             }
04581 
04582             if (SQLCODE == SQL_NOTFOUND){
04583                 log_DBG_m(dbg_NORM,"volNum not found.");
04584                 volFound = false;
04585                 break;
04586             }
04587 
04588             if (SQLCODE < SQL_NOERROR) {
04589                 throw ivd_Error(SQLCODE,"EXEC SQL FETCH SEL_MEDVOLCOL", true);
04590             }
04591 
04592         }
04593 
04594         EXEC SQL
04595             CLOSE SEL_MEDVOLCOL;
04596 
04597         log_DBG_m(dbg_DETAIL, "Closing SEL_MEDVOLCOL: " << SQLCODE);
04598 
04599         string sqlErrDesc = errorDesc(SQLCODE, "Selecting usable volume");
04600         SQL_CHECKREAD_M( sqlErrDesc );
04601     }
04602 
04603     return volFound;
04604 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::SelectOpenedVolume ( rm_Resource_t a_resource,
vector< rm_ColAlloc > &  a_colAlloc 
) [private]

Definition at line 3942 of file rm_operator.cpp.

References API_FLAG_EXCLUSIVE, rm_Medium::barcode, rm_Resource_t::barcode, rm_Medium::blockSize, rm_Resource_t::blockSize, dbg_DETAIL, rm_Medium::driveKey, rm_Resource_t::driveKey, i_DRIVE_NOT_AVAILABLE, i_MEDIUM_BUSY, log_DBG_m, log_FUNC_m, rm_Resource_t::mediumFamily, rm_Resource_t::mediumKey, rm_ColAlloc::mediumKey, rm_Medium::mediumType, rm_ColAlloc::medStatus, rm_MediumVol::medVolId, rm_Resource_t::medVolId, rm_Resource_t::medVolNr, rm_ColAlloc::medVolNr, mf_DISK, rm_ColAlloc::minFlags, rm_Resource_t::minFlags, mt_DISK, rm_Resource_t::resourceBusyStatus, rmdb_MEDIUM_FULL, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, rmdb_MEDVOL_ERROR, rmdb_MEDVOL_FULL, rmdb_MEDVOL_REORG_INREORG, rmdb_MEDVOL_REORG_RECYCLED, SelectDriveForMig(), UpdateCollocation(), and rm_ColAlloc::volStatus.

Referenced by AllocateMigCollocation().

03942                                                                                                {
03943     log_FUNC_m(SelectOpenedVolume);
03944 
03945     if ( (a_resource.minFlags & API_FLAG_EXCLUSIVE) == API_FLAG_EXCLUSIVE) {
03946         //exclusive, can not allocate new volume
03947         log_DBG_m(dbg_DETAIL, "Api flag is exclusive, volume can not be used");
03948         return false;
03949     }
03950     else {
03951         //allocate existing
03952         //size is exceeded or medium is in use
03953         //take last volume from colAlloc (most space)
03954 
03955         // start from the back (most volume space)
03956         vector<rm_ColAlloc>::reverse_iterator iter;
03957         for (iter = a_colAlloc.rbegin(); iter != a_colAlloc.rend(); ++iter) {
03958             rm_ColAlloc &ca2 = (*iter);
03959             log_DBG_m(dbg_DETAIL, "volNum: " << ca2.medVolNr);
03960             if ((ca2.medStatus & (rmdb_MEDIUM_UNUSABLE | rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_FULL ))
03961                 ||
03962                 (ca2.volStatus & (rmdb_MEDVOL_FULL | rmdb_MEDVOL_REORG_RECYCLED | rmdb_MEDVOL_ERROR | rmdb_MEDVOL_REORG_INREORG))) {
03963                 //skip it
03964                 log_DBG_m(dbg_DETAIL, "Volume can not be used:" <<
03965                                        ca2.mediumKey <<
03966                                        ", " << ca2.medVolNr);
03967             }
03968             else if (ca2.medStatus & (rmdb_MEDIUM_IN_USE) ) {
03969                 //skip it
03970                 log_DBG_m(dbg_DETAIL, "Medium is in use, volume can not be used:" <<
03971                                        ca2.mediumKey <<
03972                                        ", " << ca2.medVolNr);
03973                 a_resource.resourceBusyStatus = i_MEDIUM_BUSY;
03974             }
03975             else if (ca2.minFlags & API_FLAG_EXCLUSIVE) {
03976                 //skip it
03977                 log_DBG_m(dbg_DETAIL, "Target volume is exlusive and can not be used:" <<
03978                                        ca2.mediumKey <<
03979                                        ", " << ca2.medVolNr);
03980             }
03981             else {
03982                 log_DBG_m(dbg_DETAIL, "Volume will be used: " << ca2.mediumKey <<
03983                                         ", "  <<  ca2.medVolNr);
03984                 a_resource.mediumKey = ca2.mediumKey;
03985                 a_resource.medVolNr = ca2.medVolNr;
03986                 rm_MediumVol mv(ca2.mediumKey, ca2.medVolNr);
03987                 a_resource.medVolId = mv.medVolId;
03988                 rm_Medium m(ca2.mediumKey);
03989                 a_resource.barcode    = m.barcode;
03990                 a_resource.blockSize  = m.blockSize;
03991                 a_resource.driveKey  = m.driveKey;
03992 
03993                 if (m.mediumType == mt_DISK){
03994                     a_resource.mediumFamily = mf_DISK;
03995                 }
03996                 else {
03997                     //medium can be used, now search for drive
03998                     bool foundRes = SelectDriveForMig(a_resource);
03999                     if (foundRes == false){
04000                         log_DBG_m(dbg_DETAIL, "Did not find drive.");
04001                         a_resource.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
04002                         return false;
04003                     }
04004                 }
04005 
04006                 UpdateCollocation(a_resource);
04007                 return true;
04008             }
04009         }
04010     }
04011     return false;
04012 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::CheckMediumFull ( UInt32_t  a_mediumKey  )  [private]

Definition at line 4295 of file librmdb.exx.

References dbg_DETAIL, dbg_LOW, log_DBG_m, log_FUNC_m, rmdb_MEDVOL_FULL, rmdb_SYSTEM_VOLUME, and rm_MediumVol::SelectByMedium().

Referenced by SelectMediumForMig().

04295                                                      {
04296     log_FUNC_m(CheckMediumFull);
04297     vector<rm_MediumVol> mvv;
04298     rm_MediumVol mv;
04299     mvv = mv.SelectByMedium(a_mediumKey);
04300 
04301     for (UInt32_t i(0); i < mvv.size(); ++i) {
04302 
04303         if  ( (mvv[i].volType != rmdb_SYSTEM_VOLUME) &&
04304              !(mvv[i].status & rmdb_MEDVOL_FULL)) {
04305                 log_DBG_m(dbg_DETAIL,"Medium still has free volumes. MediumKey:" << a_mediumKey <<
04306                                   " volNum:" << mvv[i].medVolNr);
04307                 return false;
04308             }
04309     }
04310     log_DBG_m(dbg_LOW,"Medium Full or uninitialized. MediumKey:" << a_mediumKey);
04311     return true;
04312 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::AllocateAdmin ( rm_ResourceTable_t a_resourceTable  )  [private]

Definition at line 4478 of file rm_operator.cpp.

References rm_Medium::barcode, rm_MediaPool::blockSize, dbg_DETAIL, dbg_LOW, dbg_NORM, dc_WORM, rm_Drive::driveIndex, rm_Drive::driveKey, rm_Medium::driveKey, rm_Drive::driveName, evt_WARNING, ivd_BaseException::GetError(), rm_Library::host, i_DRIVE_BUSY, i_DRIVE_NOT_AVAILABLE, i_LIBRARY_NOT_AVAILABLE, i_MEDIUM_BUSY, i_MEDIUM_NOT_AVAILABLE, ie_RMDB_NOTFOUND, IsDriveWORM(), IsMediumWORM(), ivd_Error, rm_Drive::libraryKey, rm_Medium::libraryKey, rm_Library::libraryName, log_DBG_m, log_FUNC_m, log_WriteEvent(), rm_Library::mediaFamily, rm_MediaPool::mediaFamily, rm_Medium::mediaPoolKey, rm_Medium::mediumKey, rm_Resource_t::mediumKey, rm_Medium::mediumType, mt_DISK, rm_MediaPool::poolUUIDString, pt_WORM, rm_Resource_t::resourceBusyStatus, RM_ALLOC_FAILUE, rm_CATCH_DB_THROW_IVD_m, rmdb_DRIVE_IN_USE, rmdb_INIT_LIBRARY_STATUS, rmdb_MEDIUM_IN_USE, rm_Slot::Select(), rm_MediaPool::Select(), rm_Drive::Select(), rm_Library::Select(), rm_Medium::Select(), rm_Medium::SelectByDrive(), rm_Drive::SelectForOperation(), rm_Slot::slotAddr, rm_Medium::slotKey, SQL_NOTFOUND, rm_Drive::status, rm_Library::status, rm_Medium::status, rm_Drive::Update(), and rm_Medium::Update().

Referenced by dbo_AllocateAdmin::Process().

04478                                                                   {
04479     log_FUNC_m(AllocateAdmin);
04480 
04481     try {
04482 
04483         rm_Medium m;
04484         rm_MediumVol mv;
04485         rm_Drive d;
04486 
04487         vector<rm_Drive> selDrive;
04488 
04489         if (a_resourceTable.empty() || (a_resourceTable.size() > 1)){
04490             throw ivd_InternalError(RM_ALLOC_FAILUE, "AllocateAdmin was called with empty or multiple row");
04491         }
04492         rm_Library lib;
04493 
04494         rm_Resource_t &res = a_resourceTable[0];
04495 
04496         if (res.mediumKey == 0) {
04497             //if pool is  backup
04498             //then search for a medium from this pool
04499 
04500 
04501             //else
04502             throw ivd_InternalError(RM_ALLOC_FAILUE, "AllocateAdmin called with mediumKey=0");
04503         }
04504 
04505         m.Select(res.mediumKey);
04506 
04507         if ((m.status &  rmdb_MEDIUM_IN_USE) != 0)  {
04508             log_DBG_m(dbg_LOW,"Medium in use. Can not allocate resources.");
04509             res.resourceBusyStatus = i_MEDIUM_BUSY;
04510             return;
04511         }
04512 
04513         if (m.mediumType == mt_DISK){
04514             //do nothing
04515         } else if (m.libraryKey > 0){
04516             lib.Select(m.libraryKey);
04517 
04518             log_DBG_m(dbg_NORM, "Medium requested for Admin Job" << endl <<
04519                 "Medium: " << m.barcode << "\tStatus: " << m.status << endl <<
04520                 "DriveKey: " << m.driveKey << "\tLibKey: " << m.libraryKey <<
04521                 "\tSlotKey: " << m.slotKey);
04522 
04523             if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
04524                 log_DBG_m(dbg_LOW,"Library disabled or Error. Can not allocate resources.");
04525                 res.resourceBusyStatus = i_LIBRARY_NOT_AVAILABLE;
04526                 return;
04527             }
04528 
04529         } else {
04530             ostringstream sstr;
04531             sstr << "Medium (BC:" << m.barcode << ") location unknown."
04532                     " Run library inventory to identify medium location.";
04533 
04534             log_WriteEvent( evt_WARNING,
04535                 sstr.str(),
04536                 m.barcode);
04537 
04538             res.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
04539         }
04540         rm_Drive selectedDrive;
04541         rm_Medium med;
04542         if (m.mediumType == mt_DISK){
04543             log_DBG_m(dbg_LOW,"Disk medium no need for a drive.");
04544         }
04545         else {
04546             if (m.driveKey > 0) {       //medium is in drive
04547                 log_DBG_m(dbg_DETAIL,"Medium is in drive - selecting");
04548                 log_DBG_m(dbg_DETAIL,"IsMediumWORM(m)" << IsMediumWORM(m));
04549                 d.Select(m.driveKey);   //select that drive
04550                 log_DBG_m(dbg_DETAIL,"IsDriveWORM(d)" << IsDriveWORM(d));
04551 
04552                 if ( !(a_resourceTable[0].poolType == pt_WORM) || IsDriveWORM(d) ) {
04553 
04554                     log_DBG_m(dbg_NORM, "Requested medium in drive" << endl <<
04555                         "DriveName: " << d.driveName << "\tStatus: " << d.status);
04556                     if ( d.status == 0 ) {
04557                         selDrive.push_back(d);
04558                     }
04559                 } else {
04560                     log_DBG_m(dbg_LOW,"Medium is inserted into non WORM drive");
04561                     //continue with allocation
04562                 }
04563             }// if (m.driveKey > 0)
04564 
04565             UInt32_t reqCapability(0);
04566             if (IsMediumWORM(m) || (a_resourceTable[0].poolType == pt_WORM)) {
04567                 reqCapability |= dc_WORM;
04568             }
04569             if (a_resourceTable[0].driveKey == 0){
04570                 if ((m.driveKey < 1) ||
04571                     ((m.driveKey > 0) && ((d.status & rmdb_DRIVE_IN_USE) != 0 )))
04572                 {
04573 
04574                     rm_MediaPool pool;
04575                     if (m.mediaPoolKey > 0) {
04576                         pool.Select(m.mediaPoolKey);
04577 
04578                         selDrive = d.SelectForOperation(
04579                                             m.libraryKey,
04580                                             pool.mediaFamily,
04581                                             reqCapability,
04582                                             false);
04583                     } else {
04584                         selDrive = d.SelectForOperation(
04585                                             m.libraryKey,
04586                                             lib.mediaFamily,
04587                                             reqCapability,
04588                                             false);
04589 
04590                     }
04591                 }
04592 
04593                 if (selDrive.size() == 0) {
04594                     log_DBG_m(dbg_NORM,"No drive available for admin job " );
04595                     //Check if there are drives that are in use
04596                     selDrive = d.SelectForOperation(
04597                                             m.libraryKey,
04598                                             lib.mediaFamily,
04599                                             reqCapability,
04600                                             true);
04601 
04602                     if (selDrive.size() == 0){
04603                         a_resourceTable[0].resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
04604                     } else {
04605                         a_resourceTable[0].resourceBusyStatus = i_DRIVE_BUSY;
04606                     }
04607                     a_resourceTable[0].driveKey = 0;
04608 
04609                     return;
04610                 };
04611             } // if (a_resourceTable[0].driveKey == 0)
04612             else {
04613                 // no need to allocate drive
04614                 log_DBG_m(dbg_DETAIL,"Resource request for medium only");
04615                 rm_Drive d(a_resourceTable[0].driveKey);
04616                 selDrive.push_back(d);
04617             } //else
04618 
04619             if (selDrive.size() == 0 ) {
04620                 throw ivd_Error(ie_RMDB_NOTFOUND, "Could not find drive for admin job");
04621             }
04622             selectedDrive.Select(selDrive[0].driveKey);
04623             for(UInt32_t i = 0; i < selDrive.size(); i++){
04624                 try {
04625                     med.SelectByDrive(selDrive[i].driveKey);
04626                 } catch (...){
04627                     //if there is no medium in drive select it
04628                     selectedDrive = selDrive[i];
04629                     break;
04630                 }
04631             } //for(UInt32_t i = 0; i < selDrive.size(); i++)
04632         }//else if (m.mediumType == mt_DISK){
04633 
04634         log_DBG_m(dbg_DETAIL,   "Table of Allocated Resources:"  );
04635         log_DBG_m(dbg_DETAIL,   "------------------------------------------------------------------------"  );
04636 
04637         UInt32_t takeMe(0);
04638 
04639         m.status = m.status | rmdb_MEDIUM_IN_USE;
04640         m.Update();
04641         a_resourceTable[takeMe].mediumKey = m.mediumKey;
04642         a_resourceTable[takeMe].barcode   = m.barcode;
04643         if (m.mediumType == mt_DISK){
04644             log_DBG_m(dbg_LOW,"Disk medium no need for a drive.");
04645         } else {
04646             selectedDrive.status = selectedDrive.status | rmdb_DRIVE_IN_USE;
04647             selectedDrive.Update();
04648             if (selectedDrive.libraryKey > 0) {
04649                 rm_Library selLib;
04650                 selLib.Select(selectedDrive.libraryKey);
04651                 a_resourceTable[takeMe].libraryName = selLib.libraryName;
04652                 a_resourceTable[takeMe].libraryHost = selLib.host;
04653 
04654                 if (m.slotKey > 0) { // if in slot ok select it
04655                     rm_Slot selSlot;
04656                     selSlot.Select(m.slotKey, m.libraryKey);
04657                     a_resourceTable[0].loadSlotAddr = selSlot.slotAddr;
04658                 } else {
04659                     a_resourceTable[0].loadSlotAddr = "";
04660                     log_DBG_m( dbg_LOW,  "Selected Medium: " << m.barcode <<
04661                         "  for admin without SlotKey. Assuming Manual Robot");
04662                 }
04663             }
04664             if (m.driveKey != selectedDrive.driveKey){
04665                 a_resourceTable[takeMe].load = true;
04666                 rm_Medium unloadMedium;
04667                 try {
04668                     unloadMedium.SelectByDrive(selectedDrive.driveKey);
04669                 } catch ( ivd_DBException& e) {
04670                     if (e.GetError() == SQL_NOTFOUND) {
04671                         unloadMedium.mediumKey = 0;
04672                     } else
04673                         throw;
04674                 }
04675                 if (unloadMedium.mediumKey > 0){ // a medium is in the drive that should be unloaded
04676                     unloadMedium.status = unloadMedium.status | rmdb_MEDIUM_IN_USE;
04677                     unloadMedium.Update();
04678                     a_resourceTable[0].unloadBarcode = unloadMedium.barcode;
04679                     if (unloadMedium.slotKey > 0) { // if in slot ok select it
04680                         rm_Slot selSlot;
04681                         selSlot.Select(unloadMedium.slotKey, unloadMedium.libraryKey);
04682                         a_resourceTable[0].unloadSlotAddr = selSlot.slotAddr;
04683                     } //if  unloadMedium.slotKey > 0
04684                 }//if (unloadMedium.mediumKey > 0)
04685             } //if (m.driveKey != selectedDrive.driveKey)
04686             if (selectedDrive.driveKey > 0) {
04687                 a_resourceTable[takeMe].driveKey = selectedDrive.driveKey;
04688                 a_resourceTable[takeMe].driveCtrlDevice = "";
04689                 a_resourceTable[takeMe].driveIndex = selectedDrive.driveIndex;
04690             }
04691         }
04692 
04693         a_resourceTable[takeMe].resAllocated = true;
04694         if (m.mediaPoolKey > 0) {
04695             rm_MediaPool mp;
04696             mp.Select(m.mediaPoolKey);
04697             a_resourceTable[takeMe].poolUUID = mp.poolUUIDString;
04698             a_resourceTable[takeMe].blockSize   = mp.blockSize;
04699         }
04700     } rm_CATCH_DB_THROW_IVD_m;
04701 
04702     log_DBG_m(dbg_DETAIL,   "  MediumKey:" << a_resourceTable[0].mediumKey <<
04703                             "  DriveKey:" << a_resourceTable[0].driveKey);
04704 
04705     log_DBG_m(dbg_DETAIL,   "------------------------------------------------------------------------"  );
04706 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::ReleaseResources ( const i_ResourceList_t a_resources,
const ivd_JobType_e  a_jobType 
) [private]

Definition at line 860 of file rm_operator.cpp.

References rm_MediumVol::accessNr, rm_MediumVol::accessTime, rm_Medium::barcode, rm_Medium::currentVolume, dbg_DETAIL, ie_NYI, ivd_Error, jt_MAINT, jt_MIGRATION, jt_REORG, log_DBG_m, log_ERR_m, log_FUNC_m, rm_Medium::mediumKey, NULL, rmdb_DRIVE_IN_USE, rmdb_MEDIUM_IN_USE, rmdb_MEDVOL_REORG_SCANNED, rm_MediumVol::status, rm_Medium::status, rm_Drive::status, rm_Medium::Update(), rm_MediumVol::Update(), rm_Drive::Update(), rm_Drive::usageCount, rm_MediumVol::writeNr, and rm_MediumVol::writeTime.

Referenced by dbo_ReleaseResources::Process().

00861                                                                   {
00862     log_FUNC_m(ReleaseResources);
00863 
00864     for (UInt32_t i = 0; i < a_resources.length(); i++) {
00865             if ( a_resources[i].driveKey != 0) {
00866                 log_DBG_m(dbg_DETAIL,
00867                     "setting status for Drive: " <<
00868                     a_resources[i].driveKey <<
00869                     " to: free");
00870                 rm_Drive d(a_resources[i].driveKey);
00871                 d.status = d.status & ~(rmdb_DRIVE_IN_USE);
00872                 //increase usage counter
00873                 d.usageCount++;
00874                 d.Update();
00875             }
00876             if ( a_resources[i].mediumKey != 0) {
00877                 log_DBG_m(dbg_DETAIL,
00878                     "setting status for Medium: " <<
00879                     a_resources[i].mediumKey <<
00880                     " to: free");
00881                 rm_Medium m(a_resources[i].mediumKey);
00882                 m.status = m.status & ~(rmdb_MEDIUM_IN_USE);
00883                 if ((a_resources[i].medVolNr > 0) &&
00884                     ((a_jobType == jt_MIGRATION) ||
00885                     (a_jobType == jt_MAINT && a_resources[i].resNum == 1) ||
00886                     (a_jobType == jt_REORG && a_resources[i].resNum == 1))) {
00887                     try {
00888                         rm_MediumVol mv(m.mediumKey, a_resources[i].medVolNr);
00889                         m.currentVolume = static_cast<Int16_t>(a_resources[i].medVolNr);
00890                         mv.status = mv.status & ~rmdb_MEDVOL_REORG_SCANNED;
00891                         mv.Update();
00892 
00893                     } catch (ivd_DBException& dbe){
00894                         ostringstream msg;
00895                         msg << "Non-Fatal Exception while releasing resources." <<
00896                             endl << "Medium: " << m.barcode <<
00897                             " was released with current Volume: " <<
00898                             a_resources[i].medVolNr <<
00899                            ". This volume does not exist!" << endl << dbe;
00900 
00901                         log_ERR_m(msg.str());
00902                     }
00903                 }
00904                 m.Update();
00905             }
00906             if ( a_resources[i].medVolNr != 0) {
00907                 log_DBG_m(dbg_DETAIL,
00908                     "setting status for MedVolume: " <<
00909                     a_resources[i].medVolNr );
00910 
00911                 rm_MediumVol mv(a_resources[i].mediumKey, a_resources[i].medVolNr);
00912                 mv.accessNr++;
00913                 mv.accessTime = time(NULL);
00914                 if (a_resources[i].fileId == 0) {
00915                     mv.writeNr++;
00916                     mv.writeTime = time(NULL);
00917                 }
00918 
00919                 mv.Update();
00920             }
00921             if ( a_resources[i].dssKey != 0) {
00922                 log_DBG_m(dbg_DETAIL,
00923                     "Setting status for DSS: " <<
00924                     a_resources[i].dssKey <<
00925                     " to: free");
00926                 throw ivd_Error(ie_NYI, "DSS is not yet implemented");
00927             }
00928         };
00929 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_PartSeq_t rm_Operator::SelectAllPart (  )  [private]

Definition at line 3438 of file rm_operator.cpp.

References rm_String::cvalue_p, rm_Partition::fsHost, i_Partition_t::fsHost, rm_Partition::fsID, i_Partition_t::fsID, rm_Partition::fsMountpoint, i_Partition_t::fsMountpoint, ivd_BaseException::GetError(), log_FUNC_m, rm_Partition::migIdCount, i_Partition_t::migIdCount, rm_Partition::migIdTime, i_Partition_t::migIdTime, rm_Partition::Next(), rm_Partition::options, i_Partition_t::options, rm_Partition::partitionName, i_Partition_t::partitionName, rm_Partition::partitionUUIDString, i_Partition_t::partitionUUIDString, rm_CATCH_DB_THROW_IVD_m, SQL_NOTFOUND, rm_Partition::StartSelectAll(), rm_Partition::status, and i_Partition_t::status.

Referenced by dbo_SelectAllPartition::Process().

03438                                        {
03439     log_FUNC_m(SelectAllPart);
03440 
03441     i_PartSeq_t iPartSeq;
03442     try {
03443 
03444         iPartSeq.length(0);
03445         i_Partition_t iPart;
03446         rm_Partition part;
03447 
03448         part.StartSelectAll();
03449 
03450         bool last = false;
03451 
03452         while (!last) {
03453             try {
03454                 part.Next();
03455 
03456                 iPart.migIdCount = part.migIdCount;
03457                 iPart.migIdTime = part.migIdTime;
03458                 iPart.partitionName = CORBA::string_dup(part.partitionName.cvalue_p);
03459                 iPart.partitionUUIDString = CORBA::string_dup(part.partitionUUIDString.cvalue_p);
03460                 iPart.status = part.status;
03461                 iPart.options = part.options;
03462                 iPart.fsHost = CORBA::string_dup(part.fsHost.cvalue_p);
03463                 iPart.fsMountpoint = CORBA::string_dup(part.fsMountpoint.cvalue_p);
03464                 iPart.fsID = CORBA::string_dup(part.fsID.cvalue_p);
03465 
03466 
03467                 iPartSeq.length( iPartSeq.length() + 1 );
03468                 iPartSeq[iPartSeq.length() - 1] = iPart;
03469 
03470             } catch (ivd_DBException& e) {
03471                 if (e.GetError() == SQL_NOTFOUND) {
03472                     last = true;
03473                 } else throw;
03474             }
03475         }
03476     } rm_CATCH_DB_THROW_IVD_m;
03477     return iPartSeq;
03478 
03479 }

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Partition rm_Operator::SelectPartition ( rm_String  a_partName  )  [private]

Definition at line 3591 of file rm_operator.cpp.

References rm_CATCH_DB_THROW_IVD_m, and rm_Partition::SelectByName().

Referenced by dbo_ClearPartitionStatus::Process(), dbo_SetPartitionStatus::Process(), dbo_EnablePartition::Process(), dbo_DisablePartition::Process(), and dbo_SelectPartition::Process().

03591                                                               {
03592     try {
03593         rm_Partition part;
03594         part.SelectByName(a_partName);
03595         return part;
03596     } rm_CATCH_DB_THROW_IVD_m;
03597 }

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Partition rm_Operator::SelectPartitionByUuid ( rm_String  a_partUuid  )  [private]

Definition at line 3599 of file rm_operator.cpp.

References rm_CATCH_DB_THROW_IVD_m, and rm_Partition::SelectByUuid().

Referenced by dbo_SelectPartitionByUuid::Process().

03599                                                                     {
03600     try {
03601         rm_Partition part;
03602         part.SelectByUuid(a_partUuid);
03603         return part;
03604     } rm_CATCH_DB_THROW_IVD_m;
03605 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::UpdatePartition ( rm_Partition  a_part  )  [private]

Definition at line 3614 of file rm_operator.cpp.

References rm_CATCH_DB_THROW_IVD_m, and rm_Partition::Update().

Referenced by dbo_ClearPartitionStatus::Process(), dbo_SetPartitionStatus::Process(), dbo_EnablePartition::Process(), dbo_DisablePartition::Process(), and dbo_UpdatePartition::Process().

03614                                                      {
03615     try {
03616         a_part.Update();
03617     } rm_CATCH_DB_THROW_IVD_m;
03618 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InsertPartition ( rm_Partition  a_part  )  [private]

Definition at line 3607 of file rm_operator.cpp.

References rm_Partition::Insert(), and rm_CATCH_DB_THROW_IVD_m.

Referenced by dbo_InsertPartition::Process().

03607                                                      {
03608     try {
03609         a_part.Insert();
03610     } rm_CATCH_DB_THROW_IVD_m;
03611 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::RemovePartition ( rm_String  a_partName  )  [private]

Definition at line 3620 of file rm_operator.cpp.

References rm_Partition::Remove(), and rm_CATCH_DB_THROW_IVD_m.

Referenced by dbo_RemovePartition::Process().

03620                                                       {
03621     try {
03622         rm_Partition part;
03623         part.Remove(a_partName);
03624     } rm_CATCH_DB_THROW_IVD_m;
03625 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::PoolInfo ( rm_String a_partitionName,
i_PoolInfoSeq_t a_poolInfo 
) [private]

Definition at line 5173 of file librmdb.exx.

References rm_String::cvalue_p, dbg_DETAIL, errorDesc(), log_DBG_m, log_FUNC_A_m, NAME, rmdb_DATA_VOLUME, rmdb_MAX_MEDIAPOOLNAME, rmdb_MEDIUM_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, rmdb_MEDVOL_FULL, rmdb_SYSTEM_VOLUME, size, and SQL_CHECKREAD_M.

Referenced by dbo_PoolInfo::Process().

05173                                                                                   {
05174     log_FUNC_A_m(PoolInfo, "Partition:" << a_partitionName);
05175 
05176     // This function fills all fields within struct i_PoolInfo_t directly from rmdb base
05177 
05178     EXEC SQL
05179         SET TRANSACTION NAME readTrans;
05180 
05181     EXEC SQL
05182         DECLARE POOLINFO CURSOR FOR
05183             SELECT
05184                 MEDIAPOOL.MEDIAPOOLNAME, MEDIAPOOL.MEDIAPOOLKEY
05185             FROM
05186                 MEDIAPOOL, PARTITION
05187             WHERE
05188                 MEDIAPOOL.PARTITIONUUID = PARTITION.PARTUUID AND
05189                 PARTITION.PARTNAME = :a_partitionName.cvalue_p
05190             ORDER BY MEDIAPOOL.MEDIAPOOLNAME;
05191 
05192     EXEC SQL
05193         OPEN TRANSACTION readTrans POOLINFO;
05194 
05195     vector<Int32_t> keys;
05196     while (1) {     // get all pool names and its keys that belong to some partition
05197 
05198         char poolNameVal[rmdb_MAX_MEDIAPOOLNAME];
05199         Int32_t poolKey;
05200 
05201         EXEC SQL
05202             FETCH
05203             POOLINFO INTO
05204                 :poolNameVal,
05205                 :poolKey;
05206 
05207         log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on POOLINFO: " << SQLCODE);
05208         if (SQLCODE != 0) break;
05209 
05210         log_DBG_m(dbg_DETAIL,"poolName:" << poolNameVal <<
05211                             " poolKey:" << poolKey );
05212 
05213         Int32_t size = a_poolInfo.length();
05214         a_poolInfo.length(size+1);
05215         a_poolInfo[size].poolName = CORBA::string_dup(poolNameVal);
05216         keys.push_back(poolKey);
05217     } // while end
05218 
05219     EXEC SQL
05220         CLOSE POOLINFO;
05221 
05222     string sqlErrDesc = errorDesc(SQLCODE,"CLOSE POOLINFO");
05223     SQL_CHECKREAD_M(sqlErrDesc);
05224 
05225     // for all pool keys that are found, execute different sql queries
05226     // and get correct numbers for media, media volumes and their statuses
05227 
05228     for (UInt32_t i = 0; i < keys.size(); ++i) {
05229 
05230         UInt32_t mediumUnreliableUnusable (rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_UNUSABLE);
05231         UInt32_t mediumUnusable (rmdb_MEDIUM_UNUSABLE);
05232         UInt32_t mediumUnreliable (rmdb_MEDIUM_UNRELIABLE);
05233         UInt32_t mediumVolFull (rmdb_MEDVOL_FULL);
05234         UInt32_t systemVolume (rmdb_SYSTEM_VOLUME);
05235         UInt32_t dataVolume (rmdb_DATA_VOLUME);
05236         Int32_t currentKey = keys[i];
05237 
05238 
05239         // Execute SELECT query for good sys volumes and return sysSize & sysAvailable
05240         // Do not perform calculation for media that are unusable or unreliable
05241 
05242         Int32_t sysSize(0);
05243         Int32_t sysAvailable(0);
05244 
05245         EXEC SQL
05246             SET TRANSACTION NAME readTrans;
05247 
05248         EXEC SQL
05249             DECLARE MEDIA_SYS_SIZES CURSOR FOR
05250 
05251             SELECT
05252                 SUM(MEDIAVOL.VOLSIZE), SUM(MEDIAVOL.VOLSIZE - (MEDIAVOL.VOLSIZE * MEDIAVOL.VOLUSED /100 ))
05253             FROM
05254                 MEDIA, MEDIAVOL
05255             WHERE
05256                 MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY   AND
05257                 MEDIA.MEDIAPOOLKEY = :currentKey      AND
05258                 bin_and(MEDIA.STATUS, :mediumUnreliableUnusable) = 0 AND
05259                 MEDIAVOL.VOLTYPE = :systemVolume;
05260 
05261         EXEC SQL
05262             OPEN TRANSACTION readTrans MEDIA_SYS_SIZES;
05263 
05264         EXEC SQL
05265             FETCH MEDIA_SYS_SIZES INTO
05266 
05267                 :sysSize,
05268                 :sysAvailable;
05269 
05270         EXEC SQL
05271             CLOSE MEDIA_SYS_SIZES;
05272 
05273         sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_SYS_SIZES", currentKey);
05274         SQL_CHECKREAD_M( sqlErrDesc );
05275 
05276         a_poolInfo[i].sysSize = sysSize;
05277         a_poolInfo[i].sysAvailable = sysAvailable;
05278 
05279 
05280         // Execute SELECT query for good data volumes and return dataSize, even if media is full
05281         // Do not perform calculation for media that are unusable or unreliable
05282 
05283         Int32_t dataSize(0);
05284         {
05285             EXEC SQL
05286                 SET TRANSACTION NAME readTrans;
05287 
05288             EXEC SQL
05289                 DECLARE MEDIA_DATA_SIZES CURSOR FOR
05290 
05291                 SELECT
05292                     SUM(MEDIAVOL.VOLSIZE)
05293                 FROM
05294                     MEDIA, MEDIAVOL
05295                 WHERE
05296                     MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY   AND
05297                     MEDIA.MEDIAPOOLKEY = :currentKey      AND
05298                     bin_and(MEDIA.STATUS, :mediumUnreliableUnusable) = 0 AND
05299                     MEDIAVOL.VOLTYPE = :dataVolume;
05300 
05301             EXEC SQL
05302                 OPEN TRANSACTION readTrans MEDIA_DATA_SIZES;
05303 
05304             EXEC SQL
05305                 FETCH
05306                 MEDIA_DATA_SIZES INTO
05307 
05308                     :dataSize
05309 
05310             EXEC SQL
05311                 CLOSE MEDIA_DATA_SIZES;
05312 
05313             sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_DATA_SIZES", currentKey);
05314             SQL_CHECKREAD_M( sqlErrDesc );
05315 
05316             a_poolInfo[i].dataSize = dataSize;
05317         }
05318 
05319         // Execute SELECT query for good data volumes and return dataAvailable
05320         // Do not perform calculation for media that are unusable or unreliable
05321         // Do not calculate available space when media is full
05322 
05323         Int32_t dataAvailable(0);
05324         {
05325             EXEC SQL
05326                 SET TRANSACTION NAME readTrans;
05327 
05328             EXEC SQL
05329                 DECLARE MEDIA_DATA_AVAIL CURSOR FOR
05330 
05331                 SELECT
05332                     SUM(MEDIAVOL.VOLSIZE - (MEDIAVOL.VOLSIZE * MEDIAVOL.VOLUSED /100 ))
05333                 FROM
05334                     MEDIA, MEDIAVOL
05335                 WHERE
05336                     MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY   AND
05337                     MEDIA.MEDIAPOOLKEY = :currentKey      AND
05338                     bin_and(MEDIA.STATUS, :mediumUnreliableUnusable) = 0 AND
05339                     bin_and(MEDIAVOL.STATUS, :mediumVolFull) = 0 AND
05340                     MEDIAVOL.VOLTYPE = :dataVolume;
05341 
05342             EXEC SQL
05343             OPEN TRANSACTION readTrans MEDIA_DATA_AVAIL;
05344 
05345             EXEC SQL
05346                 FETCH MEDIA_DATA_AVAIL INTO
05347                     :dataAvailable
05348 
05349             EXEC SQL
05350                 CLOSE MEDIA_DATA_AVAIL;
05351 
05352             sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_DATA_AVAIL", currentKey);
05353             SQL_CHECKREAD_M( sqlErrDesc );
05354 
05355             a_poolInfo[i].dataAvailable = dataAvailable;
05356         }
05357 
05358 
05359         // Execute SELECT query and return the number of unusable media that belong to one pool
05360         {
05361             Int32_t mediaUnusable(0);
05362 
05363             EXEC SQL
05364                 SET TRANSACTION NAME readTrans;
05365 
05366             EXEC SQL
05367                 DECLARE MEDIA_UNUSABLE CURSOR FOR
05368 
05369                 SELECT
05370                     COUNT (*)
05371                 FROM
05372                     MEDIA
05373                 WHERE
05374                     MEDIA.MEDIAPOOLKEY = :currentKey      AND
05375                     bin_and(MEDIA.STATUS, :mediumUnusable) != 0;
05376 
05377             EXEC SQL
05378                 OPEN TRANSACTION readTrans MEDIA_UNUSABLE;
05379 
05380             EXEC SQL
05381                 FETCH
05382                 MEDIA_UNUSABLE INTO
05383 
05384                     :mediaUnusable
05385 
05386             EXEC SQL
05387                 CLOSE MEDIA_UNUSABLE;
05388 
05389             sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_UNUSABLE", currentKey);
05390             SQL_CHECKREAD_M( sqlErrDesc );
05391 
05392 
05393             a_poolInfo[i].mediaUnusable = mediaUnusable;
05394         }
05395 
05396         // Execute SELECT query and return the number of unreliable media
05397         {
05398             Int32_t mediaUnreliable(0);
05399 
05400             EXEC SQL
05401                 SET TRANSACTION NAME readTrans;
05402 
05403             EXEC SQL
05404                 DECLARE MEDIA_UNRELIABLE CURSOR FOR
05405 
05406                 SELECT
05407                     COUNT (*)
05408                 FROM
05409                     MEDIA
05410                 WHERE
05411                     MEDIA.MEDIAPOOLKEY = :currentKey      AND
05412                     bin_and(MEDIA.STATUS, :mediumUnreliable) != 0;
05413 
05414             EXEC SQL
05415                 OPEN TRANSACTION readTrans MEDIA_UNRELIABLE;
05416 
05417             EXEC SQL
05418                 FETCH
05419                 MEDIA_UNRELIABLE INTO
05420 
05421                     :mediaUnreliable
05422 
05423             EXEC SQL
05424                 CLOSE MEDIA_UNRELIABLE;
05425 
05426             sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_UNRELIABLE", currentKey);
05427             SQL_CHECKREAD_M( sqlErrDesc );
05428 
05429             a_poolInfo[i].mediaUnreliable = mediaUnreliable;
05430         }
05431 
05432 
05433         // Execute SELECT query and count the number of good volumes per media
05434         // Number of volumes for good media must be greater than 0
05435         // Do not perform calculation for media that are unusable or unreliable
05436 
05437         {
05438             Int32_t mediaGood(0);
05439 
05440             EXEC SQL
05441                 SET TRANSACTION NAME readTrans;
05442 
05443             EXEC SQL
05444                 DECLARE NUMBER_OF_GOOD_MEDIA CURSOR FOR
05445 
05446                 SELECT
05447                 COUNT(*)
05448                 FROM
05449                     MEDIA
05450                 WHERE MEDIAKEY IN (
05451                     SELECT
05452                         MEDIAVOL.MEDIAKEY
05453                     FROM
05454                         MEDIA, MEDIAVOL
05455                     WHERE
05456                         MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY AND
05457                         MEDIA.MEDIAPOOLKEY = :currentKey    AND
05458                         bin_and(MEDIA.STATUS, :mediumUnreliableUnusable) = 0
05459                     GROUP BY
05460                         MEDIAVOL.MEDIAKEY
05461                     HAVING
05462                         COUNT(MEDIAVOL.MEDVOLNR) > 0);
05463 
05464             EXEC SQL
05465                 OPEN TRANSACTION readTrans NUMBER_OF_GOOD_MEDIA;
05466 
05467             EXEC SQL
05468                 FETCH
05469                 NUMBER_OF_GOOD_MEDIA INTO
05470 
05471                     :mediaGood
05472 
05473             EXEC SQL
05474                 CLOSE NUMBER_OF_GOOD_MEDIA;
05475 
05476             string sqlErrDesc = errorDesc(SQLCODE,"Select NUMBER_OF_GOOD_MEDIA", currentKey);
05477             SQL_CHECKREAD_M( sqlErrDesc );
05478 
05479             a_poolInfo[i].mediaGood = mediaGood;
05480         }
05481 
05482         // Execute SELECT query and count the number of uninitilized volumes per media
05483         // Do not perform calculation for media that are unusable or unreliable
05484 
05485         {
05486             Int32_t mediaUninitialized(0);
05487 
05488             EXEC SQL
05489                 SET TRANSACTION NAME readTrans;
05490 
05491             EXEC SQL
05492                 DECLARE NUMBER_OF_UNINIT_MEDIA CURSOR FOR
05493 
05494                 SELECT
05495                 COUNT(*)
05496                 FROM
05497                     MEDIA
05498                 WHERE MEDIA.MEDIAPOOLKEY = :currentKey AND
05499                         bin_and(MEDIA.STATUS, :mediumUnreliableUnusable) = 0 AND
05500                         MEDIAKEY NOT IN (
05501                     SELECT
05502                         MEDIAVOL.MEDIAKEY
05503                     FROM
05504                         MEDIA, MEDIAVOL
05505                     WHERE
05506                         MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY
05507                     GROUP BY
05508                         MEDIAVOL.MEDIAKEY
05509                     HAVING
05510                         COUNT(MEDIAVOL.MEDVOLNR) > 0);
05511 
05512             EXEC SQL
05513                 OPEN TRANSACTION readTrans NUMBER_OF_UNINIT_MEDIA;
05514 
05515             EXEC SQL
05516                 FETCH
05517                 NUMBER_OF_UNINIT_MEDIA INTO
05518 
05519                     :mediaUninitialized
05520 
05521             EXEC SQL
05522                 CLOSE NUMBER_OF_UNINIT_MEDIA;
05523 
05524             sqlErrDesc = errorDesc(SQLCODE,"Select NUMBER_OF_UNINIT_MEDIA", currentKey);
05525             SQL_CHECKREAD_M( sqlErrDesc );
05526 
05527             a_poolInfo[i].mediaUninitialized = mediaUninitialized;
05528         }
05529 
05530     } // for end
05531 
05532  } // end function rm_Operator::PoolInfo

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class rm_DBThread [friend]

Definition at line 27 of file rm_operator.h.

friend class rm_DBOperation [friend]

Definition at line 28 of file rm_operator.h.

friend class dbo_SelectLibrary [friend]

Definition at line 30 of file rm_operator.h.

friend class dbo_SelectLibraryByKey [friend]

Definition at line 31 of file rm_operator.h.

friend class dbo_SelectAllLibraries [friend]

Definition at line 32 of file rm_operator.h.

friend class dbo_UpdateLibrary [friend]

Definition at line 33 of file rm_operator.h.

friend class dbo_AddLibrary [friend]

Definition at line 34 of file rm_operator.h.

friend class dbo_RemoveLibrary [friend]

Definition at line 35 of file rm_operator.h.

friend class dbo_SelectAllMajorCol [friend]

Definition at line 37 of file rm_operator.h.

friend class dbo_AddMajorCol [friend]

Definition at line 38 of file rm_operator.h.

friend class dbo_RemoveMajorCol [friend]

Definition at line 39 of file rm_operator.h.

friend class dbo_UpdateMajorCol [friend]

Definition at line 40 of file rm_operator.h.

friend class dbo_SelectMajorCol [friend]

Definition at line 41 of file rm_operator.h.

friend class dbo_SelectAllMinorCol [friend]

Definition at line 43 of file rm_operator.h.

friend class dbo_SelectMinColByMajCol [friend]

Definition at line 44 of file rm_operator.h.

friend class dbo_AddMinorCol [friend]

Definition at line 45 of file rm_operator.h.

friend class dbo_RemoveMinorCol [friend]

Definition at line 46 of file rm_operator.h.

friend class dbo_UpdateMinorCol [friend]

Definition at line 47 of file rm_operator.h.

friend class dbo_SelectMinorCol [friend]

Definition at line 48 of file rm_operator.h.

friend class dbo_SelectAllColVolumes [friend]

Definition at line 50 of file rm_operator.h.

friend class dbo_SelectAllColMediaVol [friend]

Definition at line 51 of file rm_operator.h.

friend class dbo_AddColMediaVol [friend]

Definition at line 52 of file rm_operator.h.

friend class dbo_CheckAndAddColMediaVol [friend]

Definition at line 53 of file rm_operator.h.

friend class dbo_RemoveColMediaVol [friend]

Definition at line 54 of file rm_operator.h.

friend class dbo_RemoveColIDs [friend]

Definition at line 55 of file rm_operator.h.

friend class dbo_GetMediaInfo [friend]

Definition at line 56 of file rm_operator.h.

friend class dbo_SelectDrive [friend]

Definition at line 58 of file rm_operator.h.

friend class dbo_SelectDriveByKey [friend]

Definition at line 59 of file rm_operator.h.

friend class dbo_UpdateDrive [friend]

Definition at line 60 of file rm_operator.h.

friend class dbo_AddDrive [friend]

Definition at line 61 of file rm_operator.h.

friend class dbo_RemoveDrive [friend]

Definition at line 62 of file rm_operator.h.

friend class dbo_SelectAllDrives [friend]

Definition at line 63 of file rm_operator.h.

friend class dbo_SelectDriveHost [friend]

Definition at line 65 of file rm_operator.h.

friend class dbo_SelectDriveHostByKey [friend]

Definition at line 66 of file rm_operator.h.

friend class dbo_UpdateDriveHost [friend]

Definition at line 67 of file rm_operator.h.

friend class dbo_AddDriveHost [friend]

Definition at line 68 of file rm_operator.h.

friend class dbo_RemoveDriveHost [friend]

Definition at line 69 of file rm_operator.h.

friend class dbo_SelectAllDriveHosts [friend]

Definition at line 70 of file rm_operator.h.

friend class dbo_SelectDiskSubsys [friend]

Definition at line 72 of file rm_operator.h.

friend class dbo_SelectDiskSubsysByKey [friend]

Definition at line 73 of file rm_operator.h.

friend class dbo_UpdateDiskSubsys [friend]

Definition at line 74 of file rm_operator.h.

friend class dbo_AddDiskSubsys [friend]

Definition at line 75 of file rm_operator.h.

friend class dbo_RemoveDiskSubsys [friend]

Definition at line 76 of file rm_operator.h.

friend class dbo_SelectAllDiskSubsys [friend]

Definition at line 77 of file rm_operator.h.

friend class dbo_SelectSlot [friend]

Definition at line 79 of file rm_operator.h.

friend class dbo_SelectSlotByKey [friend]

Definition at line 80 of file rm_operator.h.

friend class dbo_UpdateSlot [friend]

Definition at line 81 of file rm_operator.h.

friend class dbo_AddSlot [friend]

Definition at line 82 of file rm_operator.h.

friend class dbo_RemoveSlot [friend]

Definition at line 83 of file rm_operator.h.

friend class dbo_SelectAllSlots [friend]

Definition at line 84 of file rm_operator.h.

friend class dbo_SelectMediaPool [friend]

Definition at line 86 of file rm_operator.h.

friend class dbo_SelectMediaPoolbyUUID [friend]

Definition at line 87 of file rm_operator.h.

friend class dbo_SelectMediaPoolByKey [friend]

Definition at line 88 of file rm_operator.h.

friend class dbo_UpdateMediaPool [friend]

Definition at line 89 of file rm_operator.h.

friend class dbo_AddMediaPool [friend]

Definition at line 90 of file rm_operator.h.

friend class dbo_RemoveMediaPool [friend]

Definition at line 91 of file rm_operator.h.

friend class dbo_SelectAllMediaPool [friend]

Definition at line 92 of file rm_operator.h.

friend class dbo_SelectMedium [friend]

Definition at line 94 of file rm_operator.h.

friend class dbo_SelectMediumByKey [friend]

Definition at line 95 of file rm_operator.h.

friend class dbo_SelectMediumByDrive [friend]

Definition at line 96 of file rm_operator.h.

friend class dbo_UpdateMedium [friend]

Definition at line 97 of file rm_operator.h.

friend class dbo_AddMedium [friend]

Definition at line 98 of file rm_operator.h.

friend class dbo_RemoveMedium [friend]

Definition at line 99 of file rm_operator.h.

friend class dbo_SelectAllMedium [friend]

Definition at line 100 of file rm_operator.h.

friend class dbo_SelectMediumVol [friend]

Definition at line 102 of file rm_operator.h.

friend class dbo_SelectMediumVolByKey [friend]

Definition at line 103 of file rm_operator.h.

friend class dbo_SelectMediumVolByUUID [friend]

Definition at line 104 of file rm_operator.h.

friend class dbo_UpdateMediumVol [friend]

Definition at line 105 of file rm_operator.h.

friend class dbo_AddMediumVol [friend]

Definition at line 106 of file rm_operator.h.

friend class dbo_RemoveMediumVol [friend]

Definition at line 107 of file rm_operator.h.

friend class dbo_SelectAllMediumVol [friend]

Definition at line 109 of file rm_operator.h.

friend class dbo_SelectAllMediumVolByPart [friend]

Definition at line 110 of file rm_operator.h.

friend class dbo_SelectAllMediaByPart [friend]

Definition at line 111 of file rm_operator.h.

friend class dbo_SetRecoveryFlag [friend]

Definition at line 112 of file rm_operator.h.

friend class dbo_ClearRecoveryFlag [friend]

Definition at line 113 of file rm_operator.h.

friend class dbo_UpdateDataSize [friend]

Definition at line 114 of file rm_operator.h.

friend class dbo_GetBestCopy [friend]

Definition at line 116 of file rm_operator.h.

friend class dbo_MediumLoaded [friend]

Definition at line 117 of file rm_operator.h.

friend class dbo_MediumUnloaded [friend]

Definition at line 118 of file rm_operator.h.

friend class dbo_VolumeEmpty [friend]

Definition at line 119 of file rm_operator.h.

friend class dbo_VolumeFull [friend]

Definition at line 120 of file rm_operator.h.

friend class dbo_VolumeError [friend]

Definition at line 122 of file rm_operator.h.

friend class dbo_VolumeUsage [friend]

Definition at line 123 of file rm_operator.h.

friend class dbo_MediumUnreliable [friend]

Definition at line 125 of file rm_operator.h.

friend class dbo_MediumUnusable [friend]

Definition at line 126 of file rm_operator.h.

friend class dbo_MediumStatusSet [friend]

Definition at line 128 of file rm_operator.h.

friend class dbo_MediumStatusClear [friend]

Definition at line 129 of file rm_operator.h.

friend class dbo_MedVolStatusSet [friend]

Definition at line 130 of file rm_operator.h.

friend class dbo_MedVolStatusClear [friend]

Definition at line 131 of file rm_operator.h.

friend class dbo_VolumeListStatusSet [friend]

Definition at line 132 of file rm_operator.h.

friend class dbo_DriveStatusSet [friend]

Definition at line 134 of file rm_operator.h.

friend class dbo_DriveStatusClear [friend]

Definition at line 135 of file rm_operator.h.

friend class dbo_DriveError [friend]

Definition at line 137 of file rm_operator.h.

friend class dbo_LibraryStatusSet [friend]

Definition at line 139 of file rm_operator.h.

friend class dbo_LibraryStatusClear [friend]

Definition at line 140 of file rm_operator.h.

friend class dbo_InventoryUpdate [friend]

Definition at line 143 of file rm_operator.h.

friend class dbo_InitAllResource [friend]

Definition at line 145 of file rm_operator.h.

friend class dbo_AllocateMig [friend]

Definition at line 147 of file rm_operator.h.

friend class dbo_AllocateRec [friend]

Definition at line 148 of file rm_operator.h.

friend class dbo_AllocateAdmin [friend]

Definition at line 149 of file rm_operator.h.

friend class dbo_ReleaseResources [friend]

Definition at line 150 of file rm_operator.h.

friend class dbo_GetHost [friend]

Definition at line 152 of file rm_operator.h.

friend class dbo_SelectAllPartition [friend]

Definition at line 154 of file rm_operator.h.

friend class dbo_DisablePartition [friend]

Definition at line 155 of file rm_operator.h.

friend class dbo_EnablePartition [friend]

Definition at line 156 of file rm_operator.h.

friend class dbo_InsertPartition [friend]

Definition at line 157 of file rm_operator.h.

friend class dbo_SelectPartition [friend]

Definition at line 158 of file rm_operator.h.

friend class dbo_SelectPartitionByUuid [friend]

Definition at line 159 of file rm_operator.h.

friend class dbo_RemovePartition [friend]

Definition at line 160 of file rm_operator.h.

friend class dbo_UpdatePartition [friend]

Definition at line 161 of file rm_operator.h.

friend class dbo_SetPartitionStatus [friend]

Definition at line 162 of file rm_operator.h.

friend class dbo_ClearPartitionStatus [friend]

Definition at line 163 of file rm_operator.h.

friend class dbo_SelectAllMediumVolByBarcode [friend]

Definition at line 164 of file rm_operator.h.

friend class dbo_PoolInfo [friend]

Definition at line 165 of file rm_operator.h.

friend class dbo_SetReorgScan [friend]

Definition at line 166 of file rm_operator.h.

friend class dbo_ClearReorgScan [friend]

Definition at line 167 of file rm_operator.h.

friend class dbo_IsSomeVolumeUsed [friend]

Definition at line 168 of file rm_operator.h.


Member Data Documentation

Definition at line 343 of file rm_operator.h.


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

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