Public Member Functions | Public Attributes | Protected Member Functions

i_RecreatedIVDFSJob_i Class Reference
[Partition Manager]

#include <i_recreateivdfsjob_impl.h>

Inheritance diagram for i_RecreatedIVDFSJob_i:
Inheritance graph
[legend]
Collaboration diagram for i_RecreatedIVDFSJob_i:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 i_RecreatedIVDFSJob_i (pm_JobMgr &a_jobMgr, i_PartitionManager_i &a_iPM, i_UIMessageServer_ptr a_uims)
virtual ~i_RecreatedIVDFSJob_i ()
void AbortJob ()

Public Attributes

 log_CLASSID_m

Protected Member Functions

void Execute ()

Detailed Description

Definition at line 35 of file i_recreateivdfsjob_impl.h.


Constructor & Destructor Documentation

i_RecreatedIVDFSJob_i::i_RecreatedIVDFSJob_i ( pm_JobMgr a_jobMgr,
i_PartitionManager_i a_iPM,
i_UIMessageServer_ptr  a_uims 
)

Definition at line 53 of file i_recreateivdfsjob_impl.cpp.

References log_FUNC_m.

                      : i_ThreadJob_i(a_jobMgr, a_iPM, a_uims)
{
    log_FUNC_m(i_RecreatedIVDFSJob_i);
}

i_RecreatedIVDFSJob_i::~i_RecreatedIVDFSJob_i (  )  [virtual]

Definition at line 62 of file i_recreateivdfsjob_impl.cpp.

References log_FUNC_m.


Member Function Documentation

void i_RecreatedIVDFSJob_i::AbortJob (  )  [virtual]

Reimplemented from i_Job_i.

Definition at line 67 of file i_recreateivdfsjob_impl.cpp.

References i_FSC_i::IVDFSRecoveryAbort(), log_FUNC_m, i_PartitionManager_i::m_iFSCi, and i_ThreadJob_i::m_iPM.

Here is the call graph for this function:

void i_RecreatedIVDFSJob_i::Execute (  )  [protected, virtual]

Implements i_ThreadJob_i.

Definition at line 73 of file i_recreateivdfsjob_impl.cpp.

