Classes | Functions

IVD Library Agent
[Agents]

IVD LA communicates with tape library devices. More...

Collaboration diagram for IVD Library Agent:

Classes

class  i_LibraryAgentSCSI_i
class  la_SCSILibrary
struct  la_ManualDrive
class  i_LibraryAgentManual_i

Functions

void SendEmail (string a_addr, string a_lib, string a_host, string a_what, string a_drive, string a_bc, string a_slot)
void SendMsg (string a_addr, string a_lib, string a_host, string a_what, string a_drive, string a_bc, string a_slot)

Detailed Description

IVD LA communicates with tape library devices.

See also:
SCSI Library

Function Documentation

void SendEmail ( string  a_addr,
string  a_lib,
string  a_host,
string  a_what,
string  a_drive,
string  a_bc,
string  a_slot 
)

Definition at line 46 of file la_manual_LNX.cpp.

References cmn_ExecCommand(), evt_ERROR, ivd_BaseException::GetFriendly(), log_FUNC_m, log_WriteEvent(), SendEmail(), and SendMsg().

Referenced by SendEmail().

{
    log_FUNC_m(SendEmail);

    vector<string> argVec;
    string execThis = "/bin/sh";

    argVec.push_back("-c");

    ostringstream sstr;
    sstr << "echo \"IVD " << a_lib << "@" << a_host << ": drive " << a_drive 
         << " - " << a_what << " medium " << a_bc
         << "\n\nUse /opt/ivd/sbin/tools/ivd_la to confirm.\" | /bin/mail -s " 
         << "\"IVD " << a_lib << "@" << a_host << ": drive " << a_drive 
         << " - " << a_what << " medium " << a_bc
         << "\" " << a_addr;
    argVec.push_back(sstr.str());

    try{
        cmn_ExecCommand(execThis, argVec);
    } 
    catch (ivd_Exception &ie){
        ostringstream sstr;
        sstr << "Cannot execute: " << execThis 
             << " (" << ie.GetFriendly() << ").";
        log_WriteEvent(evt_ERROR, sstr.str()); 
        throw;
    } 
    catch (...){
        ostringstream sstr;
        sstr << "Cannot execute: " << execThis << ".";
        log_WriteEvent(evt_ERROR, sstr.str()); 
        throw;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SendMsg ( string  a_addr,
string  a_lib,
string  a_host,
string  a_what,
string  a_drive,
string  a_bc,
string  a_slot 
)

Definition at line 85 of file la_manual_LNX.cpp.

References cmn_ExecCommand(), evt_ERROR, ivd_BaseException::GetFriendly(), log_FUNC_m, log_WriteEvent(), and SendMsg().

Referenced by SendEmail(), and SendMsg().

{
    log_FUNC_m(SendMsg);

    vector<string> argVec;
    string execThis = "/bin/sh";

    argVec.push_back("-c");

    ostringstream sstr;
    sstr << "echo \"IVD " << a_lib << "@" << a_host << ": drive " << a_drive 
         << " - " << a_what << " medium " << a_bc
         << "\n\nUse /opt/ivd/sbin/tools/ivd_la to confirm.\"";
    if (a_addr.empty()) {
        sstr << " | /usr/bin/wall";
    }
    else {
        sstr << " | /usr/bin/write " << a_addr;
    }
    argVec.push_back(sstr.str());

    try{
        cmn_ExecCommand(execThis, argVec);
    } 
    catch (ivd_Exception &ie){
        ostringstream sstr;
        sstr << "Cannot execute: " << execThis 
             << " (" << ie.GetFriendly() << ").";
        log_WriteEvent(evt_ERROR, sstr.str()); 
        throw;
    } 
    catch (...){
        ostringstream sstr;
        sstr << "Cannot execute: " << execThis << ".";
        log_WriteEvent(evt_ERROR, sstr.str()); 
        throw;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: