Public Member Functions | Private Attributes

api_Partition Class Reference

#include <api_partition.h>

Collaboration diagram for api_Partition:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 api_Partition (IN api_Base *a_hsm, IN const string &a_partitionName, IN const string &a_sharedDir, IN const string &a_localMountPoint)
virtual ~api_Partition (void)
ivd_PartitionStatus_e SetReferences ()
string GetPathSeparator (void)
 api_Partition::GetPathSeparator
string GetMountPoint (void)
 api_Partition::GetMountPoint
UInt32_t GetPartitionStatus (void) const
 api_Partition::GetPartitionStatus
string LocalPath2HSM (IN const string &a_localPath)
 api_Partition::LocalPath2HSM
UInt32_t MigrateFile (IN const string &a_localPath, IN UInt64_t a_majColId, IN UInt64_t a_minColId, IN UInt32_t a_flags, OUT vector< UInt64_t > &a_jobIdList)
 api_Partition::MigrateFile with collocation
UInt32_t CreateMajorCol (IN UInt64_t a_majColId, IN UInt32_t a_majColSize)
 Collocation.
UInt32_t UpdateMajColSize (IN UInt64_t a_majColId, IN UInt32_t a_majColSize)
UInt32_t EnumMinorCollocationId (IN UInt64_t a_majColId, OUT vector< MinorIDs_t > &a_minColIdList)
UInt32_t EnumMajorCollocationId (OUT vector< MajorIDs_t > &a_majColIdList)
UInt32_t JobStatus (IN vector< UInt64_t > &a_jobIdList, OUT vector< UInt64_t > &a_statusList)
 api_Partition::JobStatus
UInt32_t GetFileStatus (IN const string &g_localFilePath, OUT ivd_FileStatus_e &status)
 api_Partition::GetFileStatus
UInt32_t GetFileLocations (IN const string &a_fileName, OUT vector< SplitLocation_t > &a_locationData)
 api_Partition::GetFileLocations
UInt32_t GetVolumeList (OUT vector< MediaData_t > &aMediaData)
UInt32_t GetVolumeListMinor (IN UInt64_t MinorCollocationId, OUT vector< MediaData_t > &aMediaData)
UInt32_t GetVolumeListMajor (IN UInt64_t MajorCollocationId, OUT vector< MediaData_t > &aMediaData)
UInt32_t ReorgScan (i_Time_t a_date, UInt32_t a_numOfGenerations, UInt64_t &a_jobID)
UInt32_t Reorg (const char *a_medBarcode, UInt32_t a_volNum, UInt64_t &a_jobID)
UInt32_t ReorganizeMedium (const char *a_medBarcode, IN UInt32_t a_volNum)
UInt32_t ReorgByColId (UInt64_t a_majColId, UInt64_t a_minColId, vector< UInt64_t > &a_jobIdList)

Private Attributes

string m_pathSeparator
string m_partitionName
cmn_Path m_mountPoint
cmn_Path m_sharedDir
cmn_Path m_localMountPoint
UInt32_t m_status
api_Basem_hsm
i_Partition_t m_partition
i_PartitionManager_var m_iPM
i_HSM_var m_iHSM

Detailed Description

Definition at line 32 of file api_partition.h.


Constructor & Destructor Documentation

api_Partition::api_Partition ( IN api_Base a_hsm,
IN const string &  a_partitionName,
IN const string &  a_sharedDir,
IN const string &  a_localMountPoint 
)
api_Partition::~api_Partition ( void   )  [virtual]

Definition at line 231 of file api_partition.cpp.

References dbg_NORM, log_DBG_m, log_FUNC_m, and m_partitionName.

{
    log_FUNC_m(~api_Partition);
    log_DBG_m(dbg_NORM, "Disconnecting from " << m_partitionName );
}


Member Function Documentation

UInt32_t api_Partition::CreateMajorCol ( IN UInt64_t  a_majColId,
IN UInt32_t  a_majColSize 
)

Collocation.

Definition at line 367 of file api_partition.cpp.

References dbg_NORM, i_MajorCol_t::flags, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, m_iPM, api_Base::m_mif, m_partition, i_MajorCol_t::majColId, i_MajorCol_t::majColSize, i_Partition_t::partitionUUIDString, and i_MajorCol_t::partUUID.

{
    log_FUNC_m(CreateMajorCol);
    UInt32_t uiRet = ie_NO_ERROR;
    log_DBG_m(dbg_NORM, "CreateMajorCol Id " << a_majColId << ", size: " << a_majColSize);

    i_MajorCol_t majorCol;
    majorCol.majColId = a_majColId;
    majorCol.majColSize = a_majColSize;
    majorCol.partUUID = m_partition.partitionUUIDString;
    majorCol.flags = 0;

    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)){
                log_DBG_m(dbg_NORM, "Creating collocation id: " << a_majColId);
                m_iPM->AddMajorCol(majorCol);
            } else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while creating collocation id: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }
    return uiRet;
}

Here is the call graph for this function:

UInt32_t api_Partition::EnumMajorCollocationId ( OUT vector< MajorIDs_t > &  a_majColIdList  ) 

Definition at line 473 of file api_partition.cpp.

References dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, api_Base::m_mif, MajorIDsC::majColId, and MajorIDsC::majColSize.

{
    log_FUNC_m(EnumMajorCollocationId);
    UInt32_t uiRet = ie_NO_ERROR;

    i_MajorColSeq_t_var majColSeq;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)) {
                majColSeq = m_hsm->m_mif->EnumMajorCollocationId();
            }
            else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
            log_DBG_m(dbg_NORM, "Length: " << majColSeq->length());
            for (UInt32_t i = 0; i < majColSeq->length(); i++) {
                MajorIDs_t majColIdList;
                majColIdList.majColId   = majColSeq[i].majColId;
                majColIdList.majColSize = majColSeq[i].majColSize;

                a_MajorCollocationIdList.push_back(majColIdList);
                log_DBG_m(dbg_NORM, "EnumMajorCollocationId: " << majColIdList.majColId
                    << " size: " << majColIdList.majColSize);
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while enumerating major collocation IDs: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }

    return uiRet;
}

Here is the call graph for this function:

UInt32_t api_Partition::EnumMinorCollocationId ( IN UInt64_t  a_majColId,
OUT vector< MinorIDs_t > &  a_minColIdList 
)

Definition at line 434 of file api_partition.cpp.

References dbg_NORM, MinorIDsC::flags, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_A_m, log_WriteErrorEvent, m_hsm, api_Base::m_mif, and MinorIDsC::minColId.

{
    log_FUNC_A_m(EnumMinorCollocationId, a_MajorCollocationId);
    UInt32_t uiRet = ie_NO_ERROR;

    i_MinorColSeq_t_var minColSeq;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)) {
                minColSeq = m_hsm->m_mif->EnumMinorCollocationId(a_MajorCollocationId);
            }
            else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
            log_DBG_m(dbg_NORM, "Length: " << minColSeq->length());
            for (UInt32_t i = 0; i < minColSeq->length(); i++) {
                MinorIDs_t minColIdList;
                minColIdList.minColId = minColSeq[i].minColId;
                minColIdList.flags    = minColSeq[i].flags;

                a_MinorCollocationIdList.push_back(minColIdList);
                log_DBG_m(dbg_NORM, "EnumMinorCollocationId: " << minColIdList.minColId
                                                               << minColIdList.flags);
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while enumerating minor collocation IDs: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }

    return uiRet;
}

Here is the call graph for this function:

UInt32_t api_Partition::GetFileLocations ( IN const string &  a_fileName,
OUT vector< SplitLocation_t > &  a_locationData 
)

api_Partition::GetFileLocations

Definition at line 592 of file api_partition.cpp.

