i_LibraryAgentSCSI_i Class Reference
[IVD Library Agent]

#include <i_la-s_impl.h>

Inheritance diagram for i_LibraryAgentSCSI_i:

Inheritance graph
[legend]
Collaboration diagram for i_LibraryAgentSCSI_i:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 30 of file i_la-s_impl.h.


Public Member Functions

 i_LibraryAgentSCSI_i (string a_libName)
void Inventory (CORBA::Boolean a_force)
void Load (const char *a_slot, const char *a_drive, const char *a_barcode, i_JobID_t a_jobID)
void Unload (const char *a_drive, const char *a_slot, const char *a_barcode, i_JobID_t a_jobID)
void ConfirmMountRequest (const char *a_drive, CORBA::Boolean a_ok)
void Reconfigure (const i_Library_t &a_libCfg)
void Remove ()

Private Member Functions

virtual ~i_LibraryAgentSCSI_i ()
vector< la_SCSILibrary::DriveInfoReadDriveInfo ()
void UpdateIDs (i_Library_t a_lib)

Private Attributes

 log_CLASSID_m
la_SCSILibrary m_scsiLib
string m_libName
cmn_Mutex m_lib_x
cmn_Mutex m_serialUnload_x
bool m_serialUnload
bool m_active
i_ResourceManager_var m_iRM

Friends

class la_SCSILibrary

Constructor & Destructor Documentation

i_LibraryAgentSCSI_i::i_LibraryAgentSCSI_i ( string  a_libName  ) 

Definition at line 58 of file i_la-s_impl.cpp.

References cmn_GetEnvVariable(), cmn_StrUpperCase(), dbg_LOW, evt_ERROR, ipc_EXEC_m, la_serialUnload_c(), log_DBG_m, log_ERR_m, log_FUNC_A_m, log_WriteEvent(), m_iRM, m_serialUnload, Reconfigure(), and ipc_Corba::ResolveRM().

00059   : m_libName (a_libName),
00060     m_active(false) {
00061 
00062     log_FUNC_A_m(i_LibraryAgentSCSI_i, "libName: " << a_libName);
00063 
00064     ipc_EXEC_m(
00065         CORBA::Object_var obj = ipc_Corba::ResolveRM();
00066         m_iRM = i_ResourceManager::_narrow(obj);
00067     );
00068 
00069     i_Library_t_var lib;
00070     try {
00071         ipc_EXEC_m(
00072             lib = m_iRM->SelectLibrary( CORBA::string_dup(a_libName.c_str()) );
00073         );
00074     }
00075     catch (...) {
00076         log_WriteEvent(evt_ERROR,
00077             "Can't get library control device for." + a_libName);
00078 
00079         log_ERR_m(
00080             "Can't get library's control device for " <<
00081             a_libName);
00082 
00083         throw;
00084     };
00085 
00086     string serial = cmn_GetEnvVariable(la_serialUnload_c);
00087     if (serial.length() > 0) {
00088         log_DBG_m(dbg_LOW, la_serialUnload_c << " = " << serial << ".");
00089         cmn_StrUpperCase(serial);
00090 
00091         if (serial.compare("TRUE") == 0 || serial.compare("YES") == 0) {
00092             log_DBG_m(dbg_LOW, "Unloads will be serialised.");
00093             m_serialUnload = true;
00094         }
00095     }
00096 
00097     log_DBG_m(dbg_LOW, endl <<
00098         "** Starting library agent **" << endl <<
00099         " - Name      : " << a_libName << endl );
00100     Reconfigure(lib);
00101 }

Here is the call graph for this function:

i_LibraryAgentSCSI_i::~i_LibraryAgentSCSI_i (  )  [private, virtual]

Definition at line 103 of file i_la-s_impl.cpp.

References la_SCSILibrary::Close(), dbg_LOW, ivd_Sleep, log_DBG_m, log_FUNC_m, m_active, m_scsiLib, and ipc_Corba::Shutdown().

00103                                             {
00104     log_FUNC_m(~i_LibraryAgentSCSI_i);
00105 
00106     while (m_active) {
00107         log_DBG_m(dbg_LOW,
00108             "Library Agent performing an action. Waiting.");
00109         ivd_Sleep(1);
00110     };
00111 
00112     m_scsiLib.Close();
00113 
00114     ipc_Corba::Shutdown();
00115 }

Here is the call graph for this function:


Member Function Documentation

void i_LibraryAgentSCSI_i::Inventory ( CORBA::Boolean  a_force  ) 

Definition at line 212 of file i_la-s_impl.cpp.

References cmn_Num2Str(), dbg_DETAIL, evt_ERROR, ivd_BaseException::GetFriendly(), la_SCSILibrary::HasBarcodeReader(), i_UpdateList_t, ie_FATAL_ERROR, la_SCSILibrary::Inventory(), ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_A_m, log_WriteEvent(), m_active, m_iRM, m_lib_x, m_libName, and m_scsiLib.

Referenced by Reconfigure().

00212                                                          {
00213 
00214     log_FUNC_A_m(Inventory, "force: " << (a_force? "Yes" : "No"));
00215 
00216     if (!m_scsiLib.HasBarcodeReader()) {
00217         log_WriteEvent("Inventory skipped: no barcode reader");
00218 
00219         return;
00220     }
00221 
00222     cmn_MutexLock l(m_lib_x);
00223     la_ActiveMark a(m_active);
00224 
00225     try {
00226 
00227         try {
00228             vector<data_ElementStatus::ElemStatus_t> elementStatus;
00229 
00230             m_scsiLib.Inventory(a_force, elementStatus);
00231 
00232             log_DBG_m(dbg_DETAIL,
00233                     "Got " << elementStatus.size() << " elements from library.");
00234 
00235             i_UpdateList_t libUpdate;
00236 
00237             libUpdate.length(elementStatus.size());
00238 
00239             for (UInt32_t i = 0; i < elementStatus.size(); i++) {
00240                 libUpdate[i].type       = elementStatus[i].type;
00241                 libUpdate[i].slot       =
00242                     CORBA::string_dup(cmn_Num2Str(elementStatus[i].slot).c_str());
00243                 libUpdate[i].isFull     = elementStatus[i].full;
00244                 libUpdate[i].barcode    = CORBA::string_dup(elementStatus[i].barcode);
00245                 libUpdate[i].barcode2   = CORBA::string_dup(elementStatus[i].barcode2);
00246             }
00247 
00248             log_DBG_m(dbg_DETAIL, "About to update RMDB");
00249 
00250             ipc_EXEC_m(
00251                 m_iRM->InventoryUpdate(
00252                     CORBA::string_dup(m_libName.c_str()),
00253                     libUpdate );
00254             );
00255 
00256             ostringstream sstr;
00257             sstr
00258                 << "Inventory "
00259                 << (a_force? "with barcode rescan." : "");
00260 
00261             log_WriteEvent(sstr.str());
00262         }
00263         catch (ivd_Exception &ie) {
00264             ostringstream sstr;
00265             sstr << "Inventory FAILED (" << ie.GetFriendly() << ")";
00266             log_WriteEvent(evt_ERROR, sstr.str());
00267             throw;
00268         }
00269         catch (std::exception &se) {
00270             ostringstream sstr;
00271             sstr << "Inventory FAILED (" << se.what() << ")";
00272             log_WriteEvent(evt_ERROR, sstr.str());
00273             throw;
00274         }
00275         catch (...) {
00276             log_WriteEvent(evt_ERROR, "Inventory FAILED");
00277 
00278             throw ivd_Error(
00279                 ie_FATAL_ERROR, "Unknown exception performing Inventory.");
00280         }
00281     } ipc_CATCH_IVD_THROW_CORBA_m;
00282 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_LibraryAgentSCSI_i::Load ( const char *  a_slot,
const char *  a_drive,
const char *  a_barcode,
i_JobID_t  a_jobID 
)

Definition at line 284 of file i_la-s_impl.cpp.

References evt_ERROR, ivd_BaseException::GetFriendly(), ie_FATAL_ERROR, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, la_SCSILibrary::Load(), log_FUNC_A_m, log_WriteEvent(), m_active, m_iRM, m_lib_x, m_libName, and m_scsiLib.

00288                        {
00289 
00290     log_FUNC_A_m(Load,
00291         "slot: " << a_slot <<
00292         " drive: " << a_drive <<
00293         " barcode: " << a_barcode <<
00294         " job: " << a_jobID);
00295 
00296     cmn_MutexLock l(m_lib_x);
00297     la_ActiveMark a(m_active);
00298 
00299     try {
00300         try {
00301             UInt16_t slot   = atoi(a_slot);
00302             UInt16_t drive  = atoi(a_drive);
00303             string barcode  = string(a_barcode);
00304 
00305             m_scsiLib.Load(slot, drive, barcode);
00306 
00307             ipc_EXEC_m(
00308                 m_iRM->MediumLoaded(
00309                     CORBA::string_dup(m_libName.c_str()),
00310                     CORBA::string_dup(a_barcode),
00311                     CORBA::string_dup(a_drive) );
00312             );
00313 
00314             ostringstream sstr;
00315             sstr << "Move: D=" << a_drive << " <- S=" << a_slot;
00316             log_WriteEvent(sstr.str(), "", a_jobID, a_barcode);
00317         }
00318         catch (ivd_Exception &ie) {
00319             ostringstream sstr;
00320             sstr
00321                 << "Move: D=" << a_drive << " <- S=" << a_slot << " FAILED ("
00322                 << ie.GetFriendly() << ")";
00323             log_WriteEvent(evt_ERROR, sstr.str(), "", a_jobID, a_barcode);
00324 
00325             throw;
00326         }
00327         catch (...) {
00328             ostringstream sstr;
00329             sstr << "Move: D=" << a_drive << " <- S=" << a_slot << " FAILED";
00330             log_WriteEvent(evt_ERROR, sstr.str(), "", a_jobID, a_barcode);
00331 
00332             throw ivd_Error(
00333                 ie_FATAL_ERROR, "Unknown exception performing Load.");
00334         }
00335     } ipc_CATCH_IVD_THROW_CORBA_m;
00336 }

Here is the call graph for this function:

void i_LibraryAgentSCSI_i::Unload ( const char *  a_drive,
const char *  a_slot,
const char *  a_barcode,
i_JobID_t  a_jobID 
)

Definition at line 338 of file i_la-s_impl.cpp.

References dbg_NORM, evt_ERROR, ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ie_FATAL_ERROR, ie_LA_UNCONFIGURED, ipc_CATCH_IVD_THROW_CORBA_m, ipc_EXEC_m, ivd_Error, log_DBG_m, log_FUNC_A_m, log_WriteEvent(), m_active, m_iRM, m_lib_x, m_libName, m_scsiLib, m_serialUnload, m_serialUnload_x, la_SCSILibrary::MustRequestEject(), ReadDriveInfo(), rmdb_MEDIUM_IN_USE, rmdb_REP_SLOT_TYPE_ID, la_SCSILibrary::SetDriveIDs(), and la_SCSILibrary::Unload().

00342                          {
00343 
00344     log_FUNC_A_m(Unload,
00345         "drive: " << a_drive <<
00346         " slot: " << a_slot <<
00347         " barcode: " << a_barcode <<
00348         " job: " << a_jobID);
00349 
00350     la_ActiveMark a(m_active);
00351 
00352     // Auto pointer is used to serialise unloads if required.
00353     // By default unloads (medium ejects) are done in parallel.
00354     auto_ptr<cmn_MutexLock> l_ap;
00355     if (m_serialUnload) {
00356         l_ap.reset(new cmn_MutexLock(m_serialUnload_x));
00357     }
00358 
00359     try {
00360         try {
00361 
00362             UInt16_t drive  = atoi(a_drive);
00363             UInt16_t slot   = atoi(a_slot);
00364             string barcode  = string(a_barcode);
00365 
00366             //
00367             // If unconfigured drive situation is detected
00368             // then re-read the configuration
00369             // and retry once more.
00370             //
00371             bool retried = false;
00372             do {
00373                 try {
00374                     m_scsiLib.Unload(drive, slot, barcode);
00375                     // NOTE: If unload is successfull, just break out.
00376                     break;
00377                 }
00378                 catch (ivd_Error &ie) {
00379                     cmn_MutexLock l(m_lib_x);
00380                     {
00381                         //if unload fails release medium
00382                         ipc_EXEC_m(
00383                             m_iRM->MediumStatusClear(
00384                             CORBA::string_dup(a_barcode),
00385                             rmdb_MEDIUM_IN_USE);
00386                         );
00387 
00388                     }
00389 
00390                     if (!retried && ie.GetError() == ie_LA_UNCONFIGURED) {
00391                         retried = true;
00392 
00393                         log_DBG_m(dbg_NORM,
00394                             "Unconfigured drive situation. " <<
00395                             "Re-read drive info and retry.");
00396 
00397                         if (m_scsiLib.MustRequestEject()) {
00398                             // Must get device IDs of tape drives to perform eject.
00399                             vector<la_SCSILibrary::DriveInfo> driveIDs = ReadDriveInfo();
00400                             m_scsiLib.SetDriveIDs(driveIDs);
00401                         };
00402                     }
00403                     else {
00404                         log_DBG_m(dbg_NORM,
00405                             "Already retried or not ie_LA_UNCONFIGURED: " << endl << ie);
00406                         throw;
00407                     }
00408                 } // Protected by mutex to here
00409             } while (1);
00410 
00411             {
00412                 cmn_MutexLock l(m_lib_x);
00413                 ipc_EXEC_m(
00414                     m_iRM->MediumUnLoaded(
00415                         CORBA::string_dup(m_libName.c_str()),
00416                         CORBA::string_dup(a_barcode),
00417                         CORBA::string_dup(a_slot),
00418                         rmdb_REP_SLOT_TYPE_ID );
00419                 );
00420 
00421                 ostringstream sstr;
00422                 sstr << "Move: D=" << a_drive << " -> S=" << a_slot;
00423                 log_WriteEvent(sstr.str(), "", a_jobID, a_barcode);
00424             } // Protected by mutex to here
00425         }
00426         catch (ivd_Exception &ie) {
00427             ostringstream sstr;
00428             sstr
00429                 << "Move: D=" << a_drive << " -> S=" << a_slot << " FAILED ("
00430                 << ie.GetFriendly() << ")";
00431             log_WriteEvent(evt_ERROR, sstr.str(), "", a_jobID, a_barcode);
00432 
00433             throw ;
00434         }
00435         catch (...) {
00436             ostringstream sstr;
00437             sstr << "Move: D=" << a_drive << " -> S=" << a_slot << " FAILED";
00438             log_WriteEvent(evt_ERROR, sstr.str(), "", a_jobID, a_barcode);
00439 
00440             throw ivd_Error(
00441                 ie_FATAL_ERROR, "Unknown exception performing Unload.");
00442         }
00443     } ipc_CATCH_IVD_THROW_CORBA_m;
00444 }

Here is the call graph for this function:

void i_LibraryAgentSCSI_i::ConfirmMountRequest ( const char *  a_drive,
CORBA::Boolean  a_ok 
)

Definition at line 446 of file i_la-s_impl.cpp.

References dbg_NORM, log_DBG_m, and log_FUNC_A_m.

00447                                                                   {
00448     log_FUNC_A_m(ConfirmMountRequest, "drive: " << a_drive << " ok: " << a_ok);
00449 
00450     log_DBG_m(dbg_NORM, "Mount request reply - ignored");
00451 }

void i_LibraryAgentSCSI_i::Reconfigure ( const i_Library_t a_libCfg  ) 

Definition at line 453 of file i_la-s_impl.cpp.

References la_SCSILibrary::Close(), i_Library_t::controlDevice, dbg_DETAIL, dbg_LOW, ivd_BaseException::GetError(), ie_LA_UNSUPPORTED, ie_SCSI_OPEN, Inventory(), ipc_CATCH_IVD_THROW_CORBA_m, ivd_Error, log_DBG_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, m_scsiLib, la_SCSILibrary::MustRequestEject(), la_SCSILibrary::Open(), ReadDriveInfo(), la_SCSILibrary::SetDeviceID(), la_SCSILibrary::SetDriveIDs(), and UpdateIDs().

Referenced by i_LibraryAgentSCSI_i().

00453                                                                   {
00454     log_FUNC_m(Reconfigure);
00455 
00456     try {
00457         m_scsiLib.Close();
00458 
00459         string deviceID = string(a_libCfg.controlDevice);
00460         m_scsiLib.SetDeviceID(deviceID);
00461 
00462         try{
00463             m_scsiLib.Open();
00464         }
00465         catch (ivd_Exception &ie){
00466             ostringstream sstr;
00467             if ( ie.GetError() == ie_LA_UNSUPPORTED ){
00468                 log_DBG_m(dbg_DETAIL,"Cannot open SCSI, Library not supported!");
00469                 throw ie;
00470             }
00471             else{
00472                 log_DBG_m(dbg_DETAIL,"Cannot open SCSI!");
00473                 sstr << "Device not found: " << string(a_libCfg.controlDevice);
00474             }
00475             throw ivd_Error(ie_SCSI_OPEN, sstr.str());
00476         }
00477 
00478         if (m_scsiLib.MustRequestEject()) {
00479             try {
00480                 // Must get device IDs of tape drives to perform eject.
00481                 vector<la_SCSILibrary::DriveInfo> driveIDs = ReadDriveInfo();
00482                 m_scsiLib.SetDriveIDs(driveIDs);
00483             }
00484             catch (ivd_Exception) {
00485                 log_WRN_m("Can't read tape drive information at startup. Will try later.");
00486             }
00487         };
00488 
00489         // Perform library inventory (w/out INIT ELEMENT STATUS).
00490         Inventory(false);
00491         log_WriteEvent("Library reconfigured.");
00492 
00493         log_DBG_m(dbg_LOW, "Device ID : " << deviceID );
00494 
00495         UpdateIDs(a_libCfg);
00496     } ipc_CATCH_IVD_THROW_CORBA_m;
00497 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_LibraryAgentSCSI_i::Remove (  )  [virtual]

Reimplemented from i_Component_i.

Definition at line 499 of file i_la-s_impl.cpp.

References log_FUNC_m, and i_Component_i::Remove().

00499                                   {
00500     log_FUNC_m(Remove);
00501 
00502     i_Component_i::Remove();
00503 }

Here is the call graph for this function:

vector< la_SCSILibrary::DriveInfo > i_LibraryAgentSCSI_i::ReadDriveInfo (  )  [private]

Definition at line 117 of file i_la-s_impl.cpp.

References dbg_DETAIL, dbg_LOW, dbg_NORM, i_Drive_t::driveIndex, i_Drive_t::driveKey, i_Drive_t::driveName, g_cmn, la_SCSILibrary::GetNumDrives(), index, ipc_EXEC_m, i_Drive_t::libraryName, log_DBG_m, log_FUNC_m, log_WRN_m, cmn_SysInfo::m_hostName, m_iRM, m_libName, m_scsiLib, and cmn_Global::si.

Referenced by Reconfigure(), and Unload().

00117                                                                     {
00118     log_FUNC_m(ReadDriveInfo);
00119 
00120     vector<la_SCSILibrary::DriveInfo> deviceIDs;
00121 
00122     try {
00123         i_DriveSeq_t_var drives;
00124         ipc_EXEC_m( drives = m_iRM->SelectAllDrives(); );
00125 
00126         UInt16_t numDrives(0);
00127         ipc_EXEC_m( numDrives = m_scsiLib.GetNumDrives(); );
00128 
00129         //
00130         // Resize the vector to reflect actual
00131         // state in the ITL.
00132         // Drives that are not configured, will have empty
00133         // control device name.
00134         //
00135         deviceIDs.resize(numDrives);
00136 
00137         for (UInt32_t i = 0; i < drives->length(); i++) {
00138 
00139             i_Drive_t drive = drives[i];
00140 
00141             log_DBG_m(dbg_DETAIL,
00142                 "Got drive idx: " << drive.driveIndex <<
00143                 " : " << drive.driveName <<
00144                 " from " << drive.libraryName);
00145 
00146             if (m_libName.compare(drive.libraryName) == 0) {
00147 
00148                 UInt16_t index = atoi(drive.driveIndex);
00149 
00150                 if (index <= numDrives && index > 0) {
00151 
00152                     i_DriveHost_t_var drvHost;
00153                     try {
00154                         ipc_EXEC_m(
00155                             drvHost = m_iRM->SelectDriveHost(
00156                                 CORBA::string_dup(drive.driveName),
00157                                 CORBA::string_dup(g_cmn.si.m_hostName.c_str()) );
00158                         );
00159                     }
00160                     catch (const ivd_Exception) {
00161                         log_WRN_m(
00162                             "Can't get device fie for drive: " << drive.driveName <<
00163                             ". Possible problems when unloading from this drive.");
00164 
00165                         continue;
00166                     };
00167 
00168                     log_DBG_m(dbg_DETAIL,
00169                         "Got device ID: " << index <<
00170                         " : " << drvHost->controlDevice);
00171 
00172                     deviceIDs[index-1].scsiID = string(drvHost->controlDevice);
00173                     deviceIDs[index-1].drvKey = drive.driveKey;
00174 
00175                     log_DBG_m(dbg_NORM,
00176                         drive.driveIndex << " : " <<
00177                         drive.driveName << ", " << drvHost->controlDevice);
00178 
00179                 }
00180                 else {
00181                     log_WRN_m(
00182                         "LA startup: Drive index out of range:" <<
00183                         drive.driveName << " " << drive.driveIndex);
00184                 }
00185             } // if (m_lib
00186         } // for
00187     } //try
00188     catch (ivd_Exception &ie) {
00189         log_WRN_m(
00190             "Library Agent can't get tape drive info from RM." <<
00191             endl << "Error: " << ie);
00192         throw;
00193     }
00194     catch (...) {
00195         log_WRN_m(
00196             "Library Agent can't get tape drive info from RM." <<
00197             endl << "Error unknown.");
00198         throw;
00199     }
00200 
00201     for (UInt32_t i = 0; i < deviceIDs.size(); i++) {
00202         if (deviceIDs[i].scsiID.empty()) {
00203             log_DBG_m(dbg_LOW, "Unconfigured tape drive index " << (i+1));
00204         }
00205     }
00206 
00207     return deviceIDs;
00208 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_LibraryAgentSCSI_i::UpdateIDs ( i_Library_t  a_lib  )  [private]

Definition at line 505 of file i_la-s_impl.cpp.

References dbg_LOW, dbg_NORM, evt_WARNING, i_Library_t::firmwareRev, ivd_BaseException::GetFriendly(), la_SCSILibrary::GetProductID(), la_SCSILibrary::GetProductRevision(), la_SCSILibrary::GetSCSIID(), la_SCSILibrary::GetSerialNumber(), la_SCSILibrary::GetVendorID(), ipc_EXEC_m, i_Library_t::libraryName, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_iRM, m_scsiLib, i_Library_t::productID, i_Library_t::scsiID, i_Library_t::serialNo, and i_Library_t::vendorID.

Referenced by Reconfigure().

00505                                                       {
00506     log_FUNC_m(UpdateDriveIDs);
00507 
00508     try {
00509         bool    needsUpdate(false);
00510 
00511         const string& vid = m_scsiLib.GetVendorID();
00512         if (vid.compare(a_lib.vendorID) != 0) {
00513             if (strlen(a_lib.vendorID) > 0) {
00514                 ostringstream sstr;
00515                 sstr
00516                     << a_lib.libraryName
00517                     << ": Changed vendor ID from " << a_lib.vendorID
00518                     << " to " << vid << ".";
00519                 log_WriteEvent(
00520                     evt_WARNING, sstr.str(), "", 0,
00521                     (const char*)(a_lib.libraryName) );
00522             }
00523             else {
00524                 log_DBG_m(dbg_LOW, "Updating vendor ID: " << vid);
00525             }
00526             a_lib.vendorID = CORBA::string_dup(vid.c_str());
00527             needsUpdate = true;
00528         };
00529 
00530         const string& pid = m_scsiLib.GetProductID();
00531         if (pid.compare(a_lib.productID) != 0) {
00532             if (strlen(a_lib.productID) > 0) {
00533                 ostringstream sstr;
00534                 sstr
00535                     << a_lib.libraryName
00536                     << ": Changed product ID from " << a_lib.productID
00537                     << " to " << pid << ".";
00538                 log_WriteEvent(
00539                     evt_WARNING, sstr.str(), "", 0,
00540                     (const char*)(a_lib.libraryName) );
00541             }
00542             else {
00543                 log_DBG_m(dbg_LOW, "Updating product ID: " << pid);
00544             }
00545             a_lib.productID = CORBA::string_dup(pid.c_str());
00546             needsUpdate = true;
00547         };
00548 
00549         const string& rev = m_scsiLib.GetProductRevision();
00550         if (rev.compare(a_lib.firmwareRev) != 0) {
00551             if (strlen(a_lib.firmwareRev) > 0) {
00552                 ostringstream sstr;
00553                 sstr
00554                     << a_lib.libraryName
00555                     << ": Changed product revision from " << a_lib.firmwareRev
00556                     << " to " << rev << ".";
00557                 log_WriteEvent(
00558                     evt_WARNING, sstr.str(), "", 0,
00559                     (const char*)(a_lib.libraryName) );
00560             }
00561             else {
00562                 log_DBG_m(dbg_LOW, "Updating product revision: " << rev);
00563             }
00564             a_lib.firmwareRev = CORBA::string_dup(rev.c_str());
00565             needsUpdate = true;
00566         };
00567 
00568         string sid = m_scsiLib.GetSCSIID();
00569         if (sid.compare(a_lib.scsiID) != 0) {
00570             if (strlen(a_lib.scsiID) > 0) {
00571                 ostringstream sstr;
00572                 sstr
00573                     << a_lib.libraryName
00574                     << ": Changed SCSI ID from " << a_lib.scsiID
00575                     << " to " << sid << ".";
00576                 log_WriteEvent(
00577                     evt_WARNING, sstr.str(), "", 0,
00578                     (const char*)(a_lib.libraryName) );
00579             }
00580             else {
00581                 log_DBG_m(dbg_LOW, "Updating SCSI ID: " << rev);
00582             }
00583             a_lib.scsiID = CORBA::string_dup(sid.c_str());
00584             needsUpdate = true;
00585         };
00586 
00587         const string& sn = m_scsiLib.GetSerialNumber();
00588         if (sn.compare(a_lib.serialNo) != 0) {
00589             if (strlen(a_lib.serialNo) > 0) {
00590                 ostringstream sstr;
00591                 sstr
00592                     << a_lib.libraryName
00593                     << ": Changed serial number from " << a_lib.serialNo
00594                     << " to " << sn << ".";
00595                 log_WriteEvent(
00596                     evt_WARNING, sstr.str(), "", 0,
00597                     (const char*)(a_lib.libraryName) );
00598             }
00599             else {
00600                 log_DBG_m(dbg_LOW, "Updating s/n: " << a_lib.serialNo);
00601             }
00602             a_lib.serialNo = CORBA::string_dup(sn.c_str());
00603             needsUpdate = true;
00604         };
00605 
00606         if (needsUpdate) {
00607             ipc_EXEC_m(
00608                 m_iRM->UpdateLibrary(a_lib);
00609             );
00610         }
00611     }
00612     catch (const ivd_Exception& ie) {
00613         log_DBG_m(dbg_NORM, "Error updating RMDB: " << ie.GetFriendly());
00614     }
00615     catch (...) {
00616         log_DBG_m(dbg_NORM, "Error updating RMDB. ");
00617     }
00618 }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class la_SCSILibrary [friend]

Definition at line 56 of file i_la-s_impl.h.


Member Data Documentation

Reimplemented from i_Component_i.

Definition at line 59 of file i_la-s_impl.h.

Definition at line 62 of file i_la-s_impl.h.

Referenced by Inventory(), Load(), ReadDriveInfo(), and Unload().

Definition at line 63 of file i_la-s_impl.h.

Referenced by Inventory(), Load(), and Unload().

Definition at line 64 of file i_la-s_impl.h.

Referenced by Unload().

Definition at line 65 of file i_la-s_impl.h.

Referenced by i_LibraryAgentSCSI_i(), and Unload().

Definition at line 66 of file i_la-s_impl.h.

Referenced by Inventory(), Load(), Unload(), and ~i_LibraryAgentSCSI_i().

i_ResourceManager_var i_LibraryAgentSCSI_i::m_iRM [private]

Definition at line 68 of file i_la-s_impl.h.

Referenced by i_LibraryAgentSCSI_i(), Inventory(), Load(), ReadDriveInfo(), Unload(), and UpdateIDs().


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

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