References cfg_PMCfg::clients, dbg_DETAIL, dbg_NORM, ui_MsgWriter::DisplayError(), ui_MsgWriter::DisplayMessage(), ui_MsgWriter::DisplayWarning(), evt_ERROR, evt_WARNING, ivd_BaseException::GetFriendly(), i_PartitionManager_i::GetName(), i_IVD, ie_PRECONDITION, ipc_EXEC_m, ivd_Error, ivd_Sleep, i_FSC_i::IVDFSRecovery(), log_DBG_m, log_FUNC_m, log_WriteEvent(), i_PartitionManager_i::m_config, i_PartitionManager_i::m_iFSCi, i_PartitionManager_i::m_iHSM, i_ThreadJob_i::m_iPM, i_Job_i::m_status, i_ThreadJob_i::m_uiMsgWriter, i_PartitionManager_i::RecoveryOfIVDFSClear(), i_PartitionManager_i::RecoveryOfIVDFSSet(), and ipc_Corba::ResolveSvc().

                                   {
    log_FUNC_m(Execute);
    m_status = i_FAILED;
    if (!m_iPM.RecoveryOfIVDFSSet()) {
        string sstr("HSMFS recovery already in progress.");
        m_uiMsgWriter.DisplayWarning(sstr);
        log_WriteEvent(evt_WARNING, sstr);
        return;
    }

    // HSM must be mounted by recovery job
    if ( !CORBA::is_nil(m_iPM.m_iHSM)) {
        string sstr("HSM File System mounted - can't start HSMFS recovery.");
        m_uiMsgWriter.DisplayError(sstr);
        log_WriteEvent(evt_ERROR, sstr);
        m_iPM.RecoveryOfIVDFSClear();
        return;
    }

    string clientHostName = m_iPM.m_config.clients[0].name;
    string fileSystemID   = m_iPM.m_config.clients[0].fileSystemId;

    i_Service_var svc;

    try {
        CORBA::Object_var obj = ipc_Corba::ResolveSvc(clientHostName);
        svc = i_Service::_narrow(obj);
    }
    catch (...) {
        string sstr("Cannot resolve client " + clientHostName + ". Probably disconnected.");
        m_uiMsgWriter.DisplayError(sstr);
        log_WriteEvent(evt_ERROR, sstr);
        m_iPM.RecoveryOfIVDFSClear();
        return;
    }

    log_DBG_m(dbg_DETAIL, "PM: m_svc referenced as: " << svc << endl);

    i_StringList_t argSequence;
    argSequence.length(3);
    argSequence[0] = CORBA::string_dup("--mount-recovery");

    // Pass empty argument for mount point. ivd-svc will define it.
    cmn_Path mountPoint("");

    argSequence[1] = CORBA::string_dup(mountPoint.c_str());

    argSequence[2] = CORBA::string_dup(fileSystemID.c_str());

    log_DBG_m(dbg_DETAIL, " Recovery on host " << clientHostName
                       << " mount point " << mountPoint
                       << " fileSystem ID " << fileSystemID);
    ipc_EXEC_m(
        svc->Execute(i_IVD, argSequence);
    );
    
    // wait for 120 seconds for HSM to register with new CORBA reference
    const int maxWait = 120; // two minutes
    for (int count=0; count < maxWait && CORBA::is_nil(m_iPM.m_iHSM); ++count) {
        log_DBG_m(dbg_DETAIL, "RecoverHSMFS: waiting for HSM to register...");
        ivd_Sleep(1);
    }

    if (CORBA::is_nil(m_iPM.m_iHSM)) {
        ostringstream sstr;
        sstr << "HSM did not start in " << maxWait 
             << " seconds. HSMFS failed to mount to temporary recovery location.";
        m_uiMsgWriter.DisplayError(sstr.str());
        log_WriteEvent(evt_ERROR, sstr.str());

        m_iPM.RecoveryOfIVDFSClear();
        throw ivd_Error(ie_PRECONDITION, sstr.str());
    }
    else {
        //mounted
        string msg = "HSMFS successfully mounted to temporary recovery location.";
        m_uiMsgWriter.DisplayMessage(msg);
    }      
    
    try {
        for (int count=0; count < maxWait && !m_iPM.m_iHSM->IsHSMReady(); ++count) {
            log_DBG_m(dbg_DETAIL, "RecoverHSMFS: waiting for HSM to become ready...");
            ivd_Sleep(1);
        }

        if (!m_iPM.m_iHSM->IsHSMReady()) {
            ostringstream sstr;
            sstr << "HSM is not ready in " << maxWait << " seconds. Cannot start recovery.";
            m_uiMsgWriter.DisplayError(sstr.str());
            log_WriteEvent(evt_ERROR, sstr.str());
            goto end;
        }

        ipc_EXEC_m(
            m_iPM.m_iFSCi->IVDFSRecovery(
                                m_iPM.GetName(), 
                                i_HSM::_duplicate(m_iPM.m_iHSM), 
                                m_uiMsgWriter);
        );
    }
    catch (ivd_Exception &e) {
        string msg("HSMFS recovery failed: " + e.GetFriendly());
        m_uiMsgWriter.DisplayError(msg);
        log_WriteEvent(evt_ERROR, msg);
    }
    catch (...) {
        string msg("HSMFS recovery failed. See error.log");
        m_uiMsgWriter.DisplayError(msg);
        log_WriteEvent(evt_ERROR, msg);
    }
end:
    argSequence[0] = CORBA::string_dup("--umount-recovery");
    ipc_EXEC_m(
        svc->Execute(i_IVD, argSequence);
    );

    m_iPM.RecoveryOfIVDFSClear();
    m_status = i_SUCCEDED;

    log_DBG_m(dbg_NORM, "END HSMFSRecovery");
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from i_ThreadJob_i.

Definition at line 44 of file i_recreateivdfsjob_impl.h.


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