References SplitLocationC::barcode, SplitLocationC::blockOffset, SplitLocationC::copyNum, dbg_NORM, cmn_File::Exists(), file, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_BaseException::GetError(), cmn_File::GetFileType(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, ivd_GetFsAttr(), LocalPath2HSM(), log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, m_iPM, api_Base::m_mif, SplitLocationC::medVolNum, SplitLocationC::splitOffset, and SplitLocationC::splitSize.

{
    log_FUNC_m(GetFileLocations);

    cmn_File file(a_fileName);

    if (file.Exists()) {
        if (file.GetFileType() !=  ift_FILE) {
            log_WriteErrorEvent( a_fileName
            << " is not a file" )
            return ie_INVALID_ARG;
        }
    } else {
        log_WriteErrorEvent( a_fileName
            << " does not exist" );
        return ie_INVALID_ARG;
    }

    string hsmPath = LocalPath2HSM(a_fileName);
    log_DBG_m(dbg_NORM, "GetFileLocations( " << a_fileName << " )" );

    // get fileID from hsm

    ivd_hsmattr_t fsAttr;
    try {
        ivd_GetFsAttr(a_fileName.c_str(), &fsAttr);
        log_DBG_m(dbg_NORM, "GetFileStatus( " << hsmPath << " ) : "
            << " FileID= " << fsAttr.file_id
            << " status="
            << hex << fsAttr.flags );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( a_fileName.c_str()
             << " cannot get fileID ("
             << e.GetFriendly()
             << ")." );
        return e.GetError();
    }

    try {
        // get position from fsc
        ipc_EXEC_m(
            log_DBG_m(dbg_NORM, "Getting FSC reference...");
            i_FSC_var iFSC = m_iPM->GetFSC();

            log_DBG_m(dbg_NORM, "Got FSC.");

            i_CopiesPos_v_t_var copiesPos;
            i_MigID_t migID(0);
            copiesPos = iFSC->GetCopiesPos(i_FileID_t(fsAttr.file_id), migID, 0);
            //migId and filesize = 0, not checked

            for (UInt32_t i(0); i < copiesPos->length(); i++) {
                log_DBG_m(dbg_NORM, "cpoy: " << i);
                for (UInt32_t j(0); j < copiesPos[i].length(); j++) {
                    SplitLocation_t splitLoc;
                    splitLoc.copyNum = i+1;
                    splitLoc.medVolNum = copiesPos[i][j].medVolNum;
                    i_Medium_t_var m;
                    m = m_hsm->m_mif->GetMediumByKey(copiesPos[i][j].mediumKey);
                    strcpy(splitLoc.barcode, m->barcode);
                    splitLoc.blockOffset = copiesPos[i][j].blockOffset;
                    splitLoc.splitOffset = copiesPos[i][j].splitOffset;
                    splitLoc.splitSize = copiesPos[i][j].splitSize;

                    a_locationData.push_back(splitLoc);
                }
            }
        );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( e.GetFriendly());
        return e.GetError();
    }
    catch (std::exception &se) {
        log_WriteErrorEvent( "std::exception: " << se.what());
        return ie_STD_EXCEPTION;
    }
    catch (...) {
        log_WriteErrorEvent( "Unknown exception!" );
        return 999;
    }

    return ie_NO_ERROR;
}

Here is the call graph for this function:

UInt32_t api_Partition::GetFileStatus ( IN const string &  g_localFilePath,
OUT ivd_FileStatus_e status 
)

api_Partition::GetFileStatus

Definition at line 548 of file api_partition.cpp.

References dbg_NORM, cmn_File::Exists(), file, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_BaseException::GetError(), cmn_File::GetFileType(), ivd_BaseException::GetFriendly(), ivd_GetFsAttr(), LocalPath2HSM(), log_DBG_m, log_FUNC_m, and log_WriteErrorEvent.

{
    log_FUNC_m(GetFileStatus);

    cmn_File file(a_localFilePath);
    if (file.Exists()) {
        if (file.GetFileType() !=  ift_FILE) {
            log_WriteErrorEvent( a_localFilePath
                << " is not a file" );
            return ie_INVALID_ARG;
        }
    } else {
        log_WriteErrorEvent( "File "
            << a_localFilePath
            << " does not exist" );
        return ie_INVALID_ARG;
    }

    string hsmPath = LocalPath2HSM(a_localFilePath);
    ivd_hsmattr_t fsAttr;
    try {
        ivd_GetFsAttr(a_localFilePath.c_str(), &fsAttr);
        UInt32_t status = fsAttr.flags;
        a_status = static_cast<ivd_FileStatus_e>(status);
        log_DBG_m(dbg_NORM, "GetFileStatus( " << hsmPath << " ) : "
            << " FileID= " << fsAttr.file_id
            << " status="
            << hex << status
            << " a_status= " << a_status);
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( a_localFilePath.c_str()
             << " cannot get fileStatus ("
             << e.GetFriendly()
             << ")." );
        return e.GetError();
    }
    return ie_NO_ERROR;
}

Here is the call graph for this function:

string api_Partition::GetMountPoint ( void   ) 

api_Partition::GetMountPoint

Definition at line 247 of file api_partition.cpp.

                                          {
    return(m_mountPoint);
}

UInt32_t api_Partition::GetPartitionStatus ( void   )  const

api_Partition::GetPartitionStatus

Definition at line 254 of file api_partition.cpp.

References evt_ERROR, ipc_EXEC_m, log_FUNC_m, log_WriteEvent(), and m_iHSM.

                                                     {
    log_FUNC_m(GetPartitionStatus);
    try {
        i_HsmInfo_t_var hsmInfo;
        ipc_EXEC_m(
            m_iHSM->GetInfo(hsmInfo);
        );
        cmn_Path mountPoint = hsmInfo->mountPoint;
        mountPoint.RemoveTrailingPathSeparator();
        if (m_mountPoint == mountPoint){
            return ps_MOUNTED;
        }
        else {
            log_WriteEvent(evt_ERROR, "Mountpoint changed.");
            return ps_ERROR;
        }
    }
    catch (...) {
        //empty ignore
    }
    return ps_UNKNOWN;
}

Here is the call graph for this function:

string api_Partition::GetPathSeparator ( void   ) 

api_Partition::GetPathSeparator

Definition at line 240 of file api_partition.cpp.

References m_pathSeparator.

                                          {
            return(string(m_pathSeparator));
}

UInt32_t api_Partition::GetVolumeList ( OUT vector< MediaData_t > &  aMediaData  ) 

Definition at line 681 of file api_partition.cpp.

References MediaDataC::barcode, dbg_NORM, MediaDataC::flags, ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, api_Base::m_mif, m_partitionName, MediaDataC::majColId, MediaDataC::mediumKey, MediaDataC::minColId, MediaDataC::totalData, MediaDataC::validData, MediaDataC::volSize, MediaDataC::volumeNr, MediaDataC::volumeStatus, and MediaDataC::volUsed.

                                                                          {
    log_FUNC_m(GetVolumeList);

    UInt32_t uiRet = ie_NO_ERROR;
    i_MediaInfoSeq_t_var medInfoSeq;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)){
                log_DBG_m(dbg_NORM, "Getting media info.. ");

                medInfoSeq = m_hsm->m_mif->GetMediaInfo(CORBA::string_dup(m_partitionName.c_str()));
            }
            else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
            log_DBG_m(dbg_NORM, "Getting media info.. DONE");
            log_DBG_m(dbg_NORM, "Length: " << medInfoSeq->length());
            for (UInt32_t i = 0; i < medInfoSeq->length(); i++) {
                for (UInt32_t j = 0; j < medInfoSeq[i].volumeInfoList.length(); j ++) {
                    for (UInt32_t k = 0; k < medInfoSeq[i].volumeInfoList[j].minorColList.length(); k ++) {

                        log_DBG_m(dbg_NORM, "MediaInfo " << endl
                                << setw(11) << "mediumkey : " << medInfoSeq[i].media.mediumKey << endl
                                << setw(11) << "poolname  : " << medInfoSeq[i].media.mediaPoolName << endl
                                << setw(11) << "barcode   : " << medInfoSeq[i].media.barcode << endl
                                << setw(11) << "medVolnr  : " << medInfoSeq[i].volumeInfoList[j].mediaVol.medVolNr << endl
                                << setw(11) << "medVolId  : " << medInfoSeq[i].volumeInfoList[j].mediaVol.medVolId << endl
                                << setw(11) << "volSize   : " << medInfoSeq[i].volumeInfoList[j].mediaVol.volSize << endl
                                << setw(11) << "volUsed   : " << medInfoSeq[i].volumeInfoList[j].mediaVol.volUsed << endl
                                << setw(11) << "validData : " << medInfoSeq[i].volumeInfoList[j].mediaVol.validData << endl
                                << setw(11) << "totalData : " << medInfoSeq[i].volumeInfoList[j].mediaVol.totalData << endl
                                << setw(11) << "minColId  : " << medInfoSeq[i].volumeInfoList[j].minorColList[k].minColId << endl
                                << setw(11) << "exlusive  : " << medInfoSeq[i].volumeInfoList[j].minorColList[k].flags << endl
                                << setw(11) << "majColId  : " << medInfoSeq[i].volumeInfoList[j].minorColList[k].majColId);

                        MediaData_t entry;
                        entry.mediumKey    = medInfoSeq[i].media.mediumKey;
                        strcpy(entry.barcode, medInfoSeq[i].media.barcode); //check barcode type
                        entry.volumeNr     = medInfoSeq[i].volumeInfoList[j].mediaVol.medVolNr;
                        entry.volSize      = medInfoSeq[i].volumeInfoList[j].mediaVol.volSize;
                        entry.volUsed      = medInfoSeq[i].volumeInfoList[j].mediaVol.volUsed;
                        entry.validData    = medInfoSeq[i].volumeInfoList[j].mediaVol.validData;
                        entry.totalData    = medInfoSeq[i].volumeInfoList[j].mediaVol.totalData;
                        entry.majColId     = medInfoSeq[i].volumeInfoList[j].minorColList[k].majColId;
                        entry.minColId     = medInfoSeq[i].volumeInfoList[j].minorColList[k].minColId;
                        entry.flags        = medInfoSeq[i].volumeInfoList[j].minorColList[k].flags;
                        entry.volumeStatus = medInfoSeq[i].volumeInfoList[j].mediaVol.status;

                        a_mediaData.push_back(entry);

                    }
                }
            }
        );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while getting media info: "
                              << e.GetFriendly()
                              << ")." );
        return e.GetError();
    }
    return uiRet;
}

UInt32_t api_Partition::GetVolumeListMajor ( IN UInt64_t  MajorCollocationId,
OUT vector< MediaData_t > &  aMediaData 
)

Definition at line 816 of file api_partition.cpp.

References MediaDataC::barcode, i_Medium_t::barcode, dbg_NORM, ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, api_Base::m_mif, m_partitionName, MediaDataC::majColId, i_MinorCol_t::majColId, i_MediaInfo_t::media, i_Medium_t::mediaPoolName, i_VolumeInfo_t::mediaVol, MediaDataC::mediumKey, i_Medium_t::mediumKey, i_MediumVol_t::medVolId, i_MediumVol_t::medVolNr, MediaDataC::minColId, i_MinorCol_t::minColId, i_VolumeInfo_t::minorColList, i_MediumVol_t::status, MediaDataC::totalData, i_MediumVol_t::totalData, MediaDataC::validData, i_MediumVol_t::validData, MediaDataC::volSize, i_MediumVol_t::volSize, i_MediaInfo_t::volumeInfoList, MediaDataC::volumeNr, MediaDataC::volumeStatus, MediaDataC::volUsed, and i_MediumVol_t::volUsed.

{
    log_FUNC_m(GetVolumeListMajor);
    UInt32_t uiRet = ie_NO_ERROR;
    i_MediaInfoSeq_t_var medInfoSeq;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)){
                log_DBG_m(dbg_NORM, "Getting media info.. ");

                medInfoSeq = m_hsm->m_mif->GetMediaInfo(CORBA::string_dup(m_partitionName.c_str()));
            }
            else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
            log_DBG_m(dbg_NORM, "Getting media info for a_majColId:" << a_majColId << ". DONE");
            log_DBG_m(dbg_NORM, "Length: " << medInfoSeq->length());

            for (UInt32_t i = 0; i < medInfoSeq->length(); i++) {
                i_MediaInfo_t& mi = medInfoSeq[i];
                log_DBG_m(dbg_NORM, "mi.volumeInfoList.length(): " << mi.volumeInfoList.length());
                for (UInt32_t j = 0; j < mi.volumeInfoList.length(); j ++) {
                    i_VolumeInfo_t& vj = mi.volumeInfoList[j];
                    log_DBG_m(dbg_NORM, "vj.minorColList.length(): " << vj.minorColList.length());
                    for (UInt32_t k = 0; k < vj.minorColList.length(); k ++) {
                        i_MinorCol_t& mk = vj.minorColList[k];
                        log_DBG_m(dbg_NORM, "mk.majColId:" << mk.majColId);
                        if (mk.majColId == a_majColId){
                            log_DBG_m(dbg_NORM, "MediaInfo " << endl
                                    << setw(11) << "mediumkey : " << mi.media.mediumKey << endl
                                    << setw(11) << "poolname  : " << mi.media.mediaPoolName << endl
                                    << setw(11) << "barcode   : " << mi.media.barcode << endl
                                    << setw(11) << "medVolnr  : " << vj.mediaVol.medVolNr << endl
                                    << setw(11) << "validData : " << vj.mediaVol.validData << endl
                                    << setw(11) << "totalData : " << vj.mediaVol.totalData << endl
                                    << setw(11) << "volSize   : " << vj.mediaVol.volSize << endl
                                    << setw(11) << "volUsed   : " << vj.mediaVol.volUsed << endl
                                    << setw(11) << "medVolId  : " << vj.mediaVol.medVolId << endl
                                    << setw(11) << "minColId  : " << mk.minColId << endl
                                    << setw(11) << "majColId  : " << mk.majColId);

                            MediaData_t entry;
                            entry.mediumKey    = mi.media.mediumKey;
                            strcpy(entry.barcode, mi.media.barcode); //check barcode type
                            entry.volumeNr    = vj.mediaVol.medVolNr;
                            entry.validData   = vj.mediaVol.validData;
                            entry.totalData   = vj.mediaVol.totalData;
                            entry.volSize     = vj.mediaVol.volSize;
                            entry.volUsed     = vj.mediaVol.volUsed;
                            entry.majColId    = mk.majColId;
                            entry.minColId    = mk.minColId;
                            entry.volumeStatus = vj.mediaVol.status;

                            a_mediaData.push_back(entry);
                        }
                    }
                }
            }
        );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while getting media info: "
                              << e.GetFriendly()
                              << ")." );
        return e.GetError();
    }
    return uiRet;
}

UInt32_t api_Partition::GetVolumeListMinor ( IN UInt64_t  MinorCollocationId,
OUT vector< MediaData_t > &  aMediaData 
)

Definition at line 746 of file api_partition.cpp.

References MediaDataC::barcode, i_Medium_t::barcode, dbg_NORM, ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, api_Base::m_mif, m_partitionName, MediaDataC::majColId, i_MinorCol_t::majColId, i_MediaInfo_t::media, i_Medium_t::mediaPoolName, i_VolumeInfo_t::mediaVol, MediaDataC::mediumKey, i_Medium_t::mediumKey, i_MediumVol_t::medVolId, i_MediumVol_t::medVolNr, MediaDataC::minColId, i_MinorCol_t::minColId, i_VolumeInfo_t::minorColList, i_MediumVol_t::status, MediaDataC::totalData, i_MediumVol_t::totalData, MediaDataC::validData, i_MediumVol_t::validData, MediaDataC::volSize, i_MediumVol_t::volSize, i_MediaInfo_t::volumeInfoList, MediaDataC::volumeNr, MediaDataC::volumeStatus, MediaDataC::volUsed, and i_MediumVol_t::volUsed.

{
    log_FUNC_m(GetVolumeListMinor);
    UInt32_t uiRet = ie_NO_ERROR;
    i_MediaInfoSeq_t_var medInfoSeq;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)){
                log_DBG_m(dbg_NORM, "Getting media info.. ");

                medInfoSeq = m_hsm->m_mif->GetMediaInfo(CORBA::string_dup(m_partitionName.c_str()));
            }
            else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
            log_DBG_m(dbg_NORM, "Getting media info.. DONE");
            log_DBG_m(dbg_NORM, "Length: " << medInfoSeq->length());
            for (UInt32_t i = 0; i < medInfoSeq->length(); i++) {
                i_MediaInfo_t& mi = medInfoSeq[i];
                for (UInt32_t j = 0; j < mi.volumeInfoList.length(); j ++) {
                    i_VolumeInfo_t& vj = mi.volumeInfoList[j];
                    for (UInt32_t k = 0; k < vj.minorColList.length(); k ++) {
                        i_MinorCol_t& mk = vj.minorColList[k];
                        if (mk.minColId == a_minColId){


                            log_DBG_m(dbg_NORM, "MediaInfo " << endl
                                    << setw(11) << "mediumkey : " << mi.media.mediumKey << endl
                                    << setw(11) << "poolname  : " << mi.media.mediaPoolName << endl
                                    << setw(11) << "barcode   : " << mi.media.barcode << endl
                                    << setw(11) << "medVolnr  : " << vj.mediaVol.medVolNr << endl
                                    << setw(11) << "validData : " << vj.mediaVol.validData << endl
                                    << setw(11) << "totalData : " << vj.mediaVol.totalData << endl
                                    << setw(11) << "volSize   : " << vj.mediaVol.volSize << endl
                                    << setw(11) << "volUsed   : " << vj.mediaVol.volUsed << endl
                                    << setw(11) << "medVolId  : " << vj.mediaVol.medVolId << endl
                                    << setw(11) << "minColId  : " << mk.minColId << endl
                                    << setw(11) << "majColId  : " << mk.majColId);

                            MediaData_t entry;
                            entry.mediumKey    = mi.media.mediumKey;
                            strcpy(entry.barcode, mi.media.barcode); //check barcode type
                            entry.volumeNr    = vj.mediaVol.medVolNr;
                            entry.validData   = vj.mediaVol.validData;
                            entry.totalData   = vj.mediaVol.totalData;
                            entry.volSize     = vj.mediaVol.volSize;
                            entry.volUsed     = vj.mediaVol.volUsed;
                            entry.majColId    = mk.majColId;
                            entry.minColId    = mk.minColId;
                            entry.volumeStatus = vj.mediaVol.status;

                            a_mediaData.push_back(entry);
                        }
                    }
                }
            }
        );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while getting media info: "
                              << e.GetFriendly()
                              << ")." );
        return e.GetError();
    }
    return uiRet;
}

UInt32_t api_Partition::JobStatus ( IN vector< UInt64_t > &  a_jobIdList,
OUT vector< UInt64_t > &  a_statusList 
)

api_Partition::JobStatus

Definition at line 513 of file api_partition.cpp.

References dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_iPM, and m_status.

{
    log_FUNC_m(JobStatus);
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_iPM)){
                for (UInt32_t i(0); i < a_jobIdList.size(); i++){
                    log_DBG_m(dbg_NORM, "job: " << a_jobIdList[i]);
                    UInt64_t jobStatus = m_iPM->GetJobStatus(a_jobIdList[i]);
                    log_DBG_m(dbg_NORM, "job: " << a_jobIdList[i] <<
                                        "status: " << jobStatus );
                    a_statusList.push_back(jobStatus);
                }
            } else {
                log_WriteErrorEvent( "Partition Manager is in not available."
                            << hex << m_status );
                return ie_NOMOUNT;
            }
        );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while getting job status: "
             << e.GetFriendly()
             << ")." );
        return e.GetError();
    }

    return ie_NO_ERROR;
}

Here is the call graph for this function:

string api_Partition::LocalPath2HSM ( IN const string &  a_localPath  ) 

api_Partition::LocalPath2HSM

Definition at line 281 of file api_partition.cpp.

References cmn_StrLowerCase(), dbg_NORM, cmn_Path::GetAbsolutePathName(), log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, m_sharedDir, and api_Base::SetLastError().

Referenced by GetFileLocations(), GetFileStatus(), and MigrateFile().

                                                                  {
    log_FUNC_m(LocalPath2HSM);

    log_DBG_m(dbg_NORM, "a_localPath: " << a_localPath << endl);
    log_DBG_m(dbg_NORM, "Local mount point: " << m_localMountPoint << endl);

    //for case insensitive compare only
    string localPath(a_localPath);
    cmn_StrLowerCase(localPath);
    string localMountPoint(m_localMountPoint);
    cmn_StrLowerCase(localMountPoint);

    if ( localPath.compare(0, localMountPoint.size(), localMountPoint) ) {
                log_WriteErrorEvent( "Provided localpath " << localPath
                    << " is not on g_referencePath " << localMountPoint
                                     << " provided at partition instantiation." );
        m_hsm->SetLastError(ie_INVALID_ARG);
        return string("");
    }
    else {
        log_DBG_m(dbg_NORM, "HSM shared dir: " << m_sharedDir );
        return string(m_sharedDir.GetAbsolutePathName()) + a_localPath.substr(m_localMountPoint.size());
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt32_t api_Partition::MigrateFile ( IN const string &  a_localPath,
IN UInt64_t  a_majColId,
IN UInt64_t  a_minColId,
IN UInt32_t  a_flags,
OUT vector< UInt64_t > &  a_jobIdList 
)

api_Partition::MigrateFile with collocation

Definition at line 310 of file api_partition.cpp.

References dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, LocalPath2HSM(), log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_iHSM, and m_status.

{
    log_FUNC_m(MigrateFile);

    string hsmPath = LocalPath2HSM(a_path);

    if (hsmPath == "") {
        return ie_INVALID_ARG;
    }

    log_DBG_m(dbg_NORM, "MigrateFile :" << endl
                     << hsmPath << ", " << endl
                     << "flags= " << a_flags << ", " << endl
                     << "MajCollId= " << a_majorColId << ", " << endl
                     << "MinCollId= " << a_minorColId);

    i_JobIDList_t_var jobs;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_iHSM)){
                m_iHSM->MigrateByAPI(a_flags,
                                     CORBA::string_dup(hsmPath.c_str()),
                                     a_majorColId,
                                     a_minorColId,
                                     jobs);

            } else {
                log_WriteErrorEvent( "HSM is in not available."
                    << hex << m_status );
                return ie_NOMOUNT;
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while migrating files: "
             << e.GetFriendly()
             << ")." );
        return e.GetError();
    }

    log_DBG_m(dbg_NORM, "job->length() " << jobs->length());
    for (UInt32_t i(0); i < jobs->length(); i++) {

        log_DBG_m(dbg_NORM, "job: " << jobs[i]);
        a_jobIdList.push_back(jobs[i]);
    }
    return ie_NO_ERROR;
}

Here is the call graph for this function:

UInt32_t api_Partition::Reorg ( const char *  a_medBarcode,
UInt32_t  a_volNum,
UInt64_t a_jobID 
)

Definition at line 922 of file api_partition.cpp.

References dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, and api_Base::m_mif.

{
    log_FUNC_m(Reorg);
    UInt32_t uiRet = ie_NO_ERROR;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)){
                log_DBG_m(dbg_NORM, "Reorg. a_medBarcode: " << a_medBarcode <<
                                    ", a_volNum:" << a_volNum);

                i_VolNumList_t volList;

                if (a_volNum > 0){
                    volList.length(1);
                    volList[0] = a_volNum;
                }
                a_jobID = m_hsm->m_mif->Reorg(
                                        CORBA::string_dup(a_medBarcode),
                                        volList,
                                        i_UIMessageServer::_nil());

            } else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error on Reorg: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }
    return uiRet;
}

Here is the call graph for this function:

UInt32_t api_Partition::ReorganizeMedium ( const char *  a_medBarcode,
IN UInt32_t  a_volNum 
)
UInt32_t api_Partition::ReorgByColId ( UInt64_t  a_majColId,
UInt64_t  a_minColId,
vector< UInt64_t > &  a_jobIdList 
)

Definition at line 958 of file api_partition.cpp.

References dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, and m_iPM.

{
    log_FUNC_m(ReorgByColId);
    UInt32_t uiRet = ie_NO_ERROR;
    
    log_DBG_m(dbg_NORM, "ReorgByColId. a_majColId: " << a_majColId <<
                                     ", a_minColId:" << a_minColId);

    i_JobIDList_t_var jobs;
    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_iPM)){
                jobs = m_iPM->ReorgByColId(a_majColId, a_minColId);
            }
            else {
                log_WriteErrorEvent( "PM is in not available.");
                return ie_NOMOUNT;
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error on Reorg: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }
    
    log_DBG_m(dbg_NORM, "job->length() " << jobs->length());    
    for (UInt32_t i(0); i < jobs->length(); i++) {

        log_DBG_m(dbg_NORM, "job: " << jobs[i]);
        a_jobIdList.push_back(jobs[i]);
    }
    return ie_NO_ERROR;
}

Here is the call graph for this function:

UInt32_t api_Partition::ReorgScan ( i_Time_t  a_date,
UInt32_t  a_numOfGenerations,
UInt64_t a_jobID 
)

Definition at line 889 of file api_partition.cpp.

References dbg_NORM, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, api_Base::m_mif, and m_partitionName.

{
    log_FUNC_m(ReorgScan);
    UInt32_t uiRet = ie_NO_ERROR;

    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)){
                log_DBG_m(dbg_NORM, "ReorgScan. Date: " << a_date <<
                                    ", a_numOfGenerations:" << a_numOfGenerations);

                a_jobID = m_hsm->m_mif->ReorgScan(
                                        CORBA::string_dup(m_partitionName.c_str()),
                                        a_date,
                                        a_numOfGenerations,
                                        i_UIMessageServer::_nil());

            } else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error on Reorg scan: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }
    return uiRet;
}

Here is the call graph for this function:

ivd_PartitionStatus_e api_Partition::SetReferences (  ) 

Definition at line 46 of file api_partition.cpp.

References dbg_NORM, g_cmn, ivd_BaseException::GetFriendly(), ie_PRECONDITION, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, m_iHSM, m_iPM, api_Base::m_mif, m_mountPoint, m_partition, m_partitionName, cmn_SysInfo::m_serverHost, cmn_Path::RemoveTrailingPathSeparator(), ipc_Corba::ResolvePMByPartID(), rmdb_PARTITION_DISABLED_d, rmdb_PARTITION_RECOVERY_MODE_d, cmn_Global::si, and i_Partition_t::status.

                                                  {
    log_FUNC_m(CheckStatus);

    try {
        //get rmdb entry
        ipc_EXEC_m(
            m_partition =  *(m_hsm->m_mif->GetPartition(m_partitionName.c_str()));
        );

        if ( m_partition.status == rmdb_PARTITION_DISABLED_d ){
            log_WriteErrorEvent( "Partition is disabled."
                                << hex << m_partition.status );
            return ps_DISABLED;
        }

        if ( m_partition.status == rmdb_PARTITION_RECOVERY_MODE_d ){
            log_WriteErrorEvent( "Partition is in recovery mode."
                 << hex << m_partition.status );
            return ps_RECOVERYMODE;
        }

        ipc_EXEC_m(
            log_DBG_m(dbg_NORM, "Getting PM reference...");
            CORBA::Object_var obj = ipc_Corba::ResolvePMByPartID(
                g_cmn.si.m_serverHost, m_partitionName, false);

            m_iPM = i_PartitionManager::_narrow(obj);

            log_DBG_m(dbg_NORM, "Got PM reference.");

            if (!m_iPM->RecallOnlyMode()) {
                throw ivd_Error(ie_PRECONDITION, "Partition not in recall only mode");
            }

            log_DBG_m(dbg_NORM, "Getting HSM reference...");
            m_iHSM = m_iPM->GetHSM();

            log_DBG_m(dbg_NORM, "Got HSM.");

            if (CORBA::is_nil(m_iHSM)) {
                log_DBG_m(dbg_NORM, "HSM is_nil...");

                return ps_ERROR;
            }

            log_DBG_m(dbg_NORM, "Got HSM reference.");
            i_HsmInfo_t_var hsmInfo;
            m_iHSM->GetInfo(hsmInfo);

            m_mountPoint = hsmInfo->mountPoint;
            m_mountPoint.RemoveTrailingPathSeparator();

            return ps_MOUNTED;
        );
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( e.GetFriendly());
        throw;
    }
    catch (std::exception &se) {
        log_WriteErrorEvent( "std::exception: " << se.what());
        throw;
    }
    catch (...) {
        log_WriteErrorEvent( "Unknown exception!" );
        throw;
    }

}

Here is the call graph for this function:

UInt32_t api_Partition::UpdateMajColSize ( IN UInt64_t  a_majColId,
IN UInt32_t  a_majColSize 
)

Definition at line 401 of file api_partition.cpp.

References dbg_NORM, i_MajorCol_t::flags, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, log_WriteErrorEvent, m_hsm, m_iPM, api_Base::m_mif, i_MajorCol_t::majColId, and i_MajorCol_t::majColSize.

{
    log_FUNC_m(UpdateMajColSize);
    UInt32_t uiRet = ie_NO_ERROR;

    i_MajorCol_t majorCol;

    majorCol.majColId = a_majColId;
    majorCol.majColSize = a_majColSize;
    majorCol.flags = 0;

    try {
        ipc_EXEC_m(
            if (!CORBA::is_nil(m_hsm->m_mif)) {
                log_DBG_m(dbg_NORM, "Updating collocation group size for id: " << a_majColId);
                m_iPM->UpdateMajorCol(majorCol);
            } else {
                log_WriteErrorEvent( "MIF is in not available.");
                return ie_NOMOUNT;
            }
        )
    }
    catch (ivd_Exception &e) {
        log_WriteErrorEvent( "Error while updating collocation group size: "
            << e.GetFriendly()
            << ")." );
        return e.GetError();
    }
    return uiRet;
}

Here is the call graph for this function:


Member Data Documentation

i_HSM_var api_Partition::m_iHSM [private]

Definition at line 123 of file api_partition.h.

Referenced by GetPartitionStatus(), MigrateFile(), and SetReferences().

i_PartitionManager_var api_Partition::m_iPM [private]

Definition at line 116 of file api_partition.h.

Definition at line 114 of file api_partition.h.

Referenced by SetReferences().

Definition at line 121 of file api_partition.h.

Referenced by CreateMajorCol(), and SetReferences().

Definition at line 112 of file api_partition.h.

Referenced by GetPathSeparator().

Definition at line 115 of file api_partition.h.

Referenced by LocalPath2HSM().

Definition at line 117 of file api_partition.h.

Referenced by JobStatus(), and MigrateFile().


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