Private Member Functions | Private Attributes | Friends

rm_Operator Class Reference

#include <rm_operator.h>

Collaboration diagram for rm_Operator:
Collaboration graph
[legend]

List of all members.

Private Member Functions

 rm_Operator (rm_String &username, rm_String &password)
 ~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)
bool MajorColIdMatches (rm_Medium &a_medium, UInt64_t &a_majColId)

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

Detailed Description

Definition at line 39 of file rm_operator.h.


Constructor & Destructor Documentation

rm_Operator::rm_Operator ( rm_String username,
rm_String password 
) [private]

Definition at line 70 of file rm_operator.cpp.

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

                                                                 {
    log_FUNC_m(rm_Operator);
    m_dataBase.Connect(username, password);
}

Here is the call graph for this function:

rm_Operator::~rm_Operator (  )  [private]

Definition at line 75 of file rm_operator.cpp.

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

Here is the call graph for this function:


Member Function Documentation

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

ToDo: assign generated values to a_Library

Definition at line 979 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, 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().

                                           {
    log_FUNC_A_m(Add, "library");
    try {

        rm_Library library;

        library.auditTime       =   a_library.auditTime;
        library.capabilities    =   a_library.capabilities;
        library.controlDevice   =   a_library.controlDevice;
        library.host            =   a_library.host;
        library.libraryName     =   a_library.libraryName;
        library.libraryType     =   a_library.libraryType;
        library.loadNr          =   a_library.loadNr;
        library.mediaAccessTime =   a_library.mediaAccessTime;
        library.mediaAccessTime =   a_library.mediaAccessTime;
        library.mediaFamily     =   a_library.mediaFamily;
        library.mediaXChgTime   =   a_library.mediaXChgTime;
        library.options         =   a_library.options;
        library.status          =   a_library.status;
        library.unloadNr        =   a_library.unloadNr;
        library.firmwareRev     =   a_library.firmwareRev;
        library.scsiID          =   a_library.scsiID;

        library.libraryKey      =   0;

        //AutoDetect(library);
        library.Insert();


    } rm_CATCH_DB_THROW_IVD_m;
}

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 1012 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, rmdb_MAX_LIBRARYNAME, i_Drive_t::scsiID, rm_Drive::scsiID, rm_Drive::SelectByAddr(), rm_Library::SelectByName(), i_Drive_t::status, rm_Drive::status, i_Drive_t::unloadTime, rm_Drive::unloadTime, i_Drive_t::usageCount, and rm_Drive::usageCount.

                                       {
    log_FUNC_A_m(Add, "Drive");

    try {

        rm_Drive drive;

        drive.driveIndex    = a_drive.driveIndex;

        rm_Library lib;
        rm_String libName(rmdb_MAX_LIBRARYNAME);
        libName = a_drive.libraryName;
        bool driveUnique = false;

        if (libName.size() > 0 ) {
            lib.SelectByName(libName);
            drive.libraryKey = lib.libraryKey;
        } else {
            drive.libraryKey = -1;
            driveUnique = true;
        }

        if (drive.libraryKey > 0) {
            try {
                drive.SelectByAddr(drive.libraryKey, drive.driveIndex);
            } catch (ivd_DBException& dbe) {
                if (dbe.GetError() == SQL_NOTFOUND) {
                    log_DBG_m(dbg_DETAIL,"DriveIndexCheck is OK");
                    driveUnique = true;
                } else throw;

            }
            if (driveUnique == false) {
                ostringstream errDescStream;
                errDescStream << "There is already a drive in that Library with the same index" << endl;
                errDescStream << "Drive: " << drive.driveName << "  has already index " << drive.driveIndex;
                errDescStream << endl;
                throw ivd_Error (ie_DRIVE_INDEX_DUPL, errDescStream.str());
            }
        }

        drive.aveSeekTime       = a_drive.aveSeekTime;
        drive.capabilities      = a_drive.capabilities;
        drive.cleanNr           = a_drive.cleanNr;
        drive.dataThroughput    = a_drive.dataThroughput;
        drive.driveIndex        = a_drive.driveIndex;
        drive.driveName         = a_drive.driveName;
        drive.lastClean         = a_drive.lastClean;
        drive.loadTime          = a_drive.loadTime;
        drive.mediaFamily       = a_drive.mediaFamily;
        drive.options           = a_drive.options;
        drive.rewindTime        = a_drive.rewindTime;
        drive.status            = a_drive.status;
        drive.unloadTime        = a_drive.unloadTime;
        drive.usageCount        = a_drive.usageCount;
        drive.firmwareRev       = a_drive.firmwareRev;
        drive.scsiID            = a_drive.scsiID;
        drive.driveKey          = 0;
        //AutoDetect(drive);
        drive.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1076 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, rmdb_MAX_DRIVENAME, and rm_Drive::SelectByName().

                                               {
    log_FUNC_A_m(Add, "DriveHost");

    try {

        rm_DriveHost driveHost;

        driveHost.controlDevice = a_driveHost.controlDevice;
        driveHost.host          = a_driveHost.host;

        rm_Drive d;
        rm_String driveName(rmdb_MAX_DRIVENAME);
        driveName = a_driveHost.driveName;
        d.SelectByName(driveName);
        driveHost.driveKey = d.driveKey;

        //AutoDetect(driveHost);
        driveHost.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1257 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, and i_MinorCol_t::minColId.

                                              {
    log_FUNC_A_m(Add, "MinorCol");
    try {
        rm_MinorCol minorcol;

        minorcol.m_minColId   = a_minorCol.minColId;
        minorcol.m_majColId   = a_minorCol.majColId;
        minorcol.m_flags      = a_minorCol.flags;

        minorcol.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1270 of file rm_operator.cpp.

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

                                                    {
    log_FUNC_A_m(Add, "ColMediaVol");
    try {
        rm_ColMediaVol colMediaVol(a_colMediaVol);
        colMediaVol.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1114 of file rm_operator.cpp.

References Add(), rm_Slot::Insert(), rm_Library::libraryKey, rm_Slot::libraryKey, i_Slot_t::libraryName, log_FUNC_A_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.

                                     {
    log_FUNC_A_m(Add, "Slot");
    try {

        rm_Slot slot;

        rm_Library lib;
        rm_String libraryName(rmdb_MAX_LIBRARYNAME);
        libraryName = a_slot.libraryName;
        lib.SelectByName(libraryName);

        slot.libraryKey = lib.libraryKey;
        slot.slotAddr   = a_slot.slotAddr;
        slot.slotType   = a_slot.slotType;
        slot.status     = a_slot.status;
        slot.slotKey    = 0;

        //AutoDetect(slot);
        slot.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1136 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, i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sysVolLocation, and rm_MediaPool::sysVolLocation.

                                               {
    log_FUNC_A_m(Add, "MediaPool");
    try {

        rm_MediaPool mediaPool;

        mediaPool.maxMediaAge       = a_mediaPool.maxMediaAge;
        mediaPool.maxNrReadWrite     = a_mediaPool.maxNrReadWrite;
        mediaPool.mediaFamily       = a_mediaPool.mediaFamily;
        mediaPool.mediaPoolName     = a_mediaPool.mediaPoolName;
        mediaPool.mediaPoolType     = a_mediaPool.mediaPoolType;
        mediaPool.partitionUUIDString = a_mediaPool.partitionUUIDString;
        mediaPool.mediaPoolKey      = 0;
        mediaPool.blockSize         = a_mediaPool.blockSize;

        mediaPool.numOfVolumes      = static_cast<Int16_t>(a_mediaPool.numOfVolumes);
        mediaPool.sysVolLocation    = static_cast<Int16_t>(a_mediaPool.sysVolLocation);
        mediaPool.sizeOfSysVol      = a_mediaPool.sizeOfSysVol;
        mediaPool.sizeOfVolume      = a_mediaPool.sizeOfVolume;

        //AutoDetect(mediaPool);
        mediaPool.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1162 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, 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.

                                         {
    log_FUNC_A_m(Add, "Medium");
    try {

        rm_Medium medium;

        medium.barcode     = a_medium.barcode ;

        string dssName(a_medium.diskSubsysName);
        if (dssName.length() > 0 ) {
            rm_DiskSubsys dss;
            rm_String dssName(rmdb_MAX_DSSNAME);
            dssName = a_medium.diskSubsysName;
            dss.SelectByName(dssName);
            medium.diskSubsysKey = dss.diskSubsysKey;
        } else {
            medium.diskSubsysKey = -1;
        };
        string driveName(a_medium.driveName);
        if (driveName.length() > 0 ) {
            rm_Drive d;
            rm_String dName(rmdb_MAX_DRIVENAME);
            dName = a_medium.driveName;
            d.SelectByName(dName);
            medium.driveKey = d.driveKey;
        } else {
            medium.driveKey = -1;
        };

        if (strlen(a_medium.libraryName) > 0 ) {
            rm_Library l;
            rm_String lName(rmdb_MAX_LIBRARYNAME);
            lName = a_medium.libraryName;
            l.SelectByName(lName);
            medium.libraryKey = l.libraryKey;
        } else {
            medium.libraryKey = -1;
        };

        medium.location     = a_medium.location ;

        if (strlen(a_medium.mediaPoolName) > 0 ) {
            rm_MediaPool mp;
            rm_String mpName(rmdb_MAX_MEDIAPOOLNAME);
            mpName = a_medium.mediaPoolName;
            mp.SelectByName(mpName);
            medium.mediaPoolKey = mp.mediaPoolKey;
        } else {
            medium.mediaPoolKey = -1;
        };

        medium.mediumSerialNo = a_medium.mediumSerialNo ;
        medium.mediumType     = a_medium.mediumType ;

        if (strlen(a_medium.slotAddr) > 0 ) {
            rm_Slot s;
            rm_String sAddr(rmdb_MAX_SLOTADDR);
            sAddr = a_medium.slotAddr;
            s.SelectByLibAddrType(medium.libraryKey, sAddr, a_medium.slotType);
            medium.slotKey = s.slotKey;
        } else {
            medium.slotKey = -1;
        };

        if (a_medium.currentVolume < 1) {
            medium.currentVolume = -1; //setting indicator bi6
        }

        medium.status    = a_medium.status ;
        medium.blockSize         = a_medium.blockSize;
        medium.numOfVolumes      = static_cast<Int16_t>(a_medium.numOfVolumes);
        medium.idxOfSysVol       = static_cast<Int16_t>(a_medium.idxOfSysVol);
        medium.sizeOfSysVol      = a_medium.sizeOfSysVol;

        medium.mediumKey  = 0;

        //AutoDetect(medium);
        medium.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1303 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, 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.

                                               {
    log_FUNC_A_m(Add, "MediumVol");
    try {

        rm_MediumVol mediumVol;
        mediumVol.medVolNr       = a_mediumVol.medVolNr;
        mediumVol.accessNr       = a_mediumVol.accessNr;
        mediumVol.accessTime     = a_mediumVol.accessTime;
        mediumVol.initTime       = a_mediumVol.initTime;
        mediumVol.lastVerification    = a_mediumVol.lastVerification;

        rm_Medium medium;
        rm_String medBarcode(rmdb_MAX_BARCODE);
        medBarcode = a_mediumVol.mediumBarcode;
        medium.SelectByBarcode(medBarcode);
        mediumVol.mediumKey       = medium.mediumKey;

        mediumVol.medVolId       = a_mediumVol.medVolId;
        mediumVol.owriteNr       = a_mediumVol.owriteNr;
        mediumVol.owriteTime     = a_mediumVol.owriteTime;
        mediumVol.status         = a_mediumVol.status;
        mediumVol.volSize        = a_mediumVol.volSize;
        mediumVol.volType        = a_mediumVol.volType;
        mediumVol.volUsed        = a_mediumVol.volUsed;
        mediumVol.writeNr        = a_mediumVol.writeNr;
        mediumVol.writeTime      = a_mediumVol.writeTime;
        mediumVol.validData      = a_mediumVol.validData;
        mediumVol.totalData      = a_mediumVol.totalData;

        //AutoDetect(mediumVol);
        mediumVol.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1243 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, and rm_MajorCol::partUUID.

                                             {
    log_FUNC_A_m(Add, "MajorCol");
    try {
        rm_MajorCol majorcol;

        majorcol.majColId   = a_majorCol.majColId;
        majorcol.majColSize = a_majorCol.majColSize;
        majorcol.partUUID   = a_majorCol.partUUID;
        majorcol.flags      = a_majorCol.flags;

        majorcol.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 4509 of file rm_operator.cpp.

References rm_Medium::barcode, rm_MediaPool::blockSize, dbg_DETAIL, dbg_LOW, dbg_NORM, rm_Drive::driveIndex, rm_Drive::driveKey, rm_Medium::driveKey, rm_Drive::driveName, evt_WARNING, ivd_BaseException::GetError(), rm_Library::host, 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, 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, rm_Drive::status, rm_Library::status, rm_Medium::status, rm_Drive::Update(), and rm_Medium::Update().

Referenced by dbo_AllocateAdmin::Process().

                                                                  {
    log_FUNC_m(AllocateAdmin);

    try {

        rm_Medium m;
        rm_MediumVol mv;
        rm_Drive d;

        vector<rm_Drive> selDrive;

        if (a_resourceTable.empty() || (a_resourceTable.size() > 1)){
            throw ivd_InternalError(RM_ALLOC_FAILUE, "AllocateAdmin was called with empty or multiple row");
        }
        rm_Library lib;

        rm_Resource_t &res = a_resourceTable[0];

        if (res.mediumKey == 0) {
            //if pool is  backup
            //then search for a medium from this pool


            //else
            throw ivd_InternalError(RM_ALLOC_FAILUE, "AllocateAdmin called with mediumKey=0");
        }

        m.Select(res.mediumKey);

        if ((m.status &  rmdb_MEDIUM_IN_USE) != 0)  {
            log_DBG_m(dbg_LOW,"Medium in use. Can not allocate resources.");
            res.resourceBusyStatus = i_MEDIUM_BUSY;
            return;
        }

        if (m.mediumType == mt_DISK){
            //do nothing
        } else if (m.libraryKey > 0){
            lib.Select(m.libraryKey);

            log_DBG_m(dbg_NORM, "Medium requested for Admin Job" << endl <<
                "Medium: " << m.barcode << "\tStatus: " << m.status << endl <<
                "DriveKey: " << m.driveKey << "\tLibKey: " << m.libraryKey <<
                "\tSlotKey: " << m.slotKey);

            if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
                log_DBG_m(dbg_LOW,"Library disabled or Error. Can not allocate resources.");
                res.resourceBusyStatus = i_LIBRARY_NOT_AVAILABLE;
                return;
            }

        } else {
            ostringstream sstr;
            sstr << "Medium (BC:" << m.barcode << ") location unknown."
                    " Run library inventory to identify medium location.";

            log_WriteEvent( evt_WARNING,
                sstr.str(),
                m.barcode);

            res.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
        }
        rm_Drive selectedDrive;
        rm_Medium med;
        if (m.mediumType == mt_DISK){
            log_DBG_m(dbg_LOW,"Disk medium no need for a drive.");
        }
        else {
            if (m.driveKey > 0) {       //medium is in drive
                log_DBG_m(dbg_DETAIL,"Medium is in drive - selecting");
                log_DBG_m(dbg_DETAIL,"IsMediumWORM(m)" << IsMediumWORM(m));
                d.Select(m.driveKey);   //select that drive
                log_DBG_m(dbg_DETAIL,"IsDriveWORM(d)" << IsDriveWORM(d));

                if ( !(a_resourceTable[0].poolType == pt_WORM) || IsDriveWORM(d) ) {

                    log_DBG_m(dbg_NORM, "Requested medium in drive" << endl <<
                        "DriveName: " << d.driveName << "\tStatus: " << d.status);
                    if ( d.status == 0 ) {
                        selDrive.push_back(d);
                    }
                } else {
                    log_DBG_m(dbg_LOW,"Medium is inserted into non WORM drive");
                    //continue with allocation
                }
            }// if (m.driveKey > 0)

            UInt32_t reqCapability(0);
            if (IsMediumWORM(m) || (a_resourceTable[0].poolType == pt_WORM)) {
                reqCapability |= dc_WORM;
            }
            if (a_resourceTable[0].driveKey == 0){
                if ((m.driveKey < 1) ||
                    ((m.driveKey > 0) && ((d.status & rmdb_DRIVE_IN_USE) != 0 )))
                {

                    rm_MediaPool pool;
                    if (m.mediaPoolKey > 0) {
                        pool.Select(m.mediaPoolKey);

                        selDrive = d.SelectForOperation(
                                            m.libraryKey,
                                            pool.mediaFamily,
                                            reqCapability,
                                            false);
                    } else {
                        selDrive = d.SelectForOperation(
                                            m.libraryKey,
                                            lib.mediaFamily,
                                            reqCapability,
                                            false);

                    }
                }

                if (selDrive.size() == 0) {
                    log_DBG_m(dbg_NORM,"No drive available for admin job " );
                    //Check if there are drives that are in use
                    selDrive = d.SelectForOperation(
                                            m.libraryKey,
                                            lib.mediaFamily,
                                            reqCapability,
                                            true);

                    if (selDrive.size() == 0){
                        a_resourceTable[0].resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
                    } else {
                        a_resourceTable[0].resourceBusyStatus = i_DRIVE_BUSY;
                    }
                    a_resourceTable[0].driveKey = 0;

                    return;
                };
            } // if (a_resourceTable[0].driveKey == 0)
            else {
                // no need to allocate drive
                log_DBG_m(dbg_DETAIL,"Resource request for medium only");
                rm_Drive d(a_resourceTable[0].driveKey);
                selDrive.push_back(d);
            } //else

            if (selDrive.size() == 0 ) {
                throw ivd_Error(ie_RMDB_NOTFOUND, "Could not find drive for admin job");
            }
            selectedDrive.Select(selDrive[0].driveKey);
            for(UInt32_t i = 0; i < selDrive.size(); i++){
                try {
                    med.SelectByDrive(selDrive[i].driveKey);
                } catch (...){
                    //if there is no medium in drive select it
                    selectedDrive = selDrive[i];
                    break;
                }
            } //for(UInt32_t i = 0; i < selDrive.size(); i++)
        }//else if (m.mediumType == mt_DISK){

        log_DBG_m(dbg_DETAIL,   "Table of Allocated Resources:"  );
        log_DBG_m(dbg_DETAIL,   "------------------------------------------------------------------------"  );

        UInt32_t takeMe(0);

        m.status = m.status | rmdb_MEDIUM_IN_USE;
        m.Update();
        a_resourceTable[takeMe].mediumKey = m.mediumKey;
        a_resourceTable[takeMe].barcode   = m.barcode;
        if (m.mediumType == mt_DISK){
            log_DBG_m(dbg_LOW,"Disk medium no need for a drive.");
        } else {
            selectedDrive.status = selectedDrive.status | rmdb_DRIVE_IN_USE;
            selectedDrive.Update();
            if (selectedDrive.libraryKey > 0) {
                rm_Library selLib;
                selLib.Select(selectedDrive.libraryKey);
                a_resourceTable[takeMe].libraryName = selLib.libraryName;
                a_resourceTable[takeMe].libraryHost = selLib.host;

                if (m.slotKey > 0) { // if in slot ok select it
                    rm_Slot selSlot;
                    selSlot.Select(m.slotKey, m.libraryKey);
                    a_resourceTable[0].loadSlotAddr = selSlot.slotAddr;
                } else {
                    a_resourceTable[0].loadSlotAddr = "";
                    log_DBG_m( dbg_LOW,  "Selected Medium: " << m.barcode <<
                        "  for admin without SlotKey. Assuming Manual Robot");
                }
            }
            if (m.driveKey != selectedDrive.driveKey){
                a_resourceTable[takeMe].load = true;
                rm_Medium unloadMedium;
                try {
                    unloadMedium.SelectByDrive(selectedDrive.driveKey);
                } catch ( ivd_DBException& e) {
                    if (e.GetError() == SQL_NOTFOUND) {
                        unloadMedium.mediumKey = 0;
                    } else
                        throw;
                }
                if (unloadMedium.mediumKey > 0){ // a medium is in the drive that should be unloaded
                    unloadMedium.status = unloadMedium.status | rmdb_MEDIUM_IN_USE;
                    unloadMedium.Update();
                    a_resourceTable[0].unloadBarcode = unloadMedium.barcode;
                    if (unloadMedium.slotKey > 0) { // if in slot ok select it
                        rm_Slot selSlot;
                        selSlot.Select(unloadMedium.slotKey, unloadMedium.libraryKey);
                        a_resourceTable[0].unloadSlotAddr = selSlot.slotAddr;
                    } //if  unloadMedium.slotKey > 0
                }//if (unloadMedium.mediumKey > 0)
            } //if (m.driveKey != selectedDrive.driveKey)
            if (selectedDrive.driveKey > 0) {
                a_resourceTable[takeMe].driveKey = selectedDrive.driveKey;
                a_resourceTable[takeMe].driveCtrlDevice = "";
                a_resourceTable[takeMe].driveIndex = selectedDrive.driveIndex;
            }
        }

        a_resourceTable[takeMe].resAllocated = true;
        if (m.mediaPoolKey > 0) {
            rm_MediaPool mp;
            mp.Select(m.mediaPoolKey);
            a_resourceTable[takeMe].poolUUID = mp.poolUUIDString;
            a_resourceTable[takeMe].blockSize   = mp.blockSize;
        }
    } rm_CATCH_DB_THROW_IVD_m;

    log_DBG_m(dbg_DETAIL,   "  MediumKey:" << a_resourceTable[0].mediumKey <<
                            "  DriveKey:" << a_resourceTable[0].driveKey);

    log_DBG_m(dbg_DETAIL,   "------------------------------------------------------------------------"  );
}

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:

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

Definition at line 3780 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_MEDIUM_BUSY, 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, rm_Resource_t::minColId, mt_DISK, rm_Resource_t::poolKey, rm_Resource_t::resourceBusyStatus, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_OFFLINE, 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.

                                                                                {
    log_FUNC_m(AllocateMigCollocation);

    // check if there is already a volume with that minColId
    rm_ColMediaVol cmv;
    vector<rm_ColMediaVol> cmvList;
    cmvList = cmv.SelectAll();

    bool foundRes(false);
    log_DBG_m(dbg_NORM, "cmvList.size():" << cmvList.size());

    for (UInt32_t i(0); i < cmvList.size(); i++) {
        rm_ColMediaVol &current = cmvList[i];
        log_DBG_m(dbg_NORM, "current.m_minColId: " << current.m_minColId <<
                            ", a_resource.minColId: " << a_resource.minColId);
        if (current.m_minColId == a_resource.minColId) {
            log_DBG_m(dbg_NORM, "found colID on medium:" << current.m_mediaKey <<
                                ", volume " << current.m_medVolNr);
            rm_MediumVol mv;
            mv.Select(current.m_mediaKey, current.m_medVolNr);
            rm_Medium m;
            m.Select(current.m_mediaKey);
            if (mv.status & rmdb_MEDVOL_FULL) {
                log_DBG_m(dbg_NORM, "volume full.");
                continue;
            }
            if (m.mediaPoolKey != a_resource.poolKey) {
                log_DBG_m(dbg_NORM, "Incorrect pool " << m.mediaPoolKey
                    << " (looking for: " << a_resource.poolKey << ").");
                continue;
            }
            else {
                log_DBG_m(dbg_NORM, "Volume not full and in correct pool, check medium ...");
                //check if medium is available
                if (   (m.status & rmdb_MEDIUM_UNUSABLE)
                    || (m.status & rmdb_MEDIUM_UNRELIABLE)
                    || (m.status & rmdb_MEDIUM_OFFLINE)) {
                    a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
                    log_DBG_m(dbg_NORM, "medStatus:" << m.status << ". continue with next ...");
                    continue;
                }
                else if (mv.status & rmdb_MEDVOL_REORG_INREORG) {
                    log_DBG_m(dbg_NORM, "In reorg. volStatus:" << mv.status << ", mediumKey: "
                        << m.mediumKey << ", medVolNr: " << mv.medVolNr << ". continue with next ...");
                    continue;
                }
                else if ((m.status == rmdb_MEDIUM_OPEN)) {
                    //use it
                    a_resource.mediumKey = m.mediumKey;
                    a_resource.medVolNr = mv.medVolNr;
                    a_resource.medVolId = mv.medVolId;

                    a_resource.barcode   = m.barcode;
                    a_resource.blockSize = m.blockSize;
                    a_resource.driveKey  = m.driveKey;

                    if (m.mediumType == mt_DISK){
                        a_resource.mediumFamily = mf_DISK;
                        foundRes = true;
                    } else {
                        //medium can be used, now search for drive
                        foundRes = SelectDriveForMig(a_resource);
                    }

                    if (foundRes){
                        UpdateCollocation(a_resource);
                        log_DBG_m(dbg_NORM, "found medium and drive ...");
                        return true;
                    }
                    else {
                        log_DBG_m(dbg_NORM, "drive not available ...");
                        a_resource.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
                        return false;
                    }

                } else {
                    if (m.status & rmdb_MEDIUM_IN_USE) {
                        //do not continue with allocation
                        log_DBG_m(dbg_NORM, "Medium is in use.");
                        a_resource.resourceBusyStatus = i_MEDIUM_BUSY;
                        return false;
                    } else {
                        // medium is unsusable or unreliable
                        log_DBG_m(dbg_NORM, "m.status:" << m.status << ". medium is empty but should contain some data. next ...");
                        continue;
                    }
                }
            }
        }
    }
    log_DBG_m(dbg_NORM, "did not found any volumes with that minColID");
    // allocate new volume

    // check current size of collocation group
    rm_MajorCol majCol;
    majCol.Select(a_resource.majColId);

    rm_MediumVol mv;

    vector<rm_ColAlloc> colAlloc = SelectColAlloc(majCol.majColId, a_resource.poolKey);
    log_DBG_m(dbg_NORM, "colAlloc.size(): " << colAlloc.size());

    UInt32_t currentSize(0);

    {
        vector<Int32_t> mediumKeyCounted;
        vector<Int32_t> medVolNrCounted;
        Int32_t lastmediumKeyCounted(0);
        Int32_t lastmedVolNrCounted(0);

        for (UInt32_t i(0); i < colAlloc.size(); i++) {
            if ( (lastmediumKeyCounted != colAlloc[i].mediumKey)
              && (lastmedVolNrCounted != colAlloc[i].medVolNr) ) {
                bool alreadyCounted(false);
                for (UInt32_t j(0); j < mediumKeyCounted.size(); j++) {
                    if ( (mediumKeyCounted[j] == colAlloc[i].mediumKey)
                      && (medVolNrCounted[j] == colAlloc[i].medVolNr) ) {
                        alreadyCounted = true;
                        break;
                    }
                }
                if (!alreadyCounted) {
                    mediumKeyCounted.push_back(colAlloc[i].mediumKey);
                    medVolNrCounted.push_back(colAlloc[i].medVolNr);
                    log_DBG_m(dbg_DETAIL, "Counting Medium key: " << colAlloc[i].mediumKey
                        << ", medVolNr: " << colAlloc[i].medVolNr
                        << ", volSize: " << colAlloc[i].volSize);
                    currentSize += colAlloc[i].volSize;
                }
            }
        }
    }
    log_DBG_m(dbg_NORM, "Size of all volumes is: " << currentSize << "MB ("
                        << "MajorColSize: " << majCol.majColSize << "MB).");

    if (currentSize > majCol.majColSize) {
        bool ret_val = SelectOpenedVolume(a_resource, colAlloc);
        if ((!ret_val) && (a_resource.resourceBusyStatus != i_MEDIUM_BUSY)) {
            a_resource.resourceBusyStatus = i_COL_GRP_SIZE_EXC;
        }
        return ret_val;
    }
    else { //group size is not exceeded, find a new volume
        foundRes = AllocateMigDefault(a_online, true, a_resource);

        if (foundRes) {
            UpdateCollocation(a_resource);
            rm_MediumVol mds(a_resource.mediumKey, a_resource.medVolNr);
            UInt32_t newSize = mds.volSize + currentSize;
            ostringstream sstr;
            if (newSize > majCol.majColSize) {
                //[2009/10/22 13:18:09, ivd-test-02, 003308, RMG, , 0, 99] WARNING: Collocation group size exceeded. Usage: 100MB, max size: 50MB
                sstr << "Collocation group size exceeded. Usage: " << newSize << "MB, ";
                sstr << "max size " << majCol.majColSize << "MB";
                log_WriteEvent(sstr.str(), "", 0, cmn_Num2Str(majCol.majColId) );
            }
            else {
                //[2009/10/22 13:21:04, ivd-test-02, 003308, RMG, , 0, 86] Collocation group usage: 300MB, max size: 500MB
                sstr << "Collocation group usage: " << newSize << "MB, ";
                sstr << "max size " << majCol.majColSize << "MB";
                log_WriteEvent(sstr.str(), "", 0, cmn_Num2Str(majCol.majColId) );
            }
            return true;
        }
        else {
            //size is not exceeded and no free volumes available
            //select volume with non-exlusive col for migration
            bool ret_val = SelectOpenedVolume(a_resource, colAlloc);
            if ((!ret_val) && (a_resource.resourceBusyStatus != i_MEDIUM_BUSY)) {
                a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
            }
            return ret_val;
        }
    }

    return foundRes;
}

Here is the call graph for this function:

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

Definition at line 4060 of file rm_operator.cpp.

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

Referenced by AllocateMigCollocation().

                                                                                        {
    log_FUNC_m(AllocateMigDefault);


    bool foundAll(false);
    foundAll = SelectMediumForMig( a_online, a_col, a_resource);
    if (foundAll) {
        log_DBG_m(dbg_LOW,"Resources Found for pool " << a_resource.poolKey);
        return true;
    } else {
        log_DBG_m(dbg_LOW,"No Resources Found for pool " << a_resource.poolKey);
        CheckForAnyResourceForMig(a_resource, a_col);
        return false;
    };
}

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 4328 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, 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, rmdb_INIT_LIBRARY_STATUS, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_OFFLINE, rmdb_MEDIUM_UNUSABLE, rm_Slot::Select(), rm_Library::Select(), rm_Medium::SelectByDrive(), rm_Drive::SelectForOperation(), rm_Slot::slotAddr, rm_Medium::slotKey, 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().

                                                         {
    log_FUNC_m(AllocateRecall);

    try {

        rm_Medium recMedium(a_resource.mediumKey);
        if ((recMedium.status & rmdb_MEDIUM_UNUSABLE) == rmdb_MEDIUM_UNUSABLE){
            log_DBG_m(dbg_NORM,"Medium is unusable, can not use it for recall.");
            a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
            return;
        }

        if ((recMedium.status & rmdb_MEDIUM_OFFLINE) == rmdb_MEDIUM_OFFLINE) {
            log_DBG_m(dbg_NORM,"Medium is offline, can not use it for recall.");
            a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
            return;
        }

        rm_MediaPool pool(recMedium.mediaPoolKey);

        if (recMedium.mediumType != mt_DISK) {
            rm_Drive drives;
            vector<rm_Drive> selDrive;

            if (recMedium.libraryKey == -1){
                log_DBG_m(dbg_NORM,"Medium is offline, can not use it for recall.");
                return;
            }

            rm_Library lib(recMedium.libraryKey);
            if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
                log_DBG_m(dbg_LOW,"Library disabled or Error. Can not allocate resources.");
                a_resource.resourceBusyStatus = i_LIBRARY_NOT_AVAILABLE;
                return;
            }

            selDrive = drives.SelectForOperation(   recMedium.libraryKey,
                                                    pool.mediaFamily,
                                                    0,
                                                    false);
            if (selDrive.size() == 0) {
                log_DBG_m(dbg_LOW,"No drives available for recall");
                selDrive = drives.SelectForOperation(   recMedium.libraryKey,
                                                        pool.mediaFamily,
                                                        0,
                                                        true);
                if (selDrive.size() == 0) {
                    a_resource.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
                } else {
                    a_resource.resourceBusyStatus = i_DRIVE_BUSY;
                }
                return;
            }

            if ((recMedium.status & rmdb_MEDIUM_IN_USE) == rmdb_MEDIUM_IN_USE){
                log_DBG_m(dbg_NORM,"Medium is in use, can NOT recall now");
                a_resource.resourceBusyStatus = i_MEDIUM_BUSY;
                return;
            }
            //*** Fill up output with results found

            rm_Drive* selectedDrive = &(selDrive[0]);
            log_DBG_m(dbg_DETAIL,"Will select drive for medium:" << recMedium.mediumKey <<
                                "which is in drive:" << recMedium.driveKey);

            if (recMedium.driveKey > 0) { //if medium is in drive select it
                log_DBG_m(dbg_DETAIL,"Medium is in Drive");

                //find the drive into which media is inserted
                bool found = false;
                for (UInt32_t j = 0; j < selDrive.size(); j++){

                    log_DBG_m(dbg_DETAIL,"recMedium.driveKey:"<< recMedium.driveKey <<
                                        "selDrive[j].driveKey:" << selDrive[j].driveKey        );

                    if (recMedium.driveKey == selDrive[j].driveKey) {
                        selectedDrive = &(selDrive[j]);
                        found = true;
                        log_DBG_m(dbg_NORM,"selected Drive:" << selDrive[j].driveKey);
                        break;
                    } //if
                } //for

                //medium is in drive, but drive was not found in list (maybe it's in use)
                if (!found) {
                    return;
                }
            } else {
                log_DBG_m(dbg_DETAIL,"Medium is NOT in Drive");
                rm_Medium m;
                for(UInt32_t i(0); i < selDrive.size(); i++){
                    try {
                        m.SelectByDrive(selDrive[i].driveKey);
                    } catch (ivd_DBException& dbe){
                        if (dbe.GetError() == SQL_NOTFOUND){
                            selectedDrive = &(selDrive[i]);
                            log_DBG_m(dbg_DETAIL,"Selected empty drive:" << selDrive[i].driveKey);
                            break;
                        } //if
                    } //catch
                } //for
            }//else

            // updating Medium to status rmdb_MEDIUM_IN_USE
            recMedium.status = recMedium.status | rmdb_MEDIUM_IN_USE;
            recMedium.Update();

            // updating drive to status rmdb_DRIVE_IN_USE
            selectedDrive->status = selectedDrive->status | rmdb_DRIVE_IN_USE;
            selectedDrive->Update();
            a_resource.driveKey = selectedDrive->driveKey;
            a_resource.driveIndex = selectedDrive->driveIndex;

            if (selectedDrive->libraryKey > 0) {

                rm_Library selLib;
                selLib.Select(selectedDrive->libraryKey);
                a_resource.libraryName = selLib.libraryName;
                a_resource.libraryHost = selLib.host;

                if (recMedium.slotKey > 0) { // if in slot ok select it
                    rm_Slot selSlot;
                    selSlot.Select(
                        recMedium.slotKey,
                        recMedium.libraryKey
                        );

                    a_resource.loadSlotAddr = selSlot.slotAddr;
                } else {
                    a_resource.loadSlotAddr = "";
                    log_DBG_m( dbg_LOW,  "Selected Medium: " << recMedium.barcode <<
                        "  for Recall without SlotKey. Assuming Manual Robot");
                }
            }
            if (recMedium.driveKey != selectedDrive->driveKey){ //medium is not in selected drive
                a_resource.load = true;
                rm_Medium unloadMedium;
                try {
                    unloadMedium.SelectByDrive(selectedDrive->driveKey);
                } catch ( ivd_DBException& e) {
                    if (e.GetError() == SQL_NOTFOUND) {
                        unloadMedium.mediumKey = 0;
                    } else
                        throw;
                }
                if (unloadMedium.mediumKey > 0){ // a medium is in the drive that should be unloaded
                    unloadMedium.status = unloadMedium.status | rmdb_MEDIUM_IN_USE;
                    unloadMedium.Update();
                    a_resource.unloadBarcode = unloadMedium.barcode;
                    if (unloadMedium.slotKey > 0) { // if in slot ok select it
                        rm_Slot selSlot;
                        selSlot.Select(unloadMedium.slotKey, unloadMedium.libraryKey);
                        a_resource.unloadSlotAddr = selSlot.slotAddr;
                    } else {
                        a_resource.unloadSlotAddr = "";
                        log_DBG_m( dbg_LOW,  "Unload Medium: " << unloadMedium.barcode <<
                            "  for Recall without SlotKey. Assuming Manual Robot");
                    }
                } else {
                    a_resource.unloadSlotAddr = "";
                    a_resource.unloadBarcode = "";
                }
            }
        }


        // If it gets down to here, the resources are successfully allocated
        a_resource.resAllocated = true;

        a_resource.poolKey = recMedium.mediaPoolKey;
        a_resource.poolType = pool.mediaPoolType;
        a_resource.mediumFamily = pool.mediaFamily;
        a_resource.mediumKey = recMedium.mediumKey;
        a_resource.blockSize = recMedium.blockSize;
        a_resource.poolUUID = pool.poolUUIDString;
        a_resource.barcode = recMedium.barcode;
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3495 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, and rm_Library::status.

Referenced by Update().

                                                 {
    if ( a_library.libraryName.length() == 0 ) {
        //libraryName = makeLibraryName();
    };

    a_library.status = rmdb_INIT_LIBRARY_STATUS;

    if ( a_library.libraryType == 0 ) {
        //libraryIndex = detectlibraryType();
    };

    if ( a_library.mediaFamily == 0 ) {
        //dataThroughput = detectmediaFamily();
    };

    if ( a_library.capabilities == 0 ) {
        //loadTime = detectcapabilitie();
    };

    if ( a_library.auditTime == 0 ) {
        //unloadTime = detectauditTime();
    };

    if ( a_library.mediaAccessTime == 0 ) {
        //aveSeekTime = detectmediumAccessTime();
    };

    if ( a_library.mediaXChgTime == 0 ) {
        //rewindTime = detectmediumXChgTime();
    };

    //a_library.vendorID  = DetectVendorID();
    //a_library.productID = DetectProductID();
    //a_library.serialNo = DetectSerialNo();
}

Here is the caller graph for this function:

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

Definition at line 3532 of file rm_operator.cpp.

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

                                             {
    if ( a_drive.driveName.length() == 0 ) {
        //driveName = makeDriveName();
    };

    a_drive.status = rmdb_INIT_DRIVE_STATUS;

    if ( a_drive.driveIndex.length() == 0 ) {
        //driveIndex = detectDriveIndex();
    };

    if ( a_drive.dataThroughput == 0 ) {
        //dataThroughput = detectDataThroughput();
    };

    if ( a_drive.loadTime == 0 ) {
        //loadTime = detectLoadTime();
    };

    if ( a_drive.unloadTime == 0 ) {
        //unloadTime = detectUnloadTime();
    };

    if ( a_drive.aveSeekTime == 0 ) {
        //aveSeekTime = detectAveSeekTime();
    };

    if ( a_drive.rewindTime == 0 ) {
        //rewindTime = detectRewindTime();
    };

    if ( a_drive.usageCount == 0 ) {
        //usageCount = detectUsageTime();
    };

    //a_drive.vendorID  = DetectVendorID();
    //a_drive.productID = DetectProductID();
    //a_drive.serialNo = DetectSerialNo();
}

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

Definition at line 3572 of file rm_operator.cpp.

                                                     {
    //empty

}

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

Definition at line 3577 of file rm_operator.cpp.

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

                                                {

    if ( a_dss.diskSubsysName.length() == 0 ) {
        //diskSubsysName = makeDssName();
    };
    a_dss.status = rmdb_INIT_DSS_STATUS;
}

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

Definition at line 3585 of file rm_operator.cpp.

References rm_Slot::status.

                                           {
    a_slot.status = rmdb_SLOT_FREE;
}

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

Definition at line 3589 of file rm_operator.cpp.

                                                     {
    //empty
}

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

Definition at line 3593 of file rm_operator.cpp.

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

                                               {
    if ( a_medium.barcode.length() == 0 ) {
        //a_medium.barcode = makeBarcode();
    };
    a_medium.status = rmdb_INIT_MEDIUM_STATUS;
}

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

Definition at line 3600 of file rm_operator.cpp.

References rm_MediumVol::status.

                                                     {

    a_mediumVol.status = rmdb_INIT_MEDIUMVOL_STATUS;
}

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

Definition at line 1278 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, and rm_ColMediaVol::Select().

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

                                                                              {
    log_FUNC_A_m(CheckAndAdd, "ColMediaVol");
    try {
        rm_ColMediaVol cmv(a_colMediaVol);
        try {
            cmv.Select(cmv.m_minColId, cmv.m_mediaKey, cmv.m_medVolNr);
        }
        catch (ivd_Exception &e) {
            if (e.GetError() == SQL_NOTFOUND){
                cmv.Insert();
                rm_Medium m(cmv.m_mediaKey);
                ostringstream sstr;
                sstr << "Added volume: " << cmv.m_medVolNr << " to collocation set: " << cmv.m_minColId;
                if ((a_flags & API_FLAG_EXCLUSIVE) == API_FLAG_EXCLUSIVE) {
                    sstr << " (exclusive)";
                }
                log_WriteEvent(sstr.str(), "", 0, m.barcode);
            }
            else {
                throw;
            }
        }
    } rm_CATCH_DB_THROW_IVD_m;
}

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 4631 of file librmdb.exx.

References dbg_LOW, dbg_NORM, errorDesc(), evt_WARNING, 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_UNRELIABLE, rmdb_MEDIUM_UNUSABLE, rm_Drive::SelectForOperation(), SQL_CHECK_M, SQL_NOTFOUND, and rm_Library::status.

Referenced by AllocateMigDefault().

                                                                            {
    log_FUNC_m(CheckForAnyResourceForMig);

    bool statusSet(false);
    rm_MediaPool pool(res.poolKey);

    //this work only if all media are in the same library
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    UInt32_t mms = rmdb_MEDIUM_FULL | rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_UNUSABLE | rmdb_MEDIUM_OFFLINE;

    EXEC SQL
        DECLARE IS_THERE_MEDIA_FOR_MIGRATION CURSOR FOR
        SELECT LIBRARYKEY FROM MEDIA
            WHERE
                MEDIA.MEDIAPOOLKEY = :res.poolKey AND
                bin_and(MEDIA.STATUS, :mms) = 0
            ORDER BY DRIVEKEY DESC;
    EXEC SQL
        OPEN TRANSACTION readWriteTrans
        IS_THERE_MEDIA_FOR_MIGRATION;


    UInt32_t libraryKey(0);

    EXEC SQL
        FETCH IS_THERE_MEDIA_FOR_MIGRATION
        INTO :libraryKey;

    if (SQLCODE == SQL_NOTFOUND) {
        rm_MediaPool mp(res.poolKey);
        string poolName(mp.mediaPoolName);
        log_DBG_m(dbg_LOW,"No media available for migration");

        if (!a_online || (mp.mediaFamily == mf_DISK) ){
            //report only when doing second run (offline/nearline media)
            // for disk we do only one run, so report immediately
            log_WriteEvent(evt_WARNING, "No media available for migration.", "", 0, poolName);
        }
        res.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
        statusSet = true;
    }

    EXEC SQL
        CLOSE IS_THERE_MEDIA_FOR_MIGRATION;
    string sqlErrDesc = errorDesc(SQLCODE, "Check for any medium");
    try {
        SQL_CHECK_M( sqlErrDesc );
    } catch (ivd_Exception &e) {
        log_ERR_m(e);
    }

    if (statusSet) return;

    //check if media are busy but are not full/unusable/unreliable

    //this work only if all media are in the same library
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    UInt32_t mmsuse = rmdb_MEDIUM_IN_USE;

    EXEC SQL
        DECLARE IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY CURSOR FOR
        SELECT LIBRARYKEY FROM MEDIA
            WHERE
                MEDIA.MEDIAPOOLKEY = :pool.mediaPoolKey AND
                bin_and(MEDIA.STATUS, :mms) = 0 AND
                bin_and(MEDIA.STATUS, :mmsuse) = 0

            ORDER BY DRIVEKEY DESC;
    EXEC SQL
        OPEN TRANSACTION readWriteTrans
        IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY;

    EXEC SQL
        FETCH IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY
        INTO :libraryKey;

    if (SQLCODE == SQL_NOTFOUND) {
        string poolName(pool.mediaPoolName);
        log_DBG_m(dbg_LOW,"No notbusy media available for migration");

        res.resourceBusyStatus = i_MEDIUM_BUSY;
        statusSet = true;
    }

    EXEC SQL
        CLOSE IS_THERE_MEDIA_FOR_MIGRATION_NOT_BUSY;

    string sqlErrDesc1 = errorDesc(SQLCODE, "Check for busy medium");
    try {
        SQL_CHECK_M( sqlErrDesc1 );
    } catch (ivd_Exception &e) {
        log_ERR_m(e);
    }

    if (statusSet) return;

    //there are media, now check for drives
    rm_Drive drives;
    vector<rm_Drive> selDrive;

    if (libraryKey > 0) {
        rm_Library lib(libraryKey);
        if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
            log_DBG_m(dbg_LOW,"Library disabled or Error. Can not allocate resources.");
            res.resourceBusyStatus = i_LIBRARY_NOT_AVAILABLE;
            return;
        }

        selDrive = drives.SelectForOperation(   libraryKey,
                                                pool.mediaFamily,
                                                0,
                                                true);
        if (selDrive.size() == 0){
            log_DBG_m(dbg_NORM, "Setting i_DRIVE_NOT_AVAILABLE ");
            res.resourceBusyStatus = i_DRIVE_NOT_AVAILABLE;
        } else {
            log_DBG_m(dbg_NORM, "Setting i_DRIVE_BUSY");
            res.resourceBusyStatus = i_DRIVE_BUSY;
        }
    }
}

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 4321 of file librmdb.exx.

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

Referenced by SelectMediumForMig().

                                                     {
    log_FUNC_m(CheckMediumFull);
    vector<rm_MediumVol> mvv;
    rm_MediumVol mv;
    mvv = mv.SelectByMedium(a_mediumKey);

    for (UInt32_t i(0); i < mvv.size(); ++i) {

        if  ( (mvv[i].volType != rmdb_SYSTEM_VOLUME) &&
             !(mvv[i].status & rmdb_MEDVOL_FULL)) {
                log_DBG_m(dbg_DETAIL,"Medium still has free volumes. MediumKey:" << a_mediumKey <<
                                  " volNum:" << mvv[i].medVolNr);
                return false;
            }
    }
    log_DBG_m(dbg_LOW,"Medium Full or uninitialized. MediumKey:" << a_mediumKey);
    return true;
}

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 2858 of file rm_operator.cpp.

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

Referenced by dbo_ClearRecoveryFlag::Process().

                                                      {

    log_FUNC_m(ClearRecoveryFlag);
    try {
        rm_String medVolId(ivd_UUID_STR_SIZE_d);
        medVolId = a_medVolId;
        rm_MediumVol mv;
        mv.SelectByMedVolId(medVolId);
        log_DBG_m(dbg_DETAIL,"before mv.status = " << mv.status );
        mv.status = mv.status & ~(rmdb_MEDVOL_RECOVER);
        log_DBG_m(dbg_DETAIL,"after mv.status = " << mv.status );
        mv.Update();
    } rm_CATCH_DB_THROW_IVD_m;

}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 4158 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, rmdb_DRIVE_DISABLED, rmdb_DRIVE_ERROR, rmdb_MEDIUM_IN_USE, rmdb_MEDIUM_OFFLINE, rmdb_MEDIUM_UNUSABLE, rmdb_MEDVOL_REORG_INREORG, rmdb_MEDVOL_REORG_RECYCLED, rm_Medium::Select(), rm_MediumPos_t::splitOffset, rm_MediumPos_t::splitSize, rm_MediumVol::status, rm_Drive::status, and rm_Medium::status.

Referenced by dbo_GetBestCopy::Process().

                                                                {
    log_FUNC_m(GetBestCopy);

    try {

        //Filter if Copy is on a set of usable Medium
        rm_CopiesPos_v_t selMediumTable;
        bool allMediumUsable = true;

        log_DBG_m(dbg_DETAIL,"Search for set of splits on usable medium");

        //*** Search for set of splits on free medium
        log_DBG_m(dbg_DETAIL,"a_mediumTable.size()" << a_mediumTable.size());

        for (unsigned int i = 0; i < a_mediumTable.size() ; i++ ){ //for each copy (set of splits)

            for (unsigned int j = 0; j < a_mediumTable[i].mediumPos.size(); j++){ //for each split

                rm_MediumPos_t & medPos = a_mediumTable[i].mediumPos[j];

                log_DBG_m(dbg_DETAIL,"Check if medium with following info exists:" << endl <<
                    "Media Key: " << medPos.mediumKey << endl <<
                    "Medium Volume number: " << medPos.medVolNr << endl <<
                    "Block Offset: " << medPos.blockOffset << endl <<
                    "Split Offset: " << medPos.splitOffset << endl <<
                    "Split Size: " << medPos.splitSize);

                try {
                    ipc_EXEC_m(
                        medPos.medium.Select(medPos.mediumKey);
                    )
                } catch(ivd_Exception &e) {
                    log_DBG_m(dbg_DETAIL,e);
                    if (e.GetError() == SQL_NOTFOUND){
                        allMediumUsable = false;
                        log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum);
                        log_DBG_m(dbg_NORM,"Medium does not exist in RMDB. Will try recall from additioanl copy");
                        break;
                    }
                    else {
                        throw;
                    }
                }

                if ( (medPos.medium.status & rmdb_MEDIUM_UNUSABLE) != 0 ) {
                    log_DBG_m(dbg_LOW,"medium:" << medPos.medium.mediumKey <<
                                        " is marked as UNUSABLE");

                    allMediumUsable = false;
                    log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
                    break;
                }

                if ( (medPos.medium.status & rmdb_MEDIUM_OFFLINE) != 0 ) {
                    log_DBG_m(dbg_LOW,"medium:" << medPos.medium.mediumKey <<
                                        " is marked as OFFLINE");

                    allMediumUsable = false;
                    log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
                    break;
                }

                // if it is not disk media
                if (ivd_MediaType_e(medPos.medium.mediumType) != mt_DISK) {
                    //check if medium is offline
                    log_DBG_m(dbg_NORM,"medPos.medium.libraryKey:" << medPos.medium.libraryKey );
                    if ( medPos.medium.libraryKey  == -1 ) {
                        log_DBG_m(dbg_LOW,"medium:" << medPos.medium.mediumKey <<
                                            " is OFFLINE");

                        allMediumUsable = false;
                        log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
                        break;
                    }
                }

                if (medPos.medium.driveKey > 0){ //check if medium is in unusable drive
                    rm_Drive d(medPos.medium.driveKey);
                    if ( (d.status & rmdb_DRIVE_DISABLED) ||
                        (d.status & rmdb_DRIVE_ERROR) ) {

                        ostringstream msg;
                        msg << "Medium " << medPos.medium.barcode <<
                            " is inserted in unusable drive. Please unload.";

                        log_WriteEvent(msg.str(), "DRIVE", 0, string(d.driveName));
                        log_ERR_m(msg.str());

                        allMediumUsable = false;
                        log_DBG_m(dbg_NORM,"Can not use row:" <<
                                            a_mediumTable[i].rowNum <<
                                            " drive is unusable");
                        break;
                    }
                }
                //select volume and check if it is in reorg
                rm_MediumVol mv(medPos.mediumKey, medPos.medVolNr);
                if ( (mv.status & rmdb_MEDVOL_REORG_INREORG) ||
                    (mv.status & rmdb_MEDVOL_REORG_RECYCLED) ){
                    log_DBG_m(dbg_LOW,"mediumVol for medium:" << medPos.medium.mediumKey <<
                        " is marked as in_reorg or recycled");

                    allMediumUsable = false;
                    log_DBG_m(dbg_NORM,"Can not use row:" << a_mediumTable[i].rowNum );
                    break;
                }
            }
            if ( allMediumUsable ) {
                    log_DBG_m(dbg_DETAIL, "Row " << a_mediumTable[i].rowNum << " can be used");
                    if (a_mediumTable[i].mediumPos.size() == 0)
                        throw ivd_InternalError(ie_FATAL_ERROR, "position without split");
                    //is this copy on Disk medium?
                    if (ivd_MediaType_e(a_mediumTable[i].mediumPos[0].medium.mediumType) == mt_DISK) {
                        //Yes it is. Give it to me baby ...
                        return i;
                    }

                    selMediumTable.push_back(a_mediumTable[i]);
            }
            allMediumUsable = true;
        }

        //Filter out set with least number of splits
        if (selMediumTable.size() == 0) {
        stringstream sStr;
        sStr << "No usable (marked good, unreliable or online) media found for recall!";
        log_WriteEvent(evt_WARNING, sStr.str());
        throw ivd_Error(ie_NO_RESOURCE_FOUND, "No copy is on a usable set of media");
        }


        //Filter out set with least number of splits
        log_DBG_m(dbg_DETAIL,"will filter out set with at least splits");

        UInt32_t minNumOfSplits = selMediumTable[0].mediumPos.size();
        UInt32_t bestTmp(selMediumTable[0].rowNum);

        for (UInt32_t i = 0; i < selMediumTable.size(); i++) {
            if ( selMediumTable[i].mediumPos.size() < minNumOfSplits ) {
                minNumOfSplits = selMediumTable[i].mediumPos.size();
                bestTmp = selMediumTable[i].rowNum;
            }
        }

        log_DBG_m(dbg_DETAIL,"Selected copy by NumOfSplits " << bestTmp);


        //select split with first medium not in use and loaded
        for (UInt32_t i = 0; i < selMediumTable.size(); i++) {
            if (    (selMediumTable[i].mediumPos.size() == minNumOfSplits) &&
                    ((selMediumTable[i].mediumPos[0].medium.status & rmdb_MEDIUM_IN_USE) == 0 ) &&
                    (selMediumTable[i].mediumPos[0].medium.driveKey > 0) ) {
                log_DBG_m(dbg_DETAIL, "first medium not in use and loaded "
                                        << selMediumTable[i].rowNum);
                return selMediumTable[i].rowNum;
            }
        }
        //select split with first medium not in use
        for (UInt32_t i = 0; i < selMediumTable.size(); i++) {
            if (    (selMediumTable[i].mediumPos.size() == minNumOfSplits) &&
                ((selMediumTable[i].mediumPos[0].medium.status & rmdb_MEDIUM_IN_USE) == 0 )) {
                    return selMediumTable[i].rowNum;
                }
        }
        return bestTmp;
    } rm_CATCH_DB_THROW_IVD_m;

}

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 945 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().

                                                     {
    log_FUNC_m(GetHost);

    rm_DriveHost dh;
    dh.StartSelectAll();
    dh.driveKey = 0;
    try {
        while (dh.driveKey != a_driveKey) {
            dh.Next();
        }
        dh.EndSelectAll();

    } catch (ivd_DBException e) {
        if (e.GetError() == 100) {
            log_ERR_m("ADMIN JOB: No DriveHost found for selected device." << e);
        }
        else {
            throw;
        }
    }
    log_DBG_m(dbg_DETAIL,   endl <<
                            "Found ctrlDevice for Drive: " << a_driveKey << endl <<
                            "ControlDevice: " << dh.controlDevice <<
                            " on Host: " << dh.host );
    i_DriveHost_t idh;
    idh.controlDevice = CORBA::string_dup(dh.controlDevice.cvalue_p);
    rm_Drive d(a_driveKey);
    idh.driveName = CORBA::string_dup(d.driveName.cvalue_p);
    idh.host = CORBA::string_dup(dh.host.cvalue_p);
    return idh;

}

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 2505 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_MinorCol::Select(), rm_MediumVol::SelectByMedium(), rm_Medium::SelectByPartition(), rm_ColMediaVol::SelectByVolume(), and i_Medium_t::status.

Referenced by dbo_GetMediaInfo::Process().

                                                                {
    log_FUNC_m(GetMediaInfo);
    i_MediaInfoSeq_t i_medInfoSeq;
    try {
        rm_Medium medium;
        vector<rm_Medium> mediumVec;
        mediumVec = medium.SelectByPartition(a_partName);
        i_Medium_t media;
        media = medium.Convert2Corba();
        i_medInfoSeq.length(mediumVec.size());
        // all media on partition
        for (UInt32_t i = 0; i < mediumVec.size(); i++) {
            rm_MediumVol mediumVol;
            vector<rm_MediumVol> mVVec;
            mVVec = mediumVol.SelectByMedium(mediumVec[i].mediumKey);
            i_medInfoSeq[i].media.mediumKey     = mediumVec[i].mediumKey;
            i_medInfoSeq[i].media.mediaPoolName = media.mediaPoolName;
            i_medInfoSeq[i].media.barcode       = CORBA::string_dup(mediumVec[i].barcode.c_str());
            i_medInfoSeq[i].media.status        = media.status;

            i_medInfoSeq[i].volumeInfoList.length(mVVec.size());
            // all medium volumes for selected medium
            for (UInt32_t j = 0; j < mVVec.size(); j++) {
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.medVolNr  = mVVec[j].medVolNr;
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.status    = mVVec[j].status;
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.medVolId  = CORBA::string_dup(mVVec[j].medVolId.c_str());
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.volSize   = mVVec[j].volSize;
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.volUsed   = mVVec[j].volUsed;
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.validData = mVVec[j].validData;
                i_medInfoSeq[i].volumeInfoList[j].mediaVol.totalData = mVVec[j].totalData;

                rm_ColMediaVol cmv;
                vector<rm_ColMediaVol> cmvVec;
                cmvVec = cmv.SelectByVolume(mediumVec[i].mediumKey, mVVec[j].medVolNr);
                // all entries in colmediavol table for selected medium volume
                i_medInfoSeq[i].volumeInfoList[j].minorColList.length(cmvVec.size());
                for (UInt32_t k = 0; k < cmvVec.size(); k++) {
                    rm_MinorCol minCol;
                    minCol.Select(cmvVec[k].m_minColId);
                    log_DBG_m(dbg_NORM, "Available nr." << k << " :" << endl
                                               << " mediaKey  : " << mediumVec[i].mediumKey <<  endl
                                               << " Pool      : " << media.mediaPoolName << endl
                                               << " barcode   : " << mediumVec[i].barcode << endl
                                               << " MedStatus : " << media.status << endl
                                               << " medVolId  : " << mVVec[j].medVolId << endl
                                               << " medVolNr  : " << mVVec[j].medVolNr << endl
                                               << " VolStatus : " << mVVec[j].status << endl
                                               << " VolSize   : " << mVVec[j].volSize << endl
                                               << " VolUsed   : " << mVVec[j].volUsed << endl
                                               << " validData : " << mVVec[j].validData << endl
                                               << " totalData : " << mVVec[j].totalData << endl
                                               << " minColId  : " << minCol.m_minColId << endl
                                               << " flags     : " << minCol.m_flags << endl
                                               << " majColId  : " << minCol.m_majColId << endl );

                    i_medInfoSeq[i].volumeInfoList[j].minorColList[k].minColId = minCol.m_minColId;
                    i_medInfoSeq[i].volumeInfoList[j].minorColList[k].flags = minCol.m_flags;
                    i_medInfoSeq[i].volumeInfoList[j].minorColList[k].majColId = minCol.m_majColId;
                }
            }
        }
        return i_medInfoSeq;
    }rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllDrive (  )  [private]

Definition at line 5032 of file librmdb.exx.

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

Referenced by dbo_InitAllResource::Process().

                              {
    log_FUNC_m(InitAllDrive);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DECLARE INIT_ALL_DRIVE CURSOR FOR
            SELECT STATUS FROM DRIVE WHERE DRIVE.STATUS != 0;

    EXEC SQL
        OPEN TRANSACTION readWriteTrans INIT_ALL_DRIVE;

    while (1) {
        UInt32_t cStatus = 0;
        EXEC SQL
            FETCH
            INIT_ALL_DRIVE INTO :cStatus;

        log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on INIT_ALL_DRIVE: " << SQLCODE);

        if (SQLCODE != 0) break;
        log_DBG_m(dbg_DETAIL,"Updating drive status");

        UInt32_t newStatus = cStatus & ~(rmdb_DRIVE_IN_USE);
        if (newStatus != cStatus){

            EXEC SQL
            UPDATE TRANSACTION readWriteTrans
            DRIVE SET
            STATUS = :newStatus
            WHERE CURRENT OF INIT_ALL_DRIVE;

            if (SQLCODE != 0) break;
        }
    }
    string sqlErrDesc = errorDesc(SQLCODE, "Setting all DRIVE status to INIT_DRIVE_STATUS");
    SQL_CHECK_M( sqlErrDesc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllDriveHost (  )  [private]

Definition at line 5072 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

                                  {
    log_FUNC_m(InitAllDriveHost);
    throw ivd_Error( ie_NYI, "Not Yet Implemented" );
}

void rm_Operator::InitAllDSS (  )  [private]

Definition at line 5077 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

                            {
    log_FUNC_m(InitAllDSS);
    throw ivd_Error( ie_NYI, "Not Yet Implemented" );
}

void rm_Operator::InitAllLibrary (  )  [private]

Definition at line 5019 of file librmdb.exx.

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

                                {
    log_FUNC_m(InitAllLibrary);
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;
    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        LIBRARY SET
        STATUS = :rmdb_INIT_LIBRARY_STATUS;

    string sqlErrDesc = errorDesc(SQLCODE,"Setting all Library status to rmdb_INIT_LIBRARY_STATUS");
    SQL_CHECK_M( sqlErrDesc );
}

Here is the call graph for this function:

void rm_Operator::InitAllMediaPool (  )  [private]

Definition at line 5087 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

                                  {
    log_FUNC_m(InitAllMediaPool);
    throw ivd_Error( ie_NYI, "Not Yet Implemented" );
}

void rm_Operator::InitAllMedium (  )  [private]

Definition at line 5092 of file librmdb.exx.

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

Referenced by dbo_InitAllResource::Process().

                               {
    log_FUNC_m(InitAllMedium);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DECLARE INIT_ALL_MEDIA CURSOR FOR
            SELECT STATUS FROM MEDIA WHERE MEDIA.STATUS != 0;

    EXEC SQL
        OPEN TRANSACTION readWriteTrans INIT_ALL_MEDIA;

    while (1) {
        UInt32_t cStatus = 0;
        EXEC SQL
            FETCH
            INIT_ALL_MEDIA INTO :cStatus;

        log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on INIT_ALL_MEDIA: " << SQLCODE);

        if (SQLCODE != 0) break;

        UInt32_t newStatus = cStatus & ~(rmdb_MEDIUM_IN_USE);
        if (   ((newStatus & ms_UNUSABLE) == ms_UNUSABLE)
            && ((newStatus & ms_UNRELIABLE) == ms_UNRELIABLE) ){
            //clear unreliable flag if unusable is set
            newStatus = newStatus & ~ms_UNRELIABLE;
        }
        if ( ((newStatus & ms_OPEN) == ms_OPEN) &&
             ((newStatus & ms_FULL) == ms_FULL) ){
            //clear open flag if full is set
            newStatus = newStatus & ~(ms_OPEN);
        }

        log_DBG_m(dbg_DETAIL, "Medium status changed from " << cStatus <<
            " to " << newStatus);
        //it is not possible to get barcode (for logging)
        //without reading it from database here :(


        if (newStatus != cStatus){

            EXEC SQL
            UPDATE TRANSACTION readWriteTrans
            MEDIA SET
            STATUS = :newStatus
            WHERE CURRENT OF INIT_ALL_MEDIA;

            if (SQLCODE != 0) break;
        }
    }
    string sqlErrDesc = errorDesc(SQLCODE, "Setting all MEDIA status to INIT_MEDIA_STATUS");
    SQL_CHECK_M( sqlErrDesc );

}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllMediumVol (  )  [private]

Definition at line 5149 of file librmdb.exx.

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

Referenced by dbo_InitAllResource::Process().

                                  {
    log_FUNC_m(InitAllMediumVol);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DECLARE INIT_ALL_MEDIA_VOL CURSOR FOR
        SELECT STATUS FROM MEDIAVOL WHERE MEDIAVOL.STATUS > 1;

    EXEC SQL
        OPEN TRANSACTION readWriteTrans INIT_ALL_MEDIA_VOL;

    while (1) {
        UInt32_t cStatus = 0;
        EXEC SQL
            FETCH
            INIT_ALL_MEDIA_VOL INTO :cStatus;

        log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on INIT_ALL_MEDIA_VOL: " << SQLCODE);

        if (SQLCODE != 0) break;

        log_DBG_m(dbg_DETAIL,"cStatus: " << cStatus);
        UInt32_t newStatus = cStatus & ~(rmdb_MEDVOL_REORG_INREORG);
        log_DBG_m(dbg_DETAIL,"newStatus: " << newStatus);
        if ( ((newStatus & mvs_OPEN) == mvs_OPEN) &&
             ((newStatus & mvs_FULL) == mvs_FULL) ){
            //clear open flag if full is set
            newStatus = newStatus & ~(mvs_OPEN);
        }
        log_DBG_m(dbg_DETAIL,"newStatus: " << newStatus);

        log_DBG_m(dbg_DETAIL, "Volume status changed from " << cStatus <<
            " to " << newStatus);
        //it is not possible to get volumeuuid (for logging)
        //without reading it from database here :(

        if (newStatus != cStatus){

            EXEC SQL
                UPDATE TRANSACTION readWriteTrans
                MEDIAVOL SET
                STATUS = :newStatus
                WHERE CURRENT OF INIT_ALL_MEDIA_VOL;

            if (SQLCODE != 0) break;
        }
    }
    string sqlErrDesc = errorDesc(SQLCODE,
                         "Setting all MEDIAVOL status to INIT_ALL_MEDIA_VOL");
    SQL_CHECK_M( sqlErrDesc );

}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Operator::InitAllSlot (  )  [private]

Definition at line 5082 of file librmdb.exx.

References ie_NYI, ivd_Error, and log_FUNC_m.

                             {
    log_FUNC_m(InitAllSlot);
    throw ivd_Error( ie_NYI, "Not Yet Implemented" );
}

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

Definition at line 3621 of file rm_operator.cpp.

References rm_Partition::Insert().

Referenced by dbo_InsertPartition::Process().

                                                     {
    try {
        a_part.Insert();
    } rm_CATCH_DB_THROW_IVD_m;
}

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 332 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_MAX_BARCODE, rmdb_MAX_DRIVEIDX, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, rmdb_REP_SLOT_TYPE_ID, 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, 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().

                                        {

    log_FUNC_A_m(InventoryUpdate, "lib: " << a_libName);


    log_DBG_m(dbg_NORM, "[type, slot, isFull, barcode, barcode2]"
                            );
    for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
        log_DBG_m(dbg_NORM, "[" <<
                            a_elemStatus[i].type << ", " <<
                            a_elemStatus[i].slot << ", " <<
                            a_elemStatus[i].isFull << ", " <<
                            a_elemStatus[i].barcode << ", " <<
                            a_elemStatus[i].barcode2 <<
                            "]"
                            );

    }

    UInt32_t slotStart = 0;

    // Skip the drives in the sequence. They are at the beginning of the list.
    // THEY MUST BE.
    for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
        if (a_elemStatus[i].type != elem_DRIVE) {
            slotStart = i;
            break;
        }
    }

    set<UInt32_t> processed;

    rm_String libName(rmdb_MAX_LIBRARYNAME);
    rm_String slotAddr(rmdb_MAX_SLOTADDR);
    rm_String medBarcode(rmdb_MAX_BARCODE);

    rm_Library lib;
    libName = a_libName;
    lib.SelectByName(libName);

    // Process slots first.
    // Do rebindings and clean drive key bindings.
    for (UInt32_t i = slotStart; i < a_elemStatus.length(); i++) {
        const i_SlotUpdate_t &elem = a_elemStatus[i];

        log_DBG_m(dbg_NORM,
            elem.slot << " \"" << elem.barcode << "\": Processing." );

        // Get slot record
        slotAddr = string(elem.slot);
        rm_Slot  slot;
        try {
            // TODO Make difference between slot and mail slot

//            typedef enum {
//                /// All elements (CDB only)
//                et_ALL          = 0x00,
//                /// Medium transport
//                et_TRANSPORT    = 0x01,
//                /// Storage element (slot)
//                et_SLOT         = 0x02,
//                /// Import/export element
//                et_IMPEX        = 0x03,
//                /// Data transfer (tape drive)
//                et_DRIVE        = 0x04
//            } ElemType_t;


            UInt32_t slotType(0);

            switch (elem.type) {
                case(0x02): {
                                slotType = rmdb_REP_SLOT_TYPE_ID;
                                break;
                            }
                case(0x03): {
                                slotType = rmdb_MAIL_SLOT_TYPE_ID;
                                break;
                            }
                case(0x04): {
                                log_DBG_m(dbg_LOW, "Last element is drive.");
                                continue;
                            }
                default:    {
                                log_ERR_m("Slot: "<< elem.slot <<
                                      ", has unknown type.");
                                continue;
                            }
            }


            slot.SelectByLibAddrType(
                lib.libraryKey, slotAddr, slotType);

            // Check if Slot was full before Inventory
            try {
                rm_Medium tmpMed;
                tmpMed.SelectBySlot(slot.slotKey);
                slot.status = rmdb_SLOT_FREE;
                slot.Update();

                tmpMed.slotKey = -1;
                tmpMed.libraryKey = -1;
                tmpMed.Update();
            }
            catch (ivd_DBException &de) {
                log_DBG_m(dbg_NORM,
                    "DB Exception querying medium in slot " << elem.slot <<
                    ". Slot was probably empty before Inventory. " << de);
            };

        }
        catch (ivd_DBException) {
            log_DBG_m(dbg_NORM, "Library: " << libName << ", Slot: " <<
                                elem.slot << " does not exist in " <<
                                "current Library Configuration.");
            continue;
        };

        if (elem.isFull) {
            medBarcode = string(elem.barcode);

            // if empty barcode -> just mark it as in use
            if (medBarcode.empty()) {
                slot.status = rmdb_SLOT_IN_USE;
                slot.Update();
                continue;
            }

            // Select medium that is currently in the slot
            rm_Medium medium;
            try {
                medium.SelectByBarcode(medBarcode);
            }
            catch (ivd_DBException &de) {
                log_DBG_m(dbg_NORM,
                    "DB Exception: Medium most probably not in RMDB. Barcode " << elem.barcode <<
                    " (Slot marked IN_USE).");

                if (de.GetError() == SQL_NOTFOUND) {
                    log_DBG_m(dbg_LOW,
                        "Will add medium to RMDB: " << elem.barcode);

                    rm_Medium newMedium;
                    newMedium.barcode = string(elem.barcode);
                    newMedium.slotKey = slot.slotKey;
                    newMedium.mediumKey = 0; // New will be generated.

                    // Keys
                    newMedium.mediaPoolKey = -1;
                    newMedium.libraryKey = lib.libraryKey;
                    newMedium.diskSubsysKey = -1;
                    newMedium.driveKey = -1;

                    // Defaults
                    newMedium.mediumType = 0;
                    newMedium.blockSize = 0;
                    newMedium.numOfVolumes = 0;
                    newMedium.idxOfSysVol = 0;
                    newMedium.sizeOfSysVol = 0;
                    newMedium.currentVolume = 0;

                    newMedium.status = 0;

                    newMedium.Insert();
                }
                slot.status = rmdb_SLOT_IN_USE;
                slot.Update();
                continue;
            };

            if (processed.find(medium.mediumKey) != processed.end() ) {
                // Medium already found in slots.
                // The same medium in another slot??? Log this.
                ostringstream sstr;
                sstr
                    << "Library: " << libName <<
                    ", Duplicate barcode reported from library. "
                    << "Slot #" << elem.slot;
                log_WriteEvent(evt_ERROR, sstr.str(), "", 0, medBarcode);
            }

            if (slot.slotKey != medium.slotKey) {

                rm_Medium oldMedium;

                // Can medium record of the medium, that was previously
                // in this slot, be found?
                bool oldMediumFound = false;

                try {
                    oldMedium.SelectBySlot(slot.slotKey);
                    oldMediumFound = true;

                    log_DBG_m(dbg_NORM,
                        slot.slotAddr << " " << medium.barcode <<
                        ": Binding (Previously here: " << oldMedium.barcode << ")." );
                }
                catch (ivd_DBException) {
                    log_DBG_m(dbg_NORM,
                        "DB Exception querying old medium in slot " << slot.slotAddr <<
                        " Ignore.");
                };

                medium.slotKey = slot.slotKey;

                // Was oldMedium already processed?
                // If not, then clear previous medium's location.
                if (   oldMediumFound
                    && processed.find(oldMedium.mediumKey) == processed.end()) {

                    log_DBG_m(dbg_DETAIL,
                        oldMedium.barcode << ": Clearing location. Medium position changed.");

                    if (oldMedium.driveKey > 0) {
                        log_DBG_m(dbg_DETAIL,
                            oldMedium.barcode <<
                            ": Medium most probably in drive. Will get new HOME slot.");
                    }

                    oldMedium.slotKey = -1, oldMedium.driveKey = -1, oldMedium.libraryKey = -1;
                    oldMedium.Update();
                }
                slot.status = rmdb_SLOT_IN_USE;
                slot.Update();
            }
            else {
                log_DBG_m(dbg_NORM,
                    slot.slotAddr << " " << medium.barcode <<
                    ": No update necessary." );
            }

            // TODO: Library key is most probably unnecessary in
            // the medium record. Library is accessible via
            // slot key.
            medium.libraryKey = lib.libraryKey;

            // Clear driveKey. Proper keys will be assigned in the next step.
            medium.driveKey = -1;
            medium.Update();

            processed.insert(medium.mediumKey);
        } // if (elem.isFull)
        else {
            // Slot is currently empty.
            rm_Medium oldMedium;
            try {
                oldMedium.SelectBySlot(slot.slotKey);
            }
            catch (ivd_DBException) {
                log_DBG_m(dbg_NORM,
                    "DB Exception querying previous medium in slot " << elem.slot <<
                    " Marking slot free.");

                slot.status = rmdb_SLOT_FREE;
                slot.Update();

                continue;
            };

            // Was oldMedium already processed?
            // If not, then clear previous medium's location.
            if (processed.find(oldMedium.mediumKey) == processed.end() ) {

                if (oldMedium.driveKey < 1) {
                    log_DBG_m(dbg_DETAIL,
                        oldMedium.barcode <<
                        ": Clearing location. Medium location currently unknown.");

                    oldMedium.slotKey = -1, oldMedium.driveKey = -1, oldMedium.libraryKey = -1;
                    oldMedium.Update();
                }
                else {
                    log_DBG_m(dbg_DETAIL,
                        oldMedium.barcode <<
                        ": Won't delete slot. Tape may be in drive.");
                }
            }

            if (oldMedium.driveKey < 1) {
                log_DBG_m(dbg_DETAIL,
                    slot.slotAddr << ": Slot marked as FREE. Tape not in drive.");

                slot.status = rmdb_SLOT_FREE;
                slot.Update();
            }
            else {
                log_DBG_m(dbg_DETAIL,
                    slot.slotAddr << ": Slot not marked as free. Tape may be in drive.");
            }
        } // else
    } // for i

    // Check the drives.
    // Assign HOME slots to those medium that don't have any.
    for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
        if (a_elemStatus[i].type != elem_DRIVE) {
            log_DBG_m(dbg_DETAIL, "All drives processed.");
            break;
        }
        bool driveFound(false);

        const i_SlotUpdate_t &elem = a_elemStatus[i];

        rm_String driveAddr(rmdb_MAX_DRIVEIDX);
        driveAddr = elem.slot;
        rm_Drive drive;
        try {
            log_DBG_m(dbg_DETAIL,"Selecting drive addr: " << driveAddr <<
                                    " LibraryKey: " <<lib.libraryKey);

            drive.SelectByAddr(lib.libraryKey, driveAddr);
            driveFound = true;
        }
        catch (ivd_DBException) {
            log_DBG_m(dbg_NORM,
                "DB Exception querying drive " << elem.slot <<
                " Skipping.");
        };

        //if (driveFound && !elem.isFull) {
        if (driveFound) {

            if (elem.isFull) {

                log_DBG_m(dbg_NORM,
                    elem.slot << ": Drive full." );
            }
            else {

                log_DBG_m(dbg_NORM,
                    elem.slot << ": Drive empty." );
            }

            // select Medium By this drive and clear drivekey if equal to this drivekey
            try {
                log_DBG_m(dbg_DETAIL,"Selecting drive addr: " << driveAddr <<
                                        " LibraryKey: " << lib.libraryKey);

                rm_Medium m;
                m.SelectByDrive(drive.driveKey);
                if (m.barcode != string(elem.barcode)) {
                    log_DBG_m(dbg_DETAIL,"Clearing DriveKey from Medium " << m.barcode);

                    m.driveKey = 0;
                    m.Update();
                }
            }
            catch (ivd_DBException) {
                log_DBG_m(dbg_NORM,
                    "No medium assigned to Drive.");
            };
        }

        log_DBG_m(dbg_NORM,
            elem.slot << " " << elem.barcode << ": Processing (drive)." );

        medBarcode = string(elem.barcode);
        rm_Medium medium;

        // if empty barcode & drive empty -> continue
        if (!elem.isFull){
            continue;
        }
        else if (medBarcode.empty()) {
            ostringstream str;
            str <<"Library: " << libName <<
                ", Medium does not have a barcode. Drive #" << elem.slot;
            log_WriteEvent(evt_ERROR, str.str());
            continue;
        }

        try {
            medium.SelectByBarcode(medBarcode);
        }
        catch (ivd_DBException &de) {
            log_DBG_m(dbg_NORM,
                "DB Exception: Medium most probably not in RMDB. Barcode " << medBarcode );

                if (de.GetError() == SQL_NOTFOUND) {
                    log_DBG_m(dbg_LOW,
                        "Will add medium to RMDB: " << medBarcode);

                    medium.barcode = medBarcode;
                    medium.slotKey = -1;
                    medium.mediumKey = 0; // New will be generated.

                    // Keys
                    medium.mediaPoolKey = -1;
                    medium.libraryKey = -1;
                    medium.diskSubsysKey = -1;
                    medium.driveKey = -1;

                    // Defaults
                    medium.mediumType = 0;
                    medium.blockSize = 0;
                    medium.numOfVolumes = 0;
                    medium.idxOfSysVol = 0;
                    medium.sizeOfSysVol = 0;
                    medium.currentVolume = 0;

                    medium.status = 0;

                    medium.Insert();
                    medium.SelectByBarcode(medBarcode);
                }
        };

        if (processed.find(medium.mediumKey) != processed.end() ) {
            // Medium already found in slots.
            // The same medium in drive??? Log this.
            ostringstream sstr;
            rm_Drive drv;
            rm_String drvAddr(rmdb_MAX_DRIVEIDX);
            drvAddr = elem.slot;
            bool foundDrive(false);
            try {
                drv.SelectByAddr(lib.libraryKey, drvAddr);
                foundDrive = true;
            } catch (ivd_DBException e){
                log_ERR_m("Library: " << libName <<
                          ", not configured drive reported by inventory." <<
                          endl << e);
            }

            sstr.str("");
            sstr
                << "Library: " << libName << ", Duplicate barcode reported from library. "
                << "Drive: " << drv.driveName << ", barcode: " << medium.barcode ;
            log_WriteEvent(evt_ERROR, sstr.str(), "", 0, medium.barcode);

            //mark medium & drive as unusable
            if (foundDrive){
                drv.status = drv.status | rmdb_DRIVE_ERROR;
                drv.Update();
                sstr.str("");
                sstr << "Library: " << libName << ", Marking drive as Error " <<
                    "in order to prevent further failures.";
                    log_WriteEvent(evt_WARNING, sstr.str(), "", 0, drv.driveName);
            }

            medium.status = medium.status | rmdb_MEDIUM_UNUSABLE;
            medium.Update();
            sstr.str("");
            sstr << "Library: " << libName << ", Marking medium as Unusable " <<
                    " in order to prevent further failures.";
            log_WriteEvent(evt_WARNING, sstr.str(), "", 0, medium.barcode);
        }

        try {
            if (driveFound) {
                medium.driveKey = drive.driveKey;
                medium.Update();
            }
        }
        catch (ivd_DBException) {
            log_DBG_m(dbg_NORM,
                "DB Exception updating Medium " << elem.barcode <<
                ". Skipping.");
            continue;
        };

        if (medium.slotKey < 1) {
            // Medium in drive, but it does not have a "home" slot.
            for (UInt32_t f = slotStart; f < a_elemStatus.length(); f++) {
                const i_SlotUpdate_t &freeElem = a_elemStatus[f];
                if (!freeElem.isFull) {

                    // Get free slot record
                    rm_String freeSlotAddr(rmdb_MAX_SLOTADDR);
                    freeSlotAddr = string(freeElem.slot);
                    rm_Slot  freeSlot;

                    try {
                        freeSlot.SelectByLibAddrType(
                            lib.libraryKey, freeSlotAddr, rmdb_REP_SLOT_TYPE_ID);
                    }
                    catch (ivd_DBException) {
                        log_DBG_m(dbg_NORM,
                            "DB Exception querying for free slot " << freeElem.slot <<
                            ". Skip this slot.");
                        continue;
                    };

                    if (freeSlot.status == rmdb_SLOT_IN_USE) {
                        log_DBG_m(dbg_DETAIL,"Skipping reserved Slot (Addr): " << freeSlot.slotAddr);
                        continue;
                    }
                    medium.slotKey = freeSlot.slotKey;
                    medium.libraryKey = lib.libraryKey;
                    medium.Update();

                    freeSlot.status = rmdb_SLOT_IN_USE;
                    freeSlot.Update();

                    log_DBG_m(dbg_NORM,
                        freeSlot.slotAddr << " " << medium.barcode <<
                        ": Medium in drive got a HOME slot.");

                    processed.insert(medium.mediumKey);

                    slotStart = f+1;
                    break;
                }
            } // for f
        } // if (medium..
        else {
            log_DBG_m(dbg_DETAIL,
                medium.barcode << ": Medium already has a HOME slot.");
        }
    } // for i

    //Check if there are medium in rmdb that are assigned to this library
    i_MediumSeq_t medSeq = SelectAllMedium();
    for (UInt32_t m(0); m < medSeq.length(); m++){
        bool foundBC(false);
        for (UInt32_t i = 0; i < a_elemStatus.length(); i++) {
            string elBarcode(a_elemStatus[i].barcode);
            if ( elBarcode.compare(medSeq[m].barcode) == 0 )
                foundBC = true;
        }

        if (!foundBC && lib.libraryName.compare(medSeq[m].libraryName) == 0 ){
            log_DBG_m(dbg_NORM, "Medium: " << medSeq[m].barcode <<
                                " is assigned to " << lib.libraryName <<
                                ". Will unassign it NOW");
            medSeq[m].libraryName = CORBA::string_dup(ipc_nilStr);
            medSeq[m].slotAddr = CORBA::string_dup(ipc_nilStr);
            medSeq[m].slotType = 0;
            Update(medSeq[m]);
        }


    }
}

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 3642 of file rm_operator.cpp.

References rm_Drive::capabilities, and dc_WORM.

Referenced by AllocateAdmin(), and SelectDriveForMig().

                                             {
    return (a_drv.capabilities & dc_WORM);
}

Here is the caller graph for this function:

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

Definition at line 3647 of file rm_operator.cpp.

References rm_Medium::mediumType.

Referenced by AllocateAdmin(), and SelectDriveForMig().

                                               {
    return ivd_IsMediumTypeWORM(ivd_MediaType_e(a_med.mediumType));
}

Here is the caller graph for this function:

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

Definition at line 2813 of file rm_operator.cpp.

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

Referenced by dbo_IsSomeVolumeUsed::Process().

                                                     {

    log_FUNC_m(IsSomeVolumeUsed);

    vector<rm_MediumVol> rmMVVec;

    rm_String partName(rmdb_MAX_PARTITIONNAME);
    partName = a_partName;

    try {
        rm_MediumVol mv;
        rmMVVec = mv.SelectByPartition(partName);
    } catch (ivd_DBException& e) {
        if (e.GetError() == SQL_NOTFOUND) {

            //no volumes found for this partition
            log_DBG_m(dbg_LOW, "No volumes found for partition");
            return false;
        } else throw;
    }
    if (rmMVVec.empty()) {
        return false;
    }

    for (UInt32_t i = 0; i < rmMVVec.size(); i++) {
        if (rmMVVec[i].volUsed > 0) {
            return true;
        }
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Operator::MajorColIdMatches ( rm_Medium a_medium,
UInt64_t a_majColId 
) [private]

Definition at line 5604 of file librmdb.exx.

References rm_Medium::barcode, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), evt_WARNING, ie_RMDB_ERROR, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), rm_Medium::mediumKey, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, SQL_NOERROR, and SQL_NOTFOUND.

Referenced by SelectMediumForMig().

                                                                             {
    log_FUNC_m(MajorColIdMatches);

    Int32_t majHi = RMDB_COL_ID_HI(a_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(a_majColId);

    EXEC SQL
        SET TRANSACTION NAME readTrans
        READ ONLY
        ISOLATION LEVEL READ COMMITTED;

    EXEC SQL
        DECLARE SELECT_COLMEDIAVOL_MINORCOL CURSOR FOR
        SELECT MINORCOL.MAJCOLIDHI, MINORCOL.MAJCOLIDLO
            FROM MINORCOL, COLMEDIAVOL
        WHERE
            COLMEDIAVOL.MINCOLIDHI = MINORCOL.MINCOLIDHI AND
            COLMEDIAVOL.MINCOLIDLO = MINORCOL.MINCOLIDLO AND
            COLMEDIAVOL.MEDIAKEY = :a_medium.mediumKey;

    log_DBG_m(dbg_DETAIL,"will select all majColId for medium " << a_medium.barcode);

    if (SQLCODE != SQL_NOERROR) {
        log_DBG_m(dbg_DETAIL, "SQLERROR when declaring Cursor SELECT_COLMEDIAVOL_MINORCOL " << SQLCODE);
        throw ivd_Error(ie_RMDB_ERROR, "Declare SELECT_COLMEDIAVOL_MINORCOL Cursor failed");
    }

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_COLMEDIAVOL_MINORCOL;

    UInt64_t majColId(0);
    bool endOfCursor(false);
    bool mediumWithSeveralIDs(false);
    do {
        EXEC SQL
            FETCH SELECT_COLMEDIAVOL_MINORCOL
            INTO
                :majHi,
                :majLo;
        if (SQLCODE == SQL_NOERROR) {
            if (majColId == 0) {
                majColId = RMDB_COL_ID(majHi, majLo);
            }
            else {
                if (majColId != RMDB_COL_ID(majHi, majLo)) {
                    if (!mediumWithSeveralIDs) {
                        ostringstream msg;
                        msg << "Medium " << a_medium.barcode
                            << " has more than one major collocation id. Run reorganization to resolve it.";
                        log_WriteEvent(evt_WARNING, msg.str());
                        mediumWithSeveralIDs = true;
                    }
                    log_DBG_m(dbg_DETAIL, "Medium " <<a_medium.barcode
                                 << " additional majColID: " << RMDB_COL_ID(majHi, majLo));
                }
                // else the same major colID allowed
            }
        }
        else if (SQLCODE == SQL_NOTFOUND) {
            log_DBG_m(dbg_NORM,"Reached end of cursor. MajColID: " << majColId);
            endOfCursor = true;
        }
        else {
            log_DBG_m(dbg_LOW,"Fatal MinCol error sqlcode: " << SQLCODE);
            throw ivd_Error(ie_RMDB_ERROR,
                    "Fatal MinorCol select by majColId error sqlcode:"
                    + cmn_Num2Str((Int32_t)SQLCODE),
                    true);
        }
    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_COLMEDIAVOL_MINORCOL;
    string sqlErrDesc = errorDesc(SQLCODE, "SELECT_COLMEDIAVOL_MINORCOL");
    SQL_CHECKREAD_M(sqlErrDesc);

    return (((a_majColId == majColId) || (majColId == 0)) && (!mediumWithSeveralIDs));
} // bool rm_Operator::MajorColIdMatches()

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 83 of file rm_operator.cpp.

References dbg_DETAIL, rm_Medium::driveKey, rm_Drive::driveKey, rm_Library::libraryKey, log_DBG_m, log_FUNC_A_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().

                                                                                        {
    log_FUNC_A_m(MediumLoaded, "a_libName: " << a_libName <<
                               ", a_medBarcode: " << a_medBarcode <<
                               ", a_driveAddr: " << a_driveAddr);
    try {

        rm_Medium medium;
        rm_String barcode(rmdb_MAX_BARCODE);

        barcode = a_medBarcode;
        medium.SelectByBarcode(barcode);

        //medium.slotKey = -1;

        rm_String libName(rmdb_MAX_LIBRARYNAME);
        libName = a_libName;
        rm_Library library;
        library.SelectByName(libName);

        rm_String driveAddr(rmdb_MAX_DRIVEIDX);
        driveAddr = a_driveAddr;

        rm_Drive drive;
        drive.SelectByAddr(library.libraryKey, driveAddr);

        log_DBG_m(dbg_DETAIL,"New DriveKey = " << drive.driveKey);
        medium.driveKey = drive.driveKey;

        medium.Update();

    } rm_CATCH_DB_THROW_IVD_m;

}

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 117 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, rmdb_MAX_BARCODE, rmdb_MAX_LIBRARYNAME, rmdb_MAX_SLOTADDR, 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().

                                                                                                              {
    log_FUNC_m(MediumUnLoaded);
    try {


        rm_Medium medium;
        rm_String barcode(rmdb_MAX_BARCODE);

        barcode = a_medBarcode;
        medium.SelectByBarcode(barcode);

        medium.driveKey = -1;
        medium.status = medium.status & ~(rmdb_MEDIUM_IN_USE);

        rm_String libName(rmdb_MAX_LIBRARYNAME);
        libName = a_libName;
        rm_Library library;
        library.SelectByName(libName);

        if (!a_slotAddr.empty()) {
            rm_String slotAddr(rmdb_MAX_SLOTADDR);
            slotAddr = a_slotAddr;
            rm_Slot oldSlot;

            try {
                oldSlot.Select(medium.slotKey, library.libraryKey);
            } catch (ivd_DBException) {
                log_DBG_m(dbg_NORM, "medium has no home slot");
            }

            rm_Slot newSlot;
            bool newSlotExists(true);
            try {
                newSlot.SelectByLibAddrType(library.libraryKey, slotAddr, a_slotType);
            } catch (ivd_DBException) {
                ostringstream msg;
                msg << "New home slot does not exist in rmdb configuration. BC: " <<
                    medium.barcode << ".";
                log_ERR_m(msg.str());
                medium.libraryKey = -1;
                medium.slotKey = -1;
                newSlotExists = false;
            }

            if (newSlot.slotKey != oldSlot.slotKey) {
                log_WRN_m("Medium: " << medium.barcode << " changed home slot.");
                oldSlot.status &= rmdb_SLOT_FREE;
                oldSlot.Update();
                if (newSlotExists) {
                    medium.slotKey = newSlot.slotKey;
                    newSlot.status |= rmdb_SLOT_IN_USE;
                    newSlot.Update();
                }
            }
        }
        else {
            medium.slotKey = -1; // manual robot: just unloaded from drive
        }

        medium.Update();

    } rm_CATCH_DB_THROW_IVD_m;

}

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 5205 of file librmdb.exx.

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

Referenced by dbo_PoolInfo::Process().

                                                                                  {
    log_FUNC_A_m(PoolInfo, "Partition:" << a_partitionName);

    // This function fills all fields within struct i_PoolInfo_t directly from rmdb base

    EXEC SQL
        SET TRANSACTION NAME readTrans;

    EXEC SQL
        DECLARE POOLINFO CURSOR FOR
            SELECT
                MEDIAPOOL.MEDIAPOOLNAME, MEDIAPOOL.MEDIAPOOLKEY
            FROM
                MEDIAPOOL, PARTITION
            WHERE
                MEDIAPOOL.PARTITIONUUID = PARTITION.PARTUUID AND
                PARTITION.PARTNAME = :a_partitionName.cvalue_p
            ORDER BY MEDIAPOOL.MEDIAPOOLNAME;

    EXEC SQL
        OPEN TRANSACTION readTrans POOLINFO;

    vector<Int32_t> keys;
    while (1) {        // get all pool names and its keys that belong to some partition

        char poolNameVal[rmdb_MAX_MEDIAPOOLNAME];
        Int32_t poolKey;

        EXEC SQL
            FETCH
            POOLINFO INTO
                :poolNameVal,
                :poolKey;

        log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on POOLINFO: " << SQLCODE);
        if (SQLCODE != 0) break;

        log_DBG_m(dbg_DETAIL,"poolName:" << poolNameVal <<
                            " poolKey:" << poolKey );

        Int32_t size = a_poolInfo.length();
        a_poolInfo.length(size+1);
        a_poolInfo[size].poolName = CORBA::string_dup(poolNameVal);
        keys.push_back(poolKey);
    } // while end

    EXEC SQL
        CLOSE POOLINFO;

    string sqlErrDesc = errorDesc(SQLCODE,"CLOSE POOLINFO");
    SQL_CHECKREAD_M(sqlErrDesc);

    // for all pool keys that are found, execute different sql queries
    // and get correct numbers for media, media volumes and their statuses

    for (UInt32_t i = 0; i < keys.size(); ++i) {

        UInt32_t mediumUnreliableUnusableOffline (rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_UNUSABLE | rmdb_MEDIUM_OFFLINE);
        UInt32_t mediumUnusable (rmdb_MEDIUM_UNUSABLE);
        UInt32_t mediumUnreliable (rmdb_MEDIUM_UNRELIABLE);
        UInt32_t mediumOffline (rmdb_MEDIUM_OFFLINE);
        UInt32_t mediumVolFull (rmdb_MEDVOL_FULL);
        UInt32_t systemVolume (rmdb_SYSTEM_VOLUME);
        UInt32_t dataVolume (rmdb_DATA_VOLUME);
        Int32_t currentKey = keys[i];


        // Execute SELECT query for good sys volumes and return sysSize & sysAvailable
        // Do not perform calculation for media that are unusable or unreliable

        Int32_t sysSize(0);
        Int32_t sysAvailable(0);

        EXEC SQL
            SET TRANSACTION NAME readTrans;

        EXEC SQL
            DECLARE MEDIA_SYS_SIZES CURSOR FOR

            SELECT
                SUM(MEDIAVOL.VOLSIZE), SUM(MEDIAVOL.VOLSIZE - (MEDIAVOL.VOLSIZE * MEDIAVOL.VOLUSED /100 ))
            FROM
                MEDIA, MEDIAVOL
            WHERE
                MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY   AND
                MEDIA.MEDIAPOOLKEY = :currentKey      AND
                bin_and(MEDIA.STATUS, :mediumUnreliableUnusableOffline) = 0 AND
                MEDIAVOL.VOLTYPE = :systemVolume;

        EXEC SQL
            OPEN TRANSACTION readTrans MEDIA_SYS_SIZES;

        EXEC SQL
            FETCH MEDIA_SYS_SIZES INTO

                :sysSize,
                :sysAvailable;

        EXEC SQL
            CLOSE MEDIA_SYS_SIZES;

        sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_SYS_SIZES", currentKey);
        SQL_CHECKREAD_M( sqlErrDesc );

        a_poolInfo[i].sysSize = sysSize;
        a_poolInfo[i].sysAvailable = sysAvailable;


        // Execute SELECT query for good data volumes and return dataSize, even if media is full
        // Do not perform calculation for media that are unusable or unreliable

        Int32_t dataSize(0);
        {
            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE MEDIA_DATA_SIZES CURSOR FOR

                SELECT
                    SUM(MEDIAVOL.VOLSIZE)
                FROM
                    MEDIA, MEDIAVOL
                WHERE
                    MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY   AND
                    MEDIA.MEDIAPOOLKEY = :currentKey      AND
                    bin_and(MEDIA.STATUS, :mediumUnreliableUnusableOffline) = 0 AND
                    MEDIAVOL.VOLTYPE = :dataVolume;

            EXEC SQL
                OPEN TRANSACTION readTrans MEDIA_DATA_SIZES;

            EXEC SQL
                FETCH
                MEDIA_DATA_SIZES INTO

                    :dataSize

            EXEC SQL
                CLOSE MEDIA_DATA_SIZES;

            sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_DATA_SIZES", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );

            a_poolInfo[i].dataSize = dataSize;
        }

        // Execute SELECT query for good data volumes and return dataAvailable
        // Do not perform calculation for media that are unusable or unreliable
        // Do not calculate available space when media is full

        Int32_t dataAvailable(0);
        {
            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE MEDIA_DATA_AVAIL CURSOR FOR

                SELECT
                    SUM(MEDIAVOL.VOLSIZE - (MEDIAVOL.VOLSIZE * MEDIAVOL.VOLUSED /100 ))
                FROM
                    MEDIA, MEDIAVOL
                WHERE
                    MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY   AND
                    MEDIA.MEDIAPOOLKEY = :currentKey      AND
                    bin_and(MEDIA.STATUS, :mediumUnreliableUnusableOffline) = 0 AND
                    bin_and(MEDIAVOL.STATUS, :mediumVolFull) = 0 AND
                    MEDIAVOL.VOLTYPE = :dataVolume;

            EXEC SQL
            OPEN TRANSACTION readTrans MEDIA_DATA_AVAIL;

            EXEC SQL
                FETCH MEDIA_DATA_AVAIL INTO
                    :dataAvailable

            EXEC SQL
                CLOSE MEDIA_DATA_AVAIL;

            sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_DATA_AVAIL", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );

            a_poolInfo[i].dataAvailable = dataAvailable;
        }


        // Execute SELECT query and return the number of unusable media that belong to one pool
        {
            Int32_t mediaUnusable(0);

            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE MEDIA_UNUSABLE CURSOR FOR

                SELECT
                    COUNT (*)
                FROM
                    MEDIA
                WHERE
                    MEDIA.MEDIAPOOLKEY = :currentKey      AND
                    bin_and(MEDIA.STATUS, :mediumUnusable) != 0;

            EXEC SQL
                OPEN TRANSACTION readTrans MEDIA_UNUSABLE;

            EXEC SQL
                FETCH
                MEDIA_UNUSABLE INTO

                    :mediaUnusable

            EXEC SQL
                CLOSE MEDIA_UNUSABLE;

            sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_UNUSABLE", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );


            a_poolInfo[i].mediaUnusable = mediaUnusable;
        }

        // Execute SELECT query and return the number of unreliable media
        {
            Int32_t mediaUnreliable(0);

            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE MEDIA_UNRELIABLE CURSOR FOR

                SELECT
                    COUNT (*)
                FROM
                    MEDIA
                WHERE
                    MEDIA.MEDIAPOOLKEY = :currentKey      AND
                    bin_and(MEDIA.STATUS, :mediumUnreliable) != 0;

            EXEC SQL
                OPEN TRANSACTION readTrans MEDIA_UNRELIABLE;

            EXEC SQL
                FETCH
                MEDIA_UNRELIABLE INTO

                    :mediaUnreliable

            EXEC SQL
                CLOSE MEDIA_UNRELIABLE;

            sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_UNRELIABLE", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );

            a_poolInfo[i].mediaUnreliable = mediaUnreliable;
        }

        // Execute SELECT query and return the number of offline media that belong to one pool
        {
            Int32_t mediaOffline(0);

            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE MEDIA_OFFLINE CURSOR FOR

                SELECT
                    COUNT (*)
                FROM
                    MEDIA
                WHERE
                    MEDIA.MEDIAPOOLKEY = :currentKey      AND
                    bin_and(MEDIA.STATUS, :mediumOffline) != 0;

            EXEC SQL
                OPEN TRANSACTION readTrans MEDIA_OFFLINE;

            EXEC SQL
                FETCH
                MEDIA_OFFLINE INTO

                    :mediaOffline

            EXEC SQL
                CLOSE MEDIA_OFFLINE;

            sqlErrDesc = errorDesc(SQLCODE,"Select MEDIA_OFFLINE", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );


            a_poolInfo[i].mediaOffline = mediaOffline;
        }


        // Execute SELECT query and count the number of good volumes per media
        // Number of volumes for good media must be greater than 0
        // Do not perform calculation for media that are unusable or unreliable

        {
            Int32_t mediaGood(0);

            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE NUMBER_OF_GOOD_MEDIA CURSOR FOR

                SELECT
                COUNT(*)
                FROM
                    MEDIA
                WHERE MEDIAKEY IN (
                    SELECT
                        MEDIAVOL.MEDIAKEY
                    FROM
                        MEDIA, MEDIAVOL
                    WHERE
                        MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY AND
                        MEDIA.MEDIAPOOLKEY = :currentKey    AND
                        bin_and(MEDIA.STATUS, :mediumUnreliableUnusableOffline) = 0
                    GROUP BY
                        MEDIAVOL.MEDIAKEY
                    HAVING
                        COUNT(MEDIAVOL.MEDVOLNR) > 0);

            EXEC SQL
                OPEN TRANSACTION readTrans NUMBER_OF_GOOD_MEDIA;

            EXEC SQL
                FETCH
                NUMBER_OF_GOOD_MEDIA INTO

                    :mediaGood

            EXEC SQL
                CLOSE NUMBER_OF_GOOD_MEDIA;

            string sqlErrDesc = errorDesc(SQLCODE,"Select NUMBER_OF_GOOD_MEDIA", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );

            a_poolInfo[i].mediaGood = mediaGood;
        }

        // Execute SELECT query and count the number of uninitilized volumes per media
        // Do not perform calculation for media that are unusable or unreliable

        {
            Int32_t mediaUninitialized(0);

            EXEC SQL
                SET TRANSACTION NAME readTrans;

            EXEC SQL
                DECLARE NUMBER_OF_UNINIT_MEDIA CURSOR FOR

                SELECT
                COUNT(*)
                FROM
                    MEDIA
                WHERE MEDIA.MEDIAPOOLKEY = :currentKey AND
                        bin_and(MEDIA.STATUS, :mediumUnreliableUnusableOffline) = 0 AND
                        MEDIAKEY NOT IN (
                    SELECT
                        MEDIAVOL.MEDIAKEY
                    FROM
                        MEDIA, MEDIAVOL
                    WHERE
                        MEDIAVOL.MEDIAKEY  = MEDIA.MEDIAKEY
                    GROUP BY
                        MEDIAVOL.MEDIAKEY
                    HAVING
                        COUNT(MEDIAVOL.MEDVOLNR) > 0);

            EXEC SQL
                OPEN TRANSACTION readTrans NUMBER_OF_UNINIT_MEDIA;

            EXEC SQL
                FETCH
                NUMBER_OF_UNINIT_MEDIA INTO

                    :mediaUninitialized

            EXEC SQL
                CLOSE NUMBER_OF_UNINIT_MEDIA;

            sqlErrDesc = errorDesc(SQLCODE,"Select NUMBER_OF_UNINIT_MEDIA", currentKey);
            SQL_CHECKREAD_M( sqlErrDesc );

            a_poolInfo[i].mediaUninitialized = mediaUninitialized;
        }

    } // for end

 } // end function rm_Operator::PoolInfo

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 874 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_REORG, log_DBG_m, log_ERR_m, log_FUNC_m, rm_Medium::mediumKey, NULL, 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().

                                                                  {
    log_FUNC_m(ReleaseResources);

    for (UInt32_t i = 0; i < a_resources.length(); i++) {
            if ( a_resources[i].driveKey != 0) {
                log_DBG_m(dbg_DETAIL,
                    "setting status for Drive: " <<
                    a_resources[i].driveKey <<
                    " to: free");
                rm_Drive d(a_resources[i].driveKey);
                d.status = d.status & ~(rmdb_DRIVE_IN_USE);
                //increase usage counter
                d.usageCount++;
                d.Update();
            }
            if ( a_resources[i].mediumKey != 0) {
                log_DBG_m(dbg_DETAIL,
                    "setting status for Medium: " <<
                    a_resources[i].mediumKey <<
                    " to: free");
                rm_Medium m(a_resources[i].mediumKey);
                m.status = m.status & ~(rmdb_MEDIUM_IN_USE);
                if ((a_resources[i].medVolNr > 0) &&
                    ((a_jobType == jt_MIGRATION) ||
                    (a_jobType == jt_MAINT && a_resources[i].resNum == 1) ||
                    (a_jobType == jt_REORG && a_resources[i].resNum == 1))) {
                    try {
                        rm_MediumVol mv(m.mediumKey, a_resources[i].medVolNr);
                        m.currentVolume = static_cast<Int16_t>(a_resources[i].medVolNr);
                        mv.status = mv.status & ~rmdb_MEDVOL_REORG_SCANNED;
                        mv.Update();

                    } catch (ivd_DBException& dbe){
                        ostringstream msg;
                        msg << "Non-Fatal Exception while releasing resources." <<
                            endl << "Medium: " << m.barcode <<
                            " was released with current Volume: " <<
                            a_resources[i].medVolNr <<
                           ". This volume does not exist!" << endl << dbe;

                        log_ERR_m(msg.str());
                    }
                }
                m.Update();
            }
            if ( a_resources[i].medVolNr != 0) {
                log_DBG_m(dbg_DETAIL,
                    "setting status for MedVolume: " <<
                    a_resources[i].medVolNr );

                rm_MediumVol mv(a_resources[i].mediumKey, a_resources[i].medVolNr);
                mv.accessNr++;
                mv.accessTime = time(NULL);
                if (a_resources[i].fileId == 0) {
                    mv.writeNr++;
                    mv.writeTime = time(NULL);
                }

                mv.Update();
            }
            if ( a_resources[i].dssKey != 0) {
                log_DBG_m(dbg_DETAIL,
                    "Setting status for DSS: " <<
                    a_resources[i].dssKey <<
                    " to: free");
                throw ivd_Error(ie_NYI, "DSS is not yet implemented");
            }
        };
}

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 1531 of file rm_operator.cpp.

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

Referenced by dbo_RemoveColIDs::Process().

                                                 {
    log_FUNC_m(RemoveColIDs);
    i_MajorColSeq_t mcs = SelectAllMajorCol();
    log_DBG_m(dbg_LOW,"mcs.length(): " << mcs.length());
        for (UInt32_t i(0); i < mcs.length(); i++) {
            if (a_partUUID.compare(mcs[i].partUUID) == 0) {
                i_MinorColSeq_t minCS = SelectAllMinColByMajCol(mcs[i].majColId);
                log_DBG_m(dbg_LOW,"minCS.length(): " << minCS.length());
                for (UInt32_t j(0); j < minCS.length(); j++) {
                    // Remove all minor collocations for selected major collocation
                    RemoveMinorCol(minCS[j].minColId);
                }
                RemoveMajorCol(mcs[i].majColId);
            }
        }
}

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 1383 of file rm_operator.cpp.

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

Referenced by dbo_RemoveColMediaVol::Process().

                                                                               {
    log_FUNC_m(RemoveColMediaVol);
    try {
        // Get medium key from barcode
        i_Medium_t medium;
        medium = SelectMedium(a_mediumBarcode);

        // Get all entries for selected volume
        rm_ColMediaVol cmv;
        vector<rm_ColMediaVol> cmvEntries;
        cmvEntries = cmv.SelectByVolume(medium.mediumKey, a_medVolNr);
        log_DBG_m(dbg_DETAIL, "Found " << cmvEntries.size() << " entries.");
        for (UInt32_t i(0); i< cmvEntries.size(); i++) {
            log_DBG_m(dbg_DETAIL, "Removing " << i
                << " m_minColId:" << cmvEntries[i].m_minColId
                << " m_mediaKey:" << cmvEntries[i].m_mediaKey
                << " m_medVolNr:" << cmvEntries[i].m_medVolNr);
            cmvEntries[i].Remove();
        }
        log_DBG_m(dbg_DETAIL, "All entries removed.");
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1406 of file rm_operator.cpp.

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

Referenced by dbo_RemoveDrive::Process().

                                                {

    try {

        rm_Drive drive;
        rm_String driveName(rmdb_MAX_DRIVENAME);
        driveName = a_driveName;
        drive.SelectByName(driveName);
        if ( (drive.status & rmdb_DRIVE_IN_USE) == 0 ) {
            drive.Remove(drive.driveKey);
        } else {
            throw ivd_Error( ie_RMDB_ERROR, "Can not remove Drive. Drive in Use", true);
        }
    } rm_CATCH_DB_THROW_IVD_m;

}

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 1423 of file rm_operator.cpp.

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

Referenced by dbo_RemoveDriveHost::Process().

                                                                   {

    try {

        // @TODO Do we need to check something else before removing the record?
        rm_DriveHost driveHost;

        rm_Drive drive;
        rm_String driveName(rmdb_MAX_DRIVENAME);
        driveName = a_driveName;
        drive.SelectByName(driveName);

        rm_String host(rmdb_MAX_HOSTNAME);
        host = a_host;
        driveHost.Remove(drive.driveKey, host);

    } rm_CATCH_DB_THROW_IVD_m;
}

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 1442 of file rm_operator.cpp.

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

Referenced by dbo_RemoveDiskSubsys::Process().

                                            {

    try {

        rm_DiskSubsys dss;
        rm_String dssName(rmdb_MAX_DSSNAME);
        dssName = a_dssName;
        dss.SelectByName(dssName);

        if ( (dss.status & rmdb_DSS_IN_USE) == 0 ) {
            dss.Remove(dss.diskSubsysKey);
        } else {
            throw ivd_Error( ie_RMDB_ERROR, "Can not remove DSS. DSS in Use", true);
        }
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1337 of file rm_operator.cpp.

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

Referenced by dbo_RemoveLibrary::Process().

                                                    {

    try {

        rm_Library library;
        rm_String libraryName(rmdb_MAX_LIBRARYNAME);
        libraryName = a_libraryName;
        library.SelectByName(libraryName);
        // remove library only in case it isn't online?
        //if ( (library.status != rmdb_INIT_LIBRARY_STATUS) ) {
            library.Remove(library.libraryKey);
        //} else {
        //    throw ivd_Error( ie_RMDB_ERROR, "Can not remove Library. Library in Use", true);
        //}
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1354 of file rm_operator.cpp.

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

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

                                                    {

    try {
        rm_MajorCol majorCol;
        UInt64_t majColId;
        majColId = a_majorCol;
        if (majColId > 0) {
            majorCol.Remove(majColId);
        }
        else {
           throw ivd_Error( ie_RMDB_ERROR, "Can not remove MajorCollocationId.", true);
        }
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1476 of file rm_operator.cpp.

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

Referenced by dbo_RemoveMediaPool::Process().

                                                        {
    try {

        rm_MediaPool mediaPool;
        rm_String mediaPoolName(rmdb_MAX_MEDIAPOOLNAME);
        mediaPoolName = a_mediaPoolName;
        mediaPool.SelectByName(mediaPoolName);
        mediaPool.Remove(mediaPool.mediaPoolKey);
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1487 of file rm_operator.cpp.

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

Referenced by dbo_RemoveMedium::Process().

                                                     {
    try {

        rm_Medium medium;
        rm_String mediumBarcode(rmdb_MAX_BARCODE);
        mediumBarcode = a_mediumBarcode;
        medium.SelectByBarcode(mediumBarcode);
    if ( (medium.status & rmdb_MEDIUM_IN_USE) == 0 ) {
            medium.Remove(medium.mediumKey);
        } else {
            throw ivd_Error( ie_RMDB_ERROR, "Can not remove Medium. Medium in Use", true);
        }
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1502 of file rm_operator.cpp.

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

Referenced by dbo_RemoveMediumVol::Process().

                                                                                {
    log_FUNC_m(RemoveMediumVol);

    try {
        rm_MediumVol mediumVol;
        rm_Medium medium;

        rm_String medBarcode(rmdb_MAX_BARCODE);
        medBarcode = a_mediumBarcode;
        medium.SelectByBarcode(medBarcode);
        mediumVol.Select(medium.mediumKey, a_mediumVolNr);

        //remove all collocation entries
        rm_ColMediaVol cmv;
        vector<rm_ColMediaVol> cmvList = cmv.SelectByVolume(medium.mediumKey, a_mediumVolNr);
        for(UInt32_t i(0); i < cmvList.size(); i++){
            log_DBG_m(dbg_LOW, "Removed ColMediaVol: " <<
                                cmvList[i].m_minColId << ", " <<
                                cmvList[i].m_mediaKey << ", " <<
                                cmvList[i].m_medVolNr );
            cmvList[i].Remove();
        }

        //remove volume
        mediumVol.Remove(medium.mediumKey, a_mediumVolNr);

    } rm_CATCH_DB_THROW_IVD_m;
}

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 1369 of file rm_operator.cpp.

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

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

                                                    {
    try {
        rm_MinorCol minorCol;
        UInt64_t minColId;
        minColId = a_minColId;
        if (minColId != 0) {
            minorCol.Remove(minColId);
        }
        else {
           throw ivd_Error( ie_RMDB_ERROR, "Remove MinorCollocationId not allowed.", true);
        }
    } rm_CATCH_DB_THROW_IVD_m;
}

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 3634 of file rm_operator.cpp.

References rm_Partition::Remove().

Referenced by dbo_RemovePartition::Process().

                                                      {
    try {
        rm_Partition part;
        part.Remove(a_partName);
    } rm_CATCH_DB_THROW_IVD_m;
}

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 1459 of file rm_operator.cpp.

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

Referenced by dbo_RemoveSlot::Process().

                                                                                        {
    try {

        rm_Library library;
        rm_String libraryName(rmdb_MAX_LIBRARYNAME);
        libraryName = a_libraryName;
        library.SelectByName(libraryName);

        rm_Slot slot;
        rm_String slotAddr(rmdb_MAX_SLOTADDR);
        slotAddr = a_slotAddr;
        slot.SelectByLibAddrType(library.libraryKey, slotAddr, a_slotType);
        slot.Remove(slot.slotKey, slot.libraryKey);

    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

i_ColMediaVolSeq_t rm_Operator::SelectAllColVolumes (  )  [private]

Definition at line 1820 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllColVolumes::Process().

                                                    {
    log_FUNC_m(AllColVolumes);
    i_ColMediaVolSeq_t i_cmvSeq;
    try {
        rm_ColMediaVol cmv;
        vector<rm_ColMediaVol> c;
        c = cmv.SelectAll();
        log_DBG_m(dbg_NORM,"vector size:" << int(c.size()));
        i_cmvSeq.length(c.size());
        for (UInt32_t i = 0; i < c.size(); i++ ) {
            i_cmvSeq[i].minColId   = c[i].m_minColId;
            i_cmvSeq[i].mediaKey   = c[i].m_mediaKey;
            i_cmvSeq[i].medVolNr   = c[i].m_medVolNr;

        log_DBG_m(dbg_NORM,"Collocation volume: (" << c[i].m_minColId << ","
                                                   << c[i].m_mediaKey << ","
                                                   << c[i].m_medVolNr << ")");
        }
    }rm_CATCH_DB_THROW_IVD_m;
    return i_cmvSeq;
}

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 1914 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllDriveHosts::Process().

                                                  {
    log_FUNC_m(SelectAllDriveHosts);

    i_DriveHostSeq_t iDriveHostSeq;
    vector<rm_DriveHost> rmDHVec;
    try {
        rm_DriveHost dH;

        dH.StartSelectAll();
        bool last = false;

        while (!last) {
            try {
                dH.Next();
                rmDHVec.push_back(dH);
            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        iDriveHostSeq.length(rmDHVec.size());

        for (UInt32_t i = 0; i < rmDHVec.size(); i++ ) {
            iDriveHostSeq[i].controlDevice  = CORBA::string_dup(rmDHVec[i].controlDevice.cvalue_p);
            iDriveHostSeq[i].host           = CORBA::string_dup(rmDHVec[i].host.cvalue_p);
            rm_Drive d(rmDHVec[i].driveKey);
            iDriveHostSeq[i].driveName      = CORBA::string_dup(d.driveName.cvalue_p);
        }
    } rm_CATCH_DB_THROW_IVD_m;

    return iDriveHostSeq;
}

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 1841 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllDrives::Process().

                                          {
    i_DriveSeq_t i_drvSeq;
    try {

        rm_Drive drv;
        vector<rm_Drive> d;
        d = drv.SelectAll();
        i_drvSeq.length(d.size());

        for (UInt32_t i = 0; i < d.size(); i++) {
            i_drvSeq[i].aveSeekTime      = d[i].aveSeekTime;
            i_drvSeq[i].capabilities     = d[i].capabilities;
            i_drvSeq[i].cleanNr          = d[i].cleanNr;
            i_drvSeq[i].dataThroughput   = d[i].dataThroughput;
            i_drvSeq[i].driveKey         = d[i].driveKey;
            i_drvSeq[i].lastClean        = d[i].lastClean.GetTime();

            if (d[i].libraryKey > 0) {
                rm_Library lib(d[i].libraryKey);
                i_drvSeq[i].libraryName = CORBA::string_dup(lib.libraryName.c_str());
            } else {
                i_drvSeq[i].libraryName = CORBA::string_dup(ipc_nilStr);
            }

            i_drvSeq[i].loadTime         = d[i].loadTime;
            i_drvSeq[i].mediaFamily      = d[i].mediaFamily;
            i_drvSeq[i].options          = d[i].options;
            i_drvSeq[i].rewindTime       = d[i].rewindTime;
            i_drvSeq[i].status           = d[i].status;
            i_drvSeq[i].unloadTime       = d[i].unloadTime;
            i_drvSeq[i].usageCount       = d[i].usageCount;
            i_drvSeq[i].driveName        = CORBA::string_dup(d[i].driveName.cvalue_p);
            i_drvSeq[i].driveIndex       = CORBA::string_dup(d[i].driveIndex.cvalue_p);
            i_drvSeq[i].productID        = CORBA::string_dup(d[i].productID.cvalue_p);
            i_drvSeq[i].serialNo         = CORBA::string_dup(d[i].serialNo.cvalue_p);
            i_drvSeq[i].vendorID         = CORBA::string_dup(d[i].vendorID.cvalue_p);
            i_drvSeq[i].firmwareRev      = CORBA::string_dup(d[i].firmwareRev.cvalue_p);
            i_drvSeq[i].scsiID           = CORBA::string_dup(d[i].scsiID.cvalue_p);
        }

        return i_drvSeq;
    }rm_CATCH_DB_THROW_IVD_m;

    return i_drvSeq;
}

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 1953 of file rm_operator.cpp.

References ie_NYI, and ivd_Error.

Referenced by dbo_SelectAllDiskSubsys::Process().

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

Here is the caller graph for this function:

i_LibrarySeq_t rm_Operator::SelectAllLibraries (  )  [private]

Definition at line 1628 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllLibraries::Process().

                                               {
    log_FUNC_m(SelectAllLibraries);

    i_LibrarySeq_t iLibSeq;
    vector<rm_Library> rmLibVec;
    try {
        rm_Library lib;

        lib.StartSelectAll();

        bool last = false;
        while (!last) {
            try {
                lib.Next();
                rmLibVec.push_back(lib);

            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        iLibSeq.length(rmLibVec.size());
        for (UInt32_t i = 0; i < rmLibVec.size(); i++ ) {
            iLibSeq[i].auditTime        = rmLibVec[i].auditTime;
            iLibSeq[i].capabilities     = rmLibVec[i].capabilities;
            iLibSeq[i].libraryKey       = rmLibVec[i].libraryKey;
            iLibSeq[i].libraryType      = rmLibVec[i].libraryType;
            iLibSeq[i].loadNr           = rmLibVec[i].loadNr;
            iLibSeq[i].mediaAccessTime  = rmLibVec[i].mediaAccessTime;
            iLibSeq[i].mediaFamily      = rmLibVec[i].mediaFamily;
            iLibSeq[i].mediaXChgTime    = rmLibVec[i].mediaXChgTime;
            iLibSeq[i].options          = rmLibVec[i].options;
            iLibSeq[i].status           = rmLibVec[i].status;
            iLibSeq[i].unloadNr         = rmLibVec[i].unloadNr;

            iLibSeq[i].controlDevice    = CORBA::string_dup(rmLibVec[i].controlDevice.cvalue_p);
            iLibSeq[i].host             = CORBA::string_dup(rmLibVec[i].host.cvalue_p);
            iLibSeq[i].libraryName      = CORBA::string_dup(rmLibVec[i].libraryName.cvalue_p);
            iLibSeq[i].productID        = CORBA::string_dup(rmLibVec[i].productID.cvalue_p);
            iLibSeq[i].serialNo         = CORBA::string_dup(rmLibVec[i].serialNo.cvalue_p);
            iLibSeq[i].vendorID         = CORBA::string_dup(rmLibVec[i].vendorID.cvalue_p);
            iLibSeq[i].firmwareRev      = CORBA::string_dup(rmLibVec[i].firmwareRev.cvalue_p);
            iLibSeq[i].scsiID           = CORBA::string_dup(rmLibVec[i].scsiID.cvalue_p);
        }

    } rm_CATCH_DB_THROW_IVD_m;
    return iLibSeq;
}

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 1722 of file rm_operator.cpp.

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

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

                                               {
    log_FUNC_m(SelectAllMajorCol);

    i_MajorColSeq_t i_majorColSeq;
    vector<rm_MajorCol> majorColVec;
    try {
        rm_MajorCol mc;
        mc.StartSelectAll();
        try {
            while (true) {
                mc.Next();
                majorColVec.push_back(mc);
            }
        }
        catch (ivd_DBException& e) {
            if (e.GetError() == SQL_NOTFOUND) {
                // end of entries in RMDB
            }
            else {
                throw;
            }
        }
        i_majorColSeq.length(majorColVec.size());

        for (UInt32_t i = 0; i < majorColVec.size(); i++) {
           i_majorColSeq[i].majColId   = majorColVec[i].majColId;
           i_majorColSeq[i].majColSize = majorColVec[i].majColSize;
           i_majorColSeq[i].partUUID   = CORBA::string_dup(majorColVec[i].partUUID.c_str());
           i_majorColSeq[i].flags      = majorColVec[i].flags;

        log_DBG_m(dbg_LOW,"Major Collocation: (" << i_majorColSeq[i].majColId << ","
                                                 << i_majorColSeq[i].majColSize << ","
                                                 << i_majorColSeq[i].partUUID << ", "
                                                 << i_majorColSeq[i].flags << ")");
        }

    }rm_CATCH_DB_THROW_IVD_m;
    return i_majorColSeq;
}

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 2723 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, and rm_Slot::slotType.

Referenced by dbo_SelectAllMediaByPart::Process().

                                                                  {
    log_FUNC_m(SelectAllMediaByPart);


    typedef vector<rm_Medium> rm_Medium_t;
    rm_Medium_t rmMediumVec;
    i_MediumSeq_t iMediumSeq;

    iMediumSeq.length(0);

    rm_Medium medium;
    rm_String partName(rmdb_MAX_PARTITIONNAME);
    partName = a_partName;

    try {
        rmMediumVec = medium.SelectByPartition(partName);
    } catch (ivd_DBException& e) {
        if (e.GetError() == SQL_NOTFOUND) {

            //no media found for this partition
            log_DBG_m(dbg_LOW, "No media found for partition");
            return iMediumSeq;
        } else throw;
    }
    if (rmMediumVec.empty()) {
        return iMediumSeq;
    }

    iMediumSeq.length(rmMediumVec.size());

    for (UInt32_t i = 0; i < rmMediumVec.size(); i++) {

        // iMediumSeq[i] = rmMediumVec[i];
        iMediumSeq[i].mediumKey  = rmMediumVec[i].mediumKey;

        if (rmMediumVec[i].mediaPoolKey > 0 ) {
            rm_MediaPool mp(rmMediumVec[i].mediaPoolKey);
            iMediumSeq[i].mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
        } else {
            iMediumSeq[i].mediaPoolName    = CORBA::string_dup(ipc_nilStr);
        }


        if (rmMediumVec[i].libraryKey > 0) {
            rm_Library lib(rmMediumVec[i].libraryKey);
            iMediumSeq[i].libraryName       = CORBA::string_dup(lib.libraryName.c_str());
            if (rmMediumVec[i].slotKey > 0) {
                rm_Slot s(rmMediumVec[i].slotKey,lib.libraryKey);
                iMediumSeq[i].slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
                iMediumSeq[i].slotType          = s.slotType;
            } else {
                iMediumSeq[i].slotAddr          = CORBA::string_dup(ipc_nilStr);
                iMediumSeq[i].slotType          = 0;
            }
        } else {
            iMediumSeq[i].libraryName       = CORBA::string_dup(ipc_nilStr);
        }


        if (rmMediumVec[i].driveKey > 0) {
            rm_Drive d(rmMediumVec[i].driveKey);
            iMediumSeq[i].driveName    = CORBA::string_dup(d.driveName.c_str());
        } else {
            iMediumSeq[i].driveName    = CORBA::string_dup(ipc_nilStr);
        }


        if (rmMediumVec[i].diskSubsysKey > 0) {
            rm_DiskSubsys dss(rmMediumVec[i].diskSubsysKey);
            iMediumSeq[i].diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
        } else {
            iMediumSeq[i].diskSubsysName    = CORBA::string_dup(ipc_nilStr);
        }

        iMediumSeq[i].barcode          = CORBA::string_dup(rmMediumVec[i].barcode.c_str());
        iMediumSeq[i].status           = rmMediumVec[i].status;
        iMediumSeq[i].location         = CORBA::string_dup(rmMediumVec[i].location.c_str());
        iMediumSeq[i].mediumType       = rmMediumVec[i].mediumType;
        iMediumSeq[i].mediumSerialNo   = CORBA::string_dup(rmMediumVec[i].mediumSerialNo.c_str());
        iMediumSeq[i].blockSize        = rmMediumVec[i].blockSize;
        iMediumSeq[i].numOfVolumes     = rmMediumVec[i].numOfVolumes;
        iMediumSeq[i].idxOfSysVol      = rmMediumVec[i].idxOfSysVol;
        iMediumSeq[i].sizeOfSysVol     = rmMediumVec[i].sizeOfSysVol;
        iMediumSeq[i].currentVolume    = rmMediumVec[i].currentVolume;
    }

    return iMediumSeq;

}

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 2111 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllMediaPool::Process().

                                                   {
    log_FUNC_m(SelectAllMediaPools);

    i_MediaPoolSeq_t iMediaPoolSeq;
    vector<rm_MediaPool> rmMPVec;
    try {
        rm_MediaPool mp;
        mp.StartSelectAll();
        bool last = false;

        while (!last) {
            try {
                mp.Next();
                rmMPVec.push_back(mp);
            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        iMediaPoolSeq.length(rmMPVec.size());
        for (UInt32_t i = 0; i < rmMPVec.size(); i++ ) {
            iMediaPoolSeq[i].blockSize      = rmMPVec[i].blockSize;
            iMediaPoolSeq[i].numOfVolumes   = rmMPVec[i].numOfVolumes;
            iMediaPoolSeq[i].sysVolLocation    = rmMPVec[i].sysVolLocation;
            iMediaPoolSeq[i].sizeOfSysVol   = rmMPVec[i].sizeOfSysVol;
            iMediaPoolSeq[i].maxMediaAge    = rmMPVec[i].maxMediaAge;
            iMediaPoolSeq[i].maxNrReadWrite = rmMPVec[i].maxNrReadWrite;
            iMediaPoolSeq[i].mediaFamily    = rmMPVec[i].mediaFamily;
            iMediaPoolSeq[i].mediaPoolKey   = rmMPVec[i].mediaPoolKey;
            iMediaPoolSeq[i].mediaPoolName  = CORBA::string_dup(rmMPVec[i].mediaPoolName.cvalue_p);
            iMediaPoolSeq[i].mediaPoolType  = rmMPVec[i].mediaPoolType;
            iMediaPoolSeq[i].partitionUUIDString  = CORBA::string_dup(rmMPVec[i].partitionUUIDString.cvalue_p);
            iMediaPoolSeq[i].poolUUIDString  = CORBA::string_dup(rmMPVec[i].poolUUIDString.cvalue_p);
            iMediaPoolSeq[i].sizeOfVolume   = rmMPVec[i].sizeOfVolume;

        }
    } rm_CATCH_DB_THROW_IVD_m;

    return iMediaPoolSeq;
}

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 2308 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_Slot::slotAddr, rm_Slot::slotType, and rm_Medium::StartSelectAll().

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

                                           {
    log_FUNC_m(SelectAllMedium);

    i_MediumSeq_t iMediumSeq;
    vector<rm_Medium> rmMedVec;
    try {
        rm_Medium m;

        m.StartSelectAll();
        bool last = false;

        while (!last) {
            try {
                m.Next();
                rmMedVec.push_back(m);
            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        iMediumSeq.length( rmMedVec.size() );

        for (UInt32_t i = 0; i < rmMedVec.size(); i++ ) {

            iMediumSeq[i].mediumKey         = rmMedVec[i].mediumKey;
            if (rmMedVec[i].mediaPoolKey > 0 ) {
                rm_MediaPool mp(rmMedVec[i].mediaPoolKey);
                iMediumSeq[i].mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
            } else {
                iMediumSeq[i].mediaPoolName    = CORBA::string_dup(ipc_nilStr);
            }


            if (rmMedVec[i].libraryKey > 0) {
                rm_Library lib(rmMedVec[i].libraryKey);
                iMediumSeq[i].libraryName       = CORBA::string_dup(lib.libraryName.c_str());
                if (rmMedVec[i].slotKey > 0) {
                    rm_Slot s(rmMedVec[i].slotKey,lib.libraryKey);
                    iMediumSeq[i].slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
                    iMediumSeq[i].slotType          = s.slotType;
                } else {
                    iMediumSeq[i].slotAddr          = CORBA::string_dup(ipc_nilStr);
                    iMediumSeq[i].slotType          = 0;
                }
            } else {
                iMediumSeq[i].libraryName       = CORBA::string_dup(ipc_nilStr);
            }


            if (rmMedVec[i].driveKey > 0) {
                rm_Drive d(rmMedVec[i].driveKey);
                iMediumSeq[i].driveName    = CORBA::string_dup(d.driveName.c_str());
            } else {
                iMediumSeq[i].driveName    = CORBA::string_dup(ipc_nilStr);
            }


            if (rmMedVec[i].diskSubsysKey > 0) {
                rm_DiskSubsys dss(rmMedVec[i].diskSubsysKey);
                iMediumSeq[i].diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
            } else {
                iMediumSeq[i].diskSubsysName    = CORBA::string_dup(ipc_nilStr);
            }

            iMediumSeq[i].barcode          = CORBA::string_dup(rmMedVec[i].barcode.c_str());
            iMediumSeq[i].status           = rmMedVec[i].status;
            iMediumSeq[i].location         = CORBA::string_dup(rmMedVec[i].location.c_str());
            iMediumSeq[i].mediumType        = rmMedVec[i].mediumType;
            iMediumSeq[i].mediumSerialNo   = CORBA::string_dup(rmMedVec[i].mediumSerialNo.c_str());
            iMediumSeq[i].blockSize        = rmMedVec[i].blockSize;
            iMediumSeq[i].numOfVolumes     = rmMedVec[i].numOfVolumes;
            iMediumSeq[i].idxOfSysVol      = rmMedVec[i].idxOfSysVol;
            iMediumSeq[i].sizeOfSysVol     = rmMedVec[i].sizeOfSysVol;
            iMediumSeq[i].currentVolume    = rmMedVec[i].currentVolume;
        }
    }rm_CATCH_DB_THROW_IVD_m;
    return iMediumSeq;
}

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 2461 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllMediumVol::Process().

                                                 {
    log_FUNC_m(SelectAllMediumVol);

    i_MediumVolSeq_t iMediumVolSeq;
    vector<rm_MediumVol> rmMVVec;
    try {
        rm_MediumVol mv;
        mv.StartSelectAll();
        bool last = false;
        while (!last) {
            try {
                mv.Next();
                rmMVVec.push_back(mv);
            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        iMediumVolSeq.length(rmMVVec.size());
        for (UInt32_t i = 0; i < rmMVVec.size(); i++ ) {
            iMediumVolSeq[i].medVolNr          = rmMVVec[i].medVolNr;
            rm_Medium m(rmMVVec[i].mediumKey);
            iMediumVolSeq[i].mediumBarcode      = CORBA::string_dup(m.barcode.c_str());
            iMediumVolSeq[i].accessNr          = rmMVVec[i].accessNr;
            iMediumVolSeq[i].accessTime        = rmMVVec[i].accessTime.GetTime();
            iMediumVolSeq[i].initTime          = rmMVVec[i].initTime.GetTime();
            iMediumVolSeq[i].lastVerification  = rmMVVec[i].lastVerification.GetTime();
            iMediumVolSeq[i].medVolId          = CORBA::string_dup(rmMVVec[i].medVolId.c_str());
            iMediumVolSeq[i].owriteNr          = rmMVVec[i].owriteNr;
            iMediumVolSeq[i].owriteTime        = rmMVVec[i].owriteTime.GetTime();
            iMediumVolSeq[i].status            = rmMVVec[i].status;
            iMediumVolSeq[i].volSize           = rmMVVec[i].volSize;
            iMediumVolSeq[i].volType           = rmMVVec[i].volType;
            iMediumVolSeq[i].volUsed           = rmMVVec[i].volUsed;
            iMediumVolSeq[i].writeNr           = rmMVVec[i].writeNr;
            iMediumVolSeq[i].writeTime         = rmMVVec[i].writeTime.GetTime();
            iMediumVolSeq[i].totalData         = rmMVVec[i].totalData;
            iMediumVolSeq[i].validData         = rmMVVec[i].validData;
        }
    }rm_CATCH_DB_THROW_IVD_m;
    return iMediumVolSeq;
}

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 2570 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllMediumVolByBarcode::Process().

                                                                         {
    log_FUNC_m(SelectAllMediumVolByMedium);

    i_MediumVolSeq_t iMediumVolSeq;
    vector<rm_MediumVol> rmMVVec;
    try {
        rm_Medium m;
        rm_String barcode(rmdb_MAX_BARCODE);
        barcode = a_barcode;
        m.SelectByBarcode(barcode);
        rm_MediumVol mv;
        rmMVVec = mv.SelectByMedium(m.mediumKey);
        iMediumVolSeq.length(rmMVVec.size());
        for (UInt32_t i = 0; i < rmMVVec.size(); i++ ) {
            iMediumVolSeq[i].medVolNr          = rmMVVec[i].medVolNr;
            rm_Medium m(rmMVVec[i].mediumKey);
            iMediumVolSeq[i].mediumBarcode      = CORBA::string_dup(m.barcode.c_str());
            iMediumVolSeq[i].accessNr          = rmMVVec[i].accessNr;
            iMediumVolSeq[i].accessTime        = rmMVVec[i].accessTime.GetTime();
            iMediumVolSeq[i].initTime          = rmMVVec[i].initTime.GetTime();
            iMediumVolSeq[i].lastVerification  = rmMVVec[i].lastVerification.GetTime();
            iMediumVolSeq[i].medVolId          = CORBA::string_dup(rmMVVec[i].medVolId.c_str());
            iMediumVolSeq[i].owriteNr          = rmMVVec[i].owriteNr;
            iMediumVolSeq[i].owriteTime        = rmMVVec[i].owriteTime.GetTime();
            iMediumVolSeq[i].status            = rmMVVec[i].status;
            iMediumVolSeq[i].volSize           = rmMVVec[i].volSize;
            iMediumVolSeq[i].volType           = rmMVVec[i].volType;
            iMediumVolSeq[i].volUsed           = rmMVVec[i].volUsed;
            iMediumVolSeq[i].writeNr           = rmMVVec[i].writeNr;
            iMediumVolSeq[i].writeTime         = rmMVVec[i].writeTime.GetTime();
            iMediumVolSeq[i].totalData         = rmMVVec[i].totalData;
            iMediumVolSeq[i].validData         = rmMVVec[i].validData;
        }
    }rm_CATCH_DB_THROW_IVD_m;
    return iMediumVolSeq;

}

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 2608 of file rm_operator.cpp.

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

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

                                                                                               {
    log_FUNC_m(SelectAllMediumVolByPart);


    typedef vector<rm_MediumVol> rm_MedVec_t;
    rm_MedVec_t rmMVVec;
    i_MediumSeqByVol_t iMedSeq;
    try {

        iMedSeq.length(0);

        rm_MediumVol mv;
        rm_String partName(rmdb_MAX_PARTITIONNAME);
        partName = a_partName;

        try {
            rmMVVec = mv.SelectByPartition(partName);
        } catch (ivd_DBException& e) {
            if (e.GetError() == SQL_NOTFOUND) {

                //no volumes found for this partition
                log_DBG_m(dbg_LOW, "No volumes found for partition");
                return iMedSeq;
            } else throw;
        }
        if (rmMVVec.empty()) {
            return iMedSeq;
        }

        vector<rm_MedVec_t> rmMedVec;
        vector<rm_MediumVol> tmpMedVolVec;

        UInt32_t i = 0;
        Int32_t currentMedKey = rmMVVec[i].mediumKey;
        log_DBG_m(dbg_LOW, "Found: " << rmMVVec.size() << " volumes for partition: " << a_partName);

        while (i < rmMVVec.size()) {

            if (currentMedKey == rmMVVec[i].mediumKey){
                if (!a_unRecovered || ((rmMVVec[i].status & rmdb_MEDVOL_RECOVER) != 0)) {
                    log_DBG_m(dbg_DETAIL,"push_back volume");
                    tmpMedVolVec.push_back(rmMVVec[i]);
                    log_DBG_m(dbg_DETAIL, "Inserting Volume for existing medKey: " <<
                                          currentMedKey);
                }

                i++;
                log_DBG_m(dbg_DETAIL, "increased i = " << i);

            } else {
                //current medium finished
                log_DBG_m(dbg_DETAIL, "Inserting medium");
                rmMedVec.push_back(tmpMedVolVec);

                //clear volume vector for next medium
                tmpMedVolVec.clear();
                //set key of next medium
                currentMedKey = rmMVVec[i].mediumKey;

            };
        }

        if (tmpMedVolVec.size() > 0) {
            //last medium should be inserted
            log_DBG_m(dbg_DETAIL, "Inserting last medium");
            rmMedVec.push_back(tmpMedVolVec);
        }

        log_DBG_m(dbg_DETAIL, "Found " << rmMedVec.size() << " mediums");

        iMedSeq.length(rmMedVec.size());

        for (UInt32_t k = 0; k < rmMedVec.size(); k++) {
            log_DBG_m(dbg_DETAIL,"k = " << k);

            i_MediumVolSeq_t iMediumVolSeq;
            iMediumVolSeq.length(rmMedVec[k].size());
            log_DBG_m(dbg_DETAIL, "iMediumVolSeq.length() =  " << iMediumVolSeq.length());

            rm_Medium m;

            if (rmMedVec[k].size() > 0)
                m.Select(rmMedVec[k][0].mediumKey);

            for (UInt32_t l = 0; l < rmMedVec[k].size(); l++ ) {
                log_DBG_m(dbg_DETAIL, "rmMedVec[k][l].medVolNr = " << rmMedVec[k][l].medVolNr);

                iMediumVolSeq[l].medVolNr          = rmMedVec[k][l].medVolNr;
                iMediumVolSeq[l].mediumBarcode      = CORBA::string_dup(m.barcode.c_str());
                iMediumVolSeq[l].accessNr          = rmMedVec[k][l].accessNr;
                iMediumVolSeq[l].accessTime        = rmMedVec[k][l].accessTime.GetTime();
                iMediumVolSeq[l].initTime          = rmMedVec[k][l].initTime.GetTime();
                iMediumVolSeq[l].lastVerification  = rmMedVec[k][l].lastVerification.GetTime();
                iMediumVolSeq[l].medVolId          = CORBA::string_dup(rmMedVec[k][l].medVolId.c_str());
                iMediumVolSeq[l].owriteNr          = rmMedVec[k][l].owriteNr;
                iMediumVolSeq[l].owriteTime        = rmMedVec[k][l].owriteTime.GetTime();
                iMediumVolSeq[l].status            = rmMedVec[k][l].status;
                iMediumVolSeq[l].volSize           = rmMedVec[k][l].volSize;
                iMediumVolSeq[l].volType           = rmMedVec[k][l].volType;
                iMediumVolSeq[l].volUsed           = rmMedVec[k][l].volUsed;
                iMediumVolSeq[l].writeNr           = rmMedVec[k][l].writeNr;
                iMediumVolSeq[l].writeTime         = rmMedVec[k][l].writeTime.GetTime();
                iMediumVolSeq[l].totalData         = rmMedVec[k][l].totalData;
                iMediumVolSeq[l].validData         = rmMedVec[k][l].validData;
            }
            log_DBG_m(dbg_DETAIL, "filling iMedSeq[k] ");
            iMedSeq[k] = iMediumVolSeq;
        } //for k =
    }rm_CATCH_DB_THROW_IVD_m;

    return iMedSeq;

}

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 1796 of file rm_operator.cpp.

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

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

                                                                        {
    log_FUNC_m(SelectAllMinColByMajCol);

    i_MinorColSeq_t iMinorColSeq;
    vector<rm_MinorCol> minorColVec;

    try {
        rm_MinorCol mcVec;
        minorColVec = mcVec.SelectByMajCol(a_majColId);
        iMinorColSeq.length(minorColVec.size());
        for (UInt32_t i = 0; i < minorColVec.size(); i++) {
            iMinorColSeq[i].minColId = minorColVec[i].m_minColId;
            iMinorColSeq[i].majColId = minorColVec[i].m_majColId;
            iMinorColSeq[i].flags    = minorColVec[i].m_flags;

            log_DBG_m(dbg_NORM,"MinorCol for majColId: (" << iMinorColSeq[i].minColId << ","
                                                          << iMinorColSeq[i].majColId << ","
                                                          << iMinorColSeq[i].flags << ")");
        }
    }rm_CATCH_DB_THROW_IVD_m;

    return iMinorColSeq;
}

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 1762 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllMinorCol::Process().

                                               {
    log_FUNC_m(SelectAllMajorCol);

    i_MinorColSeq_t i_minorColSeq;
    vector<rm_MinorCol> minorColVec;
    try {
        rm_MinorCol mc;
        mc.StartSelectAll();
        bool last = false;
        while (!last) {
            try {
                mc.Next();
                minorColVec.push_back(mc);
            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        i_minorColSeq.length(minorColVec.size());
        for (UInt32_t i = 0; i < minorColVec.size(); i++) {
           i_minorColSeq[i].minColId   = minorColVec[i].m_minColId;
           i_minorColSeq[i].majColId   = minorColVec[i].m_majColId;
           i_minorColSeq[i].flags      = minorColVec[i].m_flags;

        log_DBG_m(dbg_LOW,"Minor Collocation: (" << i_minorColSeq[i].minColId << ","
                                                 << i_minorColSeq[i].majColId << ","
                                                 << i_minorColSeq[i].flags << ")");
        }

    }rm_CATCH_DB_THROW_IVD_m;
    return i_minorColSeq;
}

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 3452 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_Partition::StartSelectAll(), rm_Partition::status, and i_Partition_t::status.

Referenced by dbo_SelectAllPartition::Process().

                                       {
    log_FUNC_m(SelectAllPart);

    i_PartSeq_t iPartSeq;
    try {

        iPartSeq.length(0);
        i_Partition_t iPart;
        rm_Partition part;

        part.StartSelectAll();

        bool last = false;

        while (!last) {
            try {
                part.Next();

                iPart.migIdCount = part.migIdCount;
                iPart.migIdTime = part.migIdTime;
                iPart.partitionName = CORBA::string_dup(part.partitionName.cvalue_p);
                iPart.partitionUUIDString = CORBA::string_dup(part.partitionUUIDString.cvalue_p);
                iPart.status = part.status;
                iPart.options = part.options;
                iPart.fsHost = CORBA::string_dup(part.fsHost.cvalue_p);
                iPart.fsMountpoint = CORBA::string_dup(part.fsMountpoint.cvalue_p);
                iPart.fsID = CORBA::string_dup(part.fsID.cvalue_p);


                iPartSeq.length( iPartSeq.length() + 1 );
                iPartSeq[iPartSeq.length() - 1] = iPart;

            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
    } rm_CATCH_DB_THROW_IVD_m;
    return iPartSeq;

}

Here is the call graph for this function:

Here is the caller graph for this function:

i_SlotSeq_t rm_Operator::SelectAllSlots (  )  [private]

Definition at line 2014 of file rm_operator.cpp.

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

Referenced by dbo_SelectAllSlots::Process().

                                        {
    log_FUNC_m(SelectAllSlots);

    i_SlotSeq_t iSlotSeq;
    vector<rm_Slot> rmSlotVec;
    try {
        rm_Slot slot;
        slot.StartSelectAll();
        bool last = false;

        while (!last) {
            try {
                slot.Next();
                rmSlotVec.push_back(slot);
            } catch (ivd_DBException& e) {
                if (e.GetError() == SQL_NOTFOUND) {
                    last = true;
                } else throw;
            }
        }
        iSlotSeq.length(rmSlotVec.size());
        for (UInt32_t i = 0; i < rmSlotVec.size(); i++ ) {
            if (rmSlotVec[i].libraryKey > 0) {
                rm_Library lib(rmSlotVec[i].libraryKey);
                iSlotSeq[i].libraryName = CORBA::string_dup(lib.libraryName.c_str());
            } else {
                iSlotSeq[i].libraryName = CORBA::string_dup(ipc_nilStr);
            }
            iSlotSeq[i].slotAddr    = CORBA::string_dup(rmSlotVec[i].slotAddr.c_str());
            iSlotSeq[i].slotKey     = rmSlotVec[i].slotKey;
            iSlotSeq[i].slotType    = rmSlotVec[i].slotType;
            iSlotSeq[i].status      = rmSlotVec[i].status;
        }
    } rm_CATCH_DB_THROW_IVD_m;
    return iSlotSeq;
}

Here is the call graph for this function:

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 4342 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().

                                                                                      {
    log_FUNC_m(SelectColAlloc);

    Int32_t majHi = RMDB_COL_ID_HI(a_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(a_majColId);


    EXEC SQL
        SET TRANSACTION NAME readTrans;

    EXEC SQL
        DECLARE COLALLOC CURSOR FOR
            SELECT
                MINORCOL.MINCOLIDHI,
                MINORCOL.MINCOLIDLO,
                MINORCOL.FLAGS,
                MAJORCOL.MAJCOLSIZE,
                MEDIA.MEDIAKEY,
                MEDIA.STATUS,
                MEDIAVOL.MEDVOLNR,
                MEDIAVOL.STATUS,
                MEDIAVOL.VOLUSED,
                MEDIAVOL.VOLSIZE
            FROM
                MEDIA, MEDIAVOL, MAJORCOL, MINORCOL, COLMEDIAVOL, MEDIAPOOL
            WHERE
                MAJORCOL.MAJCOLIDHI = :majHi AND
                MAJORCOL.MAJCOLIDLO = :majLo AND
                MEDIAVOL.MEDIAKEY = MEDIA.MEDIAKEY AND
                MEDIAVOL.MEDVOLNR = COLMEDIAVOL.MEDVOLNR AND
                MEDIA.MEDIAKEY = COLMEDIAVOL.MEDIAKEY AND
                MAJORCOL.MAJCOLIDHI = MINORCOL.MAJCOLIDHI AND
                MAJORCOL.MAJCOLIDLO = MINORCOL.MAJCOLIDLO AND
                MINORCOL.MINCOLIDHI = COLMEDIAVOL.MINCOLIDHI AND
                MINORCOL.MINCOLIDLO = COLMEDIAVOL.MINCOLIDLO AND
                MEDIAPOOL.MEDIAPOOLKEY = :a_poolKey AND
                MEDIA.MEDIAPOOLKEY = MEDIAPOOL.MEDIAPOOLKEY
            ORDER BY MEDIAVOL.VOLUSED DESC;

    EXEC SQL
        OPEN TRANSACTION readTrans COLALLOC;

    vector<rm_ColAlloc> colAllVec;
    rm_ColAlloc colAll;

    Int32_t minHi(0);
    Int32_t minLo(0);

    while (1) {        // get all volumes
        EXEC SQL
            FETCH
            COLALLOC INTO
                :minHi,
                :minLo,
                :colAll.minFlags,
                :colAll.majSize,
                :colAll.mediumKey,
                :colAll.medStatus,
                :colAll.medVolNr,
                :colAll.volStatus,
                :colAll.volUsed,
                :colAll.volSize;

        log_DBG_m(dbg_DETAIL,"SQLCODE Fetch on COLALLOC: " << SQLCODE);
        if (SQLCODE != 0) break;
        colAll.majColId = a_majColId;
        colAll.minColId = RMDB_COL_ID(minHi, minLo);

        log_DBG_m(dbg_DETAIL,"colAll.mediumKey: " << colAll.mediumKey <<
                            " colAll.medVolNr:" << colAll.medVolNr );

        colAllVec.push_back(colAll);
    } // while end

    EXEC SQL
        CLOSE COLALLOC;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE COLALLOC");
    SQL_CHECKREAD_M( sqlErrDesc );

    return colAllVec;
}

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 1679 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, 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().

                                                     {
    log_FUNC_m(SelectDrive);
    i_Drive_t i_drv;
    try {

        rm_Drive d;
        rm_String dName(rmdb_MAX_DRIVENAME);
        dName = a_driveName;
        d.SelectByName(dName);

        i_drv.aveSeekTime      = d.aveSeekTime;
        i_drv.capabilities     = d.capabilities;
        i_drv.cleanNr          = d.cleanNr;
        i_drv.dataThroughput   = d.dataThroughput;
        i_drv.driveKey         = d.driveKey;
        i_drv.lastClean        = d.lastClean.GetTime();
        i_drv.loadTime         = d.loadTime;
        i_drv.mediaFamily      = d.mediaFamily;
        i_drv.options          = d.options;
        i_drv.rewindTime       = d.rewindTime;
        i_drv.status           = d.status;
        i_drv.unloadTime       = d.unloadTime;
        i_drv.usageCount       = d.usageCount;
        i_drv.driveIndex       = CORBA::string_dup(d.driveIndex.cvalue_p);
        i_drv.driveName        = CORBA::string_dup(d.driveName.cvalue_p);
        i_drv.firmwareRev      = CORBA::string_dup(d.firmwareRev.cvalue_p);
        i_drv.scsiID           = CORBA::string_dup(d.scsiID.cvalue_p);


        if (d.libraryKey > 0) {
            rm_Library lib(d.libraryKey);
            i_drv.libraryName = CORBA::string_dup(lib.libraryName.c_str());
        } else {
            i_drv.libraryName = CORBA::string_dup(ipc_nilStr);
        }

        i_drv.productID        = CORBA::string_dup(d.productID.cvalue_p);
        i_drv.serialNo         = CORBA::string_dup(d.serialNo.cvalue_p);
        i_drv.vendorID         = CORBA::string_dup(d.vendorID.cvalue_p);

        return i_drv;
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2908 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_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.

                                                     {
    log_FUNC_m(SelectDrive);
    i_Drive_t i_drv;
    try {

        rm_Drive d;

        d.Select(a_driveKey);

        i_drv.aveSeekTime      = d.aveSeekTime;
        i_drv.capabilities     = d.capabilities;
        i_drv.cleanNr          = d.cleanNr;
        i_drv.dataThroughput   = d.dataThroughput;
        i_drv.driveKey         = d.driveKey;
        i_drv.lastClean        = d.lastClean.GetTime();
        i_drv.loadTime         = d.loadTime;
        i_drv.mediaFamily     = d.mediaFamily;
        i_drv.options          = d.options;
        i_drv.rewindTime       = d.rewindTime;
        i_drv.status           = d.status;
        i_drv.unloadTime       = d.unloadTime;
        i_drv.usageCount       = d.usageCount;
        i_drv.driveIndex       = CORBA::string_dup(d.driveIndex.cvalue_p);
        i_drv.firmwareRev       = CORBA::string_dup(d.firmwareRev.cvalue_p);
        i_drv.scsiID       = CORBA::string_dup(d.scsiID.cvalue_p);

        i_drv.driveName        = CORBA::string_dup(d.driveName.cvalue_p);

        if (d.libraryKey > 0) {
            rm_Library lib;
            lib.Select(d.libraryKey);
            i_drv.libraryName      = CORBA::string_dup(lib.libraryName.cvalue_p);
        } else {
            i_drv.libraryName      = CORBA::string_dup(ipc_nilStr);
        }

        i_drv.productID        = CORBA::string_dup(d.productID.cvalue_p);
        i_drv.serialNo         = CORBA::string_dup(d.serialNo.cvalue_p);
        i_drv.vendorID         = CORBA::string_dup(d.vendorID.cvalue_p);

        return i_drv;
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 3652 of file rm_operator.cpp.

References rm_Medium::barcode, dbg_DETAIL, dbg_LOW, dbg_NORM, 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, 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().

                                                            {
    log_FUNC_m(SelectDriveForMig);

    if (a_resource.mediumFamily == mf_DISK){
        return true;
    }

    rm_Drive drv;
    rm_Medium med(a_resource.mediumKey);

    if (a_resource.driveKey > 0) {
        drv.Select(a_resource.driveKey);
        log_DBG_m(dbg_DETAIL, "drive: " << drv.driveName <<
                                " status:" << drv.status);

        if ( (drv.status & (rmdb_DRIVE_IN_USE | rmdb_DRIVE_DISABLED | rmdb_DRIVE_ERROR)) != 0 ){
            ostringstream msg;
            msg << "Medium " << med.barcode <<
                    " is inserted in unusable drive. Please unload manually.";

            log_WriteEvent(msg.str(), "DRIVE", 0, string(drv.driveName));
            log_ERR_m(msg.str());
            return false;
        } else {

            //status ok checking WORM capabilities
            if ( !IsMediumWORM(med) || IsDriveWORM(drv) ) {
                log_DBG_m(dbg_LOW,"Found drive usable: " << drv.driveName);
                return true;
            } else {
                log_DBG_m(dbg_LOW,  "Found drive, but WORM check failed: " <<
                                    drv.driveName);
                return false;
            }
        }
        return true;
    }
    else if (med.libraryKey > 0) { // nearline

        // select a drive that is in same library as medium and is preferably empty
        rm_MediaPool pool(med.mediaPoolKey);
        UInt32_t reqCapability(0);
        if (IsMediumWORM(med)) {
            reqCapability |= dc_WORM;
        }
        vector<rm_Drive> drvVec = drv.SelectForOperation(
                                                med.libraryKey,
                                                pool.mediaFamily,
                                                reqCapability,
                                                false);

        if (drvVec.size() == 0) {
            log_DBG_m(dbg_LOW,"No Drives available for operation");
            return false;
        }

        rm_Library lib(med.libraryKey);
        if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
            log_WRN_m("Library disabled or Error. Can not allocate resources. " <<
                            lib.libraryName);
            return false;
        } else {
            a_resource.libraryName = lib.libraryName;
            a_resource.libraryHost = lib.host;
        }

        //check if any is empty and select it
        vector<rm_Drive>::iterator it;

        bool emptyDrvFound(false);

        for ( it = drvVec.begin(); it != drvVec.end(); it++ ){
            rm_Medium tempMedium;
            try {
                tempMedium.SelectByDrive(it->driveKey);
            } catch (ivd_DBException& dbe){
                if (dbe.GetError() == SQL_NOTFOUND){
                    log_DBG_m(dbg_LOW,"Found empty drive: " << it->driveKey);
                    drv = *it;
                    emptyDrvFound = true;
                    a_resource.load = true;
                    break;
                }
                else throw;
            }
        }

        if (!emptyDrvFound){
            //just take first
            drv = *drvVec.begin();
            a_resource.load = true;
            a_resource.unload= true;
            rm_Medium medUnload;
            medUnload.SelectByDrive(drv.driveKey);
            if (medUnload.slotKey > 0) {
                rm_Slot unloadSlot;
                unloadSlot.Select(medUnload.slotKey, medUnload.libraryKey);
                a_resource.unloadSlotAddr = unloadSlot.slotAddr;
                a_resource.unloadBarcode = medUnload.barcode;
            }
        }

        if (a_resource.load && med.slotKey > 0) { // if in slot ok select it
            rm_Slot selSlot;
            selSlot.Select(med.slotKey, med.libraryKey);
            a_resource.loadSlotAddr = selSlot.slotAddr;
        }
        else {
            a_resource.loadSlotAddr = "";
            log_DBG_m( dbg_LOW,  "Selected Medium: " << med.barcode <<
                        "  for migration without SlotKey. Assuming Manual Robot");
        }
        a_resource.driveKey = drv.driveKey;
        a_resource.driveIndex = drv.driveIndex;

        log_DBG_m(dbg_LOW,"Found Drive: " << drv.driveKey);
        return true;
    } else { //offline
        ostringstream sstr;
        sstr << "Medium " << med.barcode <<
            " is offline. Please insert into Library Manually";
        log_WriteEvent(sstr.str());
        log_DBG_m(dbg_NORM, sstr.str());
        return false;
    }
}

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 1887 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, rmdb_MAX_DRIVENAME, rmdb_MAX_HOSTNAME, rm_DriveHost::Select(), and rm_Drive::SelectByName().

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

                                                                             {
    i_DriveHost_t i_dH;
    try {

        rm_DriveHost dH;

        rm_String host(rmdb_MAX_HOSTNAME);
        host = a_host;


        rm_String driveName(rmdb_MAX_DRIVENAME);
        driveName = a_driveName;
        rm_Drive drive;

        drive.SelectByName(driveName);

        dH.Select(drive.driveKey, host);

        i_dH.controlDevice = CORBA::string_dup(dH.controlDevice.cvalue_p);
        i_dH.host = CORBA::string_dup(dH.host.cvalue_p);
        i_dH.driveName = CORBA::string_dup(driveName.cvalue_p);

        return i_dH;

    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2953 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, rmdb_MAX_HOSTNAME, and rm_DriveHost::Select().

                                                                             {
    i_DriveHost_t i_dH;
    try {

        rm_DriveHost dH;
        rm_String host(rmdb_MAX_HOSTNAME);
        host = a_host;

        dH.Select(a_driveKey, host);
        rm_Drive d(a_driveKey);

        i_dH.controlDevice = CORBA::string_dup(dH.controlDevice.cvalue_p);
        i_dH.host = CORBA::string_dup(dH.host.cvalue_p);
        i_dH.driveName = CORBA::string_dup(d.driveName.cvalue_p);

        return i_dH;

    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1949 of file rm_operator.cpp.

References ie_NYI, and ivd_Error.

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

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

Here is the caller graph for this function:

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

Definition at line 2974 of file rm_operator.cpp.

References ie_NYI, and ivd_Error.

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

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

Definition at line 1593 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, 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().

                                                            {
    i_Library_t i_lib;
    try {

        rm_Library lib;
        rm_String libName(rmdb_MAX_LIBRARYNAME);
        libName = a_libraryName;

        lib.SelectByName(libName);

        i_lib.auditTime        = lib.auditTime;
        i_lib.capabilities     = lib.capabilities;
        i_lib.libraryKey       = lib.libraryKey;
        i_lib.libraryType      = lib.libraryType;
        i_lib.loadNr           = lib.loadNr;
        i_lib.mediaAccessTime  = lib.mediaAccessTime;
        i_lib.mediaFamily      = lib.mediaFamily;
        i_lib.mediaXChgTime    = lib.mediaXChgTime;
        i_lib.options          = lib.options;
        i_lib.status           = lib.status;
        i_lib.unloadNr         = lib.unloadNr;

        i_lib.controlDevice    = CORBA::string_dup(lib.controlDevice.cvalue_p);
        i_lib.host             = CORBA::string_dup(lib.host.cvalue_p);
        i_lib.libraryName      = CORBA::string_dup(lib.libraryName.cvalue_p);
        i_lib.productID        = CORBA::string_dup(lib.productID.cvalue_p);
        i_lib.serialNo         = CORBA::string_dup(lib.serialNo.cvalue_p);
        i_lib.vendorID         = CORBA::string_dup(lib.vendorID.cvalue_p);
        i_lib.firmwareRev      = CORBA::string_dup(lib.firmwareRev.cvalue_p);
        i_lib.scsiID           = CORBA::string_dup(lib.scsiID.cvalue_p);

        return i_lib;
    } rm_CATCH_DB_THROW_IVD_m;
}

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 2875 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_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.

                                                              {
    i_Library_t i_lib;
    try {

        rm_Library lib;

        lib.Select(a_libraryKey);

        i_lib.auditTime        = lib.auditTime;
        i_lib.capabilities     = lib.capabilities;
        i_lib.libraryKey       = lib.libraryKey;
        i_lib.libraryType      = lib.libraryType;
        i_lib.loadNr           = lib.loadNr;
        i_lib.mediaAccessTime  = lib.mediaAccessTime;
        i_lib.mediaFamily      = lib.mediaFamily;
        i_lib.mediaXChgTime    = lib.mediaXChgTime;
        i_lib.options          = lib.options;
        i_lib.status           = lib.status;
        i_lib.unloadNr         = lib.unloadNr;

        i_lib.controlDevice    = CORBA::string_dup(lib.controlDevice.cvalue_p);
        i_lib.host             = CORBA::string_dup(lib.host.cvalue_p);
        i_lib.libraryName      = CORBA::string_dup(lib.libraryName.cvalue_p);
        i_lib.productID        = CORBA::string_dup(lib.productID.cvalue_p);
        i_lib.serialNo         = CORBA::string_dup(lib.serialNo.cvalue_p);
        i_lib.vendorID         = CORBA::string_dup(lib.vendorID.cvalue_p);
        i_lib.firmwareRev         = CORBA::string_dup(lib.firmwareRev.cvalue_p);
        i_lib.scsiID         = CORBA::string_dup(lib.scsiID.cvalue_p);

        return i_lib;
    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 1548 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, and rm_MajorCol::Select().

Referenced by dbo_SelectMajorCol::Process().

                                                            {
    log_FUNC_m(SelectMajorCol);
    i_MajorCol_t i_majorCol;
    try {
        rm_MajorCol majorCol;
        UInt64_t majColId;
        majColId = a_majColId;

        majorCol.Select(majColId);

        i_majorCol.majColId        = majorCol.majColId;
        i_majorCol.majColSize      = majorCol.majColSize;
        i_majorCol.partUUID        = majorCol.partUUID.cvalue_p;
        i_majorCol.flags           = majorCol.flags;

        log_DBG_m(dbg_LOW,"Select MajorCol: " << i_majorCol.majColId << ","
                                              << i_majorCol.majColSize << ","
                                              << i_majorCol.partUUID << ","
                                              << i_majorCol.flags);
        return i_majorCol;

    } rm_CATCH_DB_THROW_IVD_m;
}

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 2053 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, 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().

                                                                  {
    i_MediaPool_t i_mp;
    try {

        rm_MediaPool mp;
        rm_String poolName(rmdb_MAX_MEDIAPOOLNAME);
        poolName = a_mediaPoolName;
        mp.SelectByName(poolName);

        i_mp.blockSize      = mp.blockSize;
        i_mp.numOfVolumes   = mp.numOfVolumes;
        i_mp.sysVolLocation    = mp.sysVolLocation;
        i_mp.sizeOfSysVol   = mp.sizeOfSysVol;
        i_mp.maxMediaAge    = mp.maxMediaAge;
        i_mp.maxNrReadWrite = mp.maxNrReadWrite;
        i_mp.mediaFamily    = mp.mediaFamily;
        i_mp.mediaPoolKey   = mp.mediaPoolKey;
        i_mp.mediaPoolName  = CORBA::string_dup(mp.mediaPoolName.cvalue_p);
        i_mp.mediaPoolType  = mp.mediaPoolType;
        i_mp.partitionUUIDString  = CORBA::string_dup(mp.partitionUUIDString.cvalue_p);
        i_mp.poolUUIDString  = CORBA::string_dup(mp.poolUUIDString.cvalue_p);
        i_mp.sizeOfVolume   = mp.sizeOfVolume;

        return i_mp;

    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2978 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_MediaPool::Select(), rm_MediaPool::sizeOfSysVol, i_MediaPool_t::sizeOfSysVol, rm_MediaPool::sizeOfVolume, i_MediaPool_t::sizeOfVolume, rm_MediaPool::sysVolLocation, and i_MediaPool_t::sysVolLocation.

                                                                  {
    i_MediaPool_t i_mp;
    try {

        rm_MediaPool mp;

        mp.Select(a_mediaPoolKey);

        i_mp.blockSize      = mp.blockSize;
        i_mp.numOfVolumes   = mp.numOfVolumes;
        i_mp.sysVolLocation    = mp.sysVolLocation;
        i_mp.sizeOfSysVol   = mp.sizeOfSysVol;
        i_mp.maxMediaAge    = mp.maxMediaAge;
        i_mp.maxNrReadWrite = mp.maxNrReadWrite;
        i_mp.mediaFamily    = mp.mediaFamily;
        i_mp.mediaPoolKey   = mp.mediaPoolKey;
        i_mp.mediaPoolName  = CORBA::string_dup(mp.mediaPoolName.cvalue_p);
        i_mp.mediaPoolType  = mp.mediaPoolType;
        i_mp.partitionUUIDString  = CORBA::string_dup(mp.partitionUUIDString.cvalue_p);
        i_mp.poolUUIDString  = CORBA::string_dup(mp.poolUUIDString.cvalue_p);
        i_mp.sizeOfVolume   = mp.sizeOfVolume;

        return i_mp;

    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

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

Definition at line 2081 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, 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().

                                                                        {
    i_MediaPool_t i_mp;
    try {
        rm_MediaPool mp;
        rm_String poolUUID(rmdb_MAX_UUID);
        poolUUID = a_mediaPoolUUID;
        cmn_UUID_t uuid(poolUUID);
        mp.SelectByUUID(uuid);

        i_mp.blockSize          = mp.blockSize;
        i_mp.numOfVolumes       = mp.numOfVolumes;
        i_mp.sysVolLocation     = mp.sysVolLocation;
        i_mp.sizeOfSysVol       = mp.sizeOfSysVol;
        i_mp.maxMediaAge        = mp.maxMediaAge;
        i_mp.maxNrReadWrite     = mp.maxNrReadWrite;
        i_mp.mediaFamily        = mp.mediaFamily;
        i_mp.mediaPoolKey       = mp.mediaPoolKey;
        i_mp.mediaPoolName      = CORBA::string_dup(mp.mediaPoolName.cvalue_p);
        i_mp.mediaPoolType      = mp.mediaPoolType;
        i_mp.partitionUUIDString
            = CORBA::string_dup(mp.partitionUUIDString.cvalue_p);
        i_mp.poolUUIDString
            = CORBA::string_dup(mp.poolUUIDString.cvalue_p);
        i_mp.sizeOfVolume   = mp.sizeOfVolume;

        return i_mp;

    } rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3005 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_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.

                                                        {
    log_FUNC_m(SelectMedium);
    try {

        rm_Medium medium;
        medium.Select(a_mediumKey);

        i_Medium_t iMedium;

        iMedium.mediumKey         = medium.mediumKey;
        if (medium.mediaPoolKey > 0 ) {
            rm_MediaPool mp(medium.mediaPoolKey);
            iMedium.mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
            if (!string(mp.partitionUUIDString).empty()){
                rm_Partition part;
                part.SelectByUuid(mp.partitionUUIDString);
                iMedium.partitionName    = CORBA::string_dup(part.partitionName.c_str());
            } else {
                iMedium.partitionName    = CORBA::string_dup(ipc_nilStr);
            }
        } else {
            iMedium.mediaPoolName    = CORBA::string_dup(ipc_nilStr);
            iMedium.partitionName    = CORBA::string_dup(ipc_nilStr);
        }



        if (medium.libraryKey > 0) {
            rm_Library lib(medium.libraryKey);
            iMedium.libraryName       = CORBA::string_dup(lib.libraryName.c_str());

            rm_Slot s(medium.slotKey,lib.libraryKey);

            iMedium.slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
            iMedium.slotType          = s.slotType;
        } else {
            iMedium.libraryName       = CORBA::string_dup(ipc_nilStr);
            iMedium.slotAddr          = CORBA::string_dup(ipc_nilStr);
            iMedium.slotType          = 0;
        }


        if (medium.driveKey > 0) {
            rm_Drive d(medium.driveKey);
            iMedium.driveName    = CORBA::string_dup(d.driveName.c_str());
        } else {
            iMedium.driveName    = CORBA::string_dup(ipc_nilStr);
        }


        if (medium.diskSubsysKey > 0) {
            rm_DiskSubsys dss(medium.diskSubsysKey);
            iMedium.diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
        } else {
            iMedium.diskSubsysName    = CORBA::string_dup(ipc_nilStr);
        }

        iMedium.barcode          = CORBA::string_dup(medium.barcode.c_str());
        iMedium.status           = medium.status;
        iMedium.location         = CORBA::string_dup(medium.location.c_str());
        iMedium.mediumType       = medium.mediumType;
        iMedium.mediumSerialNo   = CORBA::string_dup(medium.mediumSerialNo.c_str());
        iMedium.blockSize        = medium.blockSize;
        iMedium.numOfVolumes     = medium.numOfVolumes;
        iMedium.idxOfSysVol      = medium.idxOfSysVol;
        iMedium.sizeOfSysVol     = medium.sizeOfSysVol;
        iMedium.currentVolume    = medium.currentVolume;

        return iMedium;
    } rm_CATCH_DB_THROW_IVD_m;

}

Here is the call graph for this function:

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

Definition at line 2217 of file rm_operator.cpp.

References rm_Medium::Convert2Corba(), log_FUNC_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().

                                                           {
    log_FUNC_m(SelectMedium);
    try {

        rm_Medium medium;
        rm_String medBarcode(rmdb_MAX_BARCODE);
        medBarcode = a_mediumBarcode;
        medium.SelectByBarcode(medBarcode);

        i_Medium_t iMedium;
        iMedium = medium.Convert2Corba();
        return iMedium;
    } rm_CATCH_DB_THROW_IVD_m;

}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2233 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, 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().

                                                              {
    log_FUNC_m(SelectMediumByDrive);

    try {

        rm_Drive d;
        rm_String driveName(rmdb_MAX_DRIVENAME);
        driveName = a_driveName;
        d.SelectByName(driveName);


        rm_Medium medium;
        medium.SelectByDrive(d.driveKey);

        i_Medium_t iMedium;

        iMedium.mediumKey = medium.mediumKey;

        if (medium.mediaPoolKey > 0 ) {
            rm_MediaPool mp(medium.mediaPoolKey);
            iMedium.mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
        } else {
            iMedium.mediaPoolName    = CORBA::string_dup(ipc_nilStr);
        }


        if (medium.libraryKey > 0) {
            rm_Library lib(medium.libraryKey);
            iMedium.libraryName       = CORBA::string_dup(lib.libraryName.c_str());

            if (medium.slotKey > 0) {
                rm_Slot s(medium.slotKey,lib.libraryKey);
                iMedium.slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
                iMedium.slotType          = s.slotType;
            } else {
                iMedium.slotAddr          = CORBA::string_dup(ipc_nilStr);
                iMedium.slotType          = 0;
            }


        } else {
            iMedium.libraryName       = CORBA::string_dup(ipc_nilStr);
        }


        if (medium.driveKey > 0) {
            iMedium.driveName    = CORBA::string_dup(d.driveName.c_str());
        } else {
            iMedium.driveName    = CORBA::string_dup(ipc_nilStr);
        }


        if (medium.diskSubsysKey > 0) {
            rm_DiskSubsys dss(medium.diskSubsysKey);
            iMedium.diskSubsysName    = CORBA::string_dup(dss.diskSubsysName.c_str());
        } else {
            iMedium.diskSubsysName    = CORBA::string_dup(ipc_nilStr);
        }

        iMedium.barcode          = CORBA::string_dup(medium.barcode.c_str());
        iMedium.status           = medium.status;
        iMedium.location         = CORBA::string_dup(medium.location.c_str());
        iMedium.mediumType       = medium.mediumType;
        iMedium.mediumSerialNo   = CORBA::string_dup(medium.mediumSerialNo.c_str() );
        iMedium.blockSize        = medium.blockSize;
        iMedium.numOfVolumes     = medium.numOfVolumes;
        iMedium.idxOfSysVol      = medium.idxOfSysVol;
        iMedium.sizeOfSysVol     = medium.sizeOfSysVol;
        iMedium.currentVolume    = medium.currentVolume;

        return iMedium;
    } rm_CATCH_DB_THROW_IVD_m;

}

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 4759 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, 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_Resource_t::majColId, MajorColIdMatches(), 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, mt_DISK, NAME, NULL, rm_Medium::numOfVolumes, rm_Resource_t::poolKey, rm_Resource_t::resourceBusyStatus, rmdb_INIT_LIBRARY_STATUS, rmdb_MEDIUM_FULL, rmdb_MEDIUM_OFFLINE, 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().

                                                                   {
    log_FUNC_m(SelectMediumForMig);
    rm_Medium med;
    //Declare cursor for Select operation
    UInt32_t mms = rmdb_MEDIUM_FULL | rmdb_MEDIUM_UNRELIABLE | rmdb_MEDIUM_UNUSABLE | rmdb_MEDIUM_OFFLINE | rmdb_MEDIUM_IN_USE;
    UInt32_t mt = mt_DISK;
    EXEC SQL
        DECLARE SELECT_MEDIA_FOR_MIGRATION CURSOR FOR
        SELECT * FROM MEDIA
            WHERE
                ( MEDIA.MEDIAPOOLKEY = :a_resource.poolKey AND
                  bin_and(MEDIA.STATUS, :mms) = 0 )

                  AND

                ( (bin_and(:a_online, 1) = 0) OR
                  (MEDIA.DRIVEKEY IS NOT NULL)  OR
                  (bin_and(MEDIA.MEDIATYPE, :mt) != 0 )
                 )

            ORDER BY DRIVEKEY DESC, STATUS DESC;

    if (SQLCODE < SQL_NOERROR){
        throw ivd_DBException(SQLCODE,"EXEC SQL DECLARE SELECT_MEDIA_FOR_MIGRATION", true);
    }

    EXEC SQL
        SET TRANSACTION NAME allocTrans
        ISOLATION LEVEL READ COMMITTED;

    EXEC SQL
        OPEN TRANSACTION allocTrans
        SELECT_MEDIA_FOR_MIGRATION;

    if (SQLCODE < SQL_NOERROR){
        throw ivd_DBException(SQLCODE,"EXEC SQL OPEN SELECT__MEDIA_FOR_MIGRATION", true);
    }

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];

    bool allFound = false;
    while (!allFound) {
        EXEC SQL
            FETCH SELECT_MEDIA_FOR_MIGRATION
                INTO
                   :med.mediumKey,
                   :med.mediaPoolKey,
                   :med.libraryKey,
                   :med.slotKey,
                   :med.diskSubsysKey,
                   :med.driveKey,
                   :barcodeVal,
                   :med.status,
                   :locationVal,
                   :med.mediumType,
                   :mediumSerialNoVal,
                   :med.blockSize,
                   :med.numOfVolumes,
                   :med.idxOfSysVol,
                   :med.sizeOfSysVol,
                   :med.currentVolume;

        Int32_t sqlCode = SQLCODE;
        if (sqlCode == 0) {
            log_DBG_m(dbg_DETAIL, "Selected Medium:" << med.mediumKey << " Status: " << med.status );
        }
        else {
            log_DBG_m(dbg_DETAIL, "No more rows");
        }

        if (sqlCode == SQL_NOERROR) {

            med.barcode         = barcodeVal;
            med.location        = locationVal;
            med.mediumSerialNo  = mediumSerialNoVal;

            a_resource.barcode    = med.barcode;
            a_resource.blockSize  = med.blockSize;
            a_resource.mediumKey  = med.mediumKey;
            a_resource.driveKey   = med.driveKey;

            if (med.mediumType == mt_DISK){
                a_resource.mediumFamily = mf_DISK;
            }

            bool failed(false);
            if (med.libraryKey > 0){
                rm_Library lib(med.libraryKey);
                if (lib.status != rmdb_INIT_LIBRARY_STATUS) {
                    log_WRN_m("Library disabled or Error. Can not allocate resources. " <<
                                       lib.libraryName);
                    failed = true;
                } else {
                    a_resource.libraryName = lib.libraryName;
                    a_resource.libraryHost = lib.host;
                }
            }
            else {
                log_DBG_m(dbg_LOW, "Medium is not inserted in any library. BC:" << med.barcode);
            }

            // extended with Plasmon patch
            if (!failed) {
                bool foundVolume = false;
                try {
                    rm_MediumVol mv;
                    if (a_col) {
                        log_DBG_m(dbg_LOW, "Requested major collocation ID: " << a_resource.majColId);
                        // Check if medium's major collocation ID matches the requested ID
                        bool majorColIdMatches(MajorColIdMatches(med, a_resource.majColId));

                        log_DBG_m(dbg_DETAIL, "majorColIdMatches: " << boolalpha << majorColIdMatches);
                        if (majorColIdMatches) {
                            UInt32_t volNum;
                            foundVolume = SelectMediumVolumeCol(med, volNum);
                            if (foundVolume) {
                                log_DBG_m(dbg_LOW, "found volNum:" << volNum);
                                mv.Select(med.mediumKey, volNum);
                            }
                        }
                    }
                    else {
                        foundVolume = SelectMediumVolumeMig(med, mv);
                    }
                    if (foundVolume){
                        a_resource.medVolNr = mv.medVolNr;
                        a_resource.medVolId = mv.medVolId;
                    }
                    else {
                        bool mediumFull = CheckMediumFull(med.mediumKey);
                        if (mediumFull) {
                            a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
                        }
                    }
                }
                catch (...) {
                    foundVolume = false;
                }

                if (med.mediumType == mt_DISK ) {
                    allFound = foundVolume;
                }
                else {
                    try {
                        if (foundVolume) {
                            //medium can be used, now search for drive
                            allFound = SelectDriveForMig(a_resource);
                        }
                    }
                    catch (...) {
                        allFound = false;
                    }
                }
             }
        } //if (sqlCode == SQL_NOERROR)
        else if (sqlCode == SQL_NOTFOUND) {
            log_DBG_m(dbg_LOW, "No Medium found for Migration");

            EXEC SQL
                CLOSE SELECT_MEDIA_FOR_MIGRATION;

            isc_commit_transaction (isc_status, &allocTrans);
            SQLCODE = isc_sqlcode (isc_status);

            // Removing media info
            a_resource.resourceBusyStatus = i_MEDIUM_NOT_AVAILABLE;
            a_resource.mediumKey = 0;
            a_resource.barcode.empty();
            return false;

        } //else if (sqlCode == SQL_NOTFOUND)
        else {
            log_DBG_m(dbg_NORM,"Fatal Allocation error sqlcode:" << SQLCODE);

            EXEC SQL
                CLOSE SELECT_MEDIA_FOR_MIGRATION;

            isc_commit_transaction (isc_status, &allocTrans);
            SQLCODE = isc_sqlcode (isc_status);

            throw ivd_Error (
                    ie_NO_RESOURCE_FOUND,
                    "Fatal Allocation error sqlcode:" +
                    cmn_Num2Str((Int32_t)SQLCODE));

        } //else (fatal error occured)
    } //while !found

    EXEC SQL
        CLOSE SELECT_MEDIA_FOR_MIGRATION;
    log_DBG_m(dbg_DETAIL,"Closing SELECT_MEDIA_FOR_MIGRATION:" << SQLCODE);

    isc_commit_transaction (isc_status, &allocTrans);
    SQLCODE = isc_sqlcode (isc_status);
    return allFound;
}

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 2389 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, 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().

                                                                                         {
    log_FUNC_m(SelectMediumVol);
    try {

        rm_Medium medium;
        rm_String medBarcode(rmdb_MAX_BARCODE);
        medBarcode = a_mediumBarcode;
        medium.SelectByBarcode(medBarcode);

        rm_MediumVol mediumVol;
        mediumVol.Select(medium.mediumKey, a_mediumVolNr);

        i_MediumVol_t iMediumVol;

        iMediumVol.medVolNr          = mediumVol.medVolNr;
        iMediumVol.mediumBarcode     = CORBA::string_dup(medBarcode.c_str());
        iMediumVol.accessNr          = mediumVol.accessNr;
        iMediumVol.accessTime        = mediumVol.accessTime.