(file) Return to ProviderManagerService.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / Attic

Diff for /pegasus/src/Pegasus/ProviderManager2/Attic/ProviderManagerService.cpp between version 1.67 and 1.90

version 1.67, 2005/05/06 21:44:28 version 1.90, 2006/08/09 21:13:00
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 38 
Line 40 
 //              Amit K Arora (amita@in.ibm.com) for PEP-101 //              Amit K Arora (amita@in.ibm.com) for PEP-101
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 //              Seema Gupta (gseema@in.ibm.com for PEP135) //              Seema Gupta (gseema@in.ibm.com for PEP135)
   //              Jim Wunderlich (Jim_Wunderlich@prodigy.net)
   //              Aruran, IBM (ashanmug@in.ibm.com)for Bug# 3881
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 82 
Line 86 
 ProviderManagerService* ProviderManagerService::providerManagerService=NULL; ProviderManagerService* ProviderManagerService::providerManagerService=NULL;
 Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND;
  
 ProviderManagerService::ProviderManagerService(void)  
     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)  
 {  
     providerManagerService=this;  
 }  
   
 ProviderManagerService::ProviderManagerService( ProviderManagerService::ProviderManagerService(
         ProviderRegistrationManager * providerRegistrationManager,         ProviderRegistrationManager * providerRegistrationManager,
         CIMRepository * repository)          CIMRepository * repository,
           ProviderManager* (*createDefaultProviderManagerCallback)())
     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
 { {
     providerManagerService=this;     providerManagerService=this;
Line 105 
Line 104 
  
     // Determine which ProviderManagerRouter(s) to use     // Determine which ProviderManagerRouter(s) to use
  
     ConfigManager* configManager = ConfigManager::getInstance();      _forceProviderProcesses = ConfigManager::parseBooleanValue(
     Boolean forceProviderProcesses = String::equal(          ConfigManager::getInstance()->getCurrentValue(
         configManager->getCurrentValue("forceProviderProcesses"), "true");              "forceProviderProcesses"));
  
 #ifdef PEGASUS_DISABLE_PROV_USERCTXT #ifdef PEGASUS_DISABLE_PROV_USERCTXT
     if (forceProviderProcesses)      if (_forceProviderProcesses)
     {     {
         _oopProviderManagerRouter =          _oopProviderManagerRouter = new OOPProviderManagerRouter(
             new OOPProviderManagerRouter(indicationCallback);              indicationCallback, responseChunkCallback,
               providerModuleFailureCallback);
     }     }
     else     else
     {     {
         _basicProviderManagerRouter =          _basicProviderManagerRouter = new BasicProviderManagerRouter(
             new BasicProviderManagerRouter(indicationCallback);              indicationCallback, responseChunkCallback,
               createDefaultProviderManagerCallback);
     }     }
 #else #else
     _oopProviderManagerRouter =      _oopProviderManagerRouter = new OOPProviderManagerRouter(
         new OOPProviderManagerRouter(indicationCallback);          indicationCallback, responseChunkCallback,
           providerModuleFailureCallback);
     if (!forceProviderProcesses)  
     {      if (!_forceProviderProcesses)
         _basicProviderManagerRouter =      {
             new BasicProviderManagerRouter(indicationCallback);          _basicProviderManagerRouter = new BasicProviderManagerRouter(
               indicationCallback, responseChunkCallback,
               createDefaultProviderManagerCallback);
     }     }
 #endif #endif
 } }
Line 171 
Line 174 
     else     else
     {     {
         asyncRequest = new AsyncLegacyOperationStart(         asyncRequest = new AsyncLegacyOperationStart(
             get_next_xid(),  
             0,             0,
             this->getQueueId(),             this->getQueueId(),
             message,             message,
Line 192 
Line 194 
     {     {
         request->op->processing();         request->op->processing();
  
         _incomingQueue.enqueue(request->op);          _incomingQueue.insert_back(request->op);
           ThreadStatus rtn = PEGASUS_THREAD_OK;
          while (!_thread_pool->allocate_and_awaken(          while (( rtn =_thread_pool->allocate_and_awaken(
                      (void *)this, ProviderManagerService::handleCimOperation))                       (void *)this, ProviderManagerService::handleCimOperation)) != PEGASUS_THREAD_OK)
           {
               if (rtn==PEGASUS_THREAD_INSUFFICIENT_RESOURCES)
                   Threads::yield();
               else
          {          {
              pegasus_yield();                  Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
                       "Not enough threads to service provider manager." );
   
                   Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
                       "Could not allocate thread for %s.",
                       getQueueName());
                   break;
              }
          }          }
     }     }
     else     else
Line 213 
Line 226 
  
 // Note: This method should not throw an exception.  It is used as a thread // Note: This method should not throw an exception.  It is used as a thread
 // entry point, and any exceptions thrown are ignored. // entry point, and any exceptions thrown are ignored.
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL  ThreadReturnType PEGASUS_THREAD_CDECL
 ProviderManagerService::handleCimOperation(void* arg) ProviderManagerService::handleCimOperation(void* arg)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
Line 235 
Line 248 
                     "op node in queue");                     "op node in queue");
  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return(PEGASUS_THREAD_RETURN(1));              return(ThreadReturnType(1));
         }         }
  
         AsyncOpNode* op = service->_incomingQueue.dequeue();          AsyncOpNode* op = service->_incomingQueue.remove_front();
           PEGASUS_ASSERT(op != 0);
         if ((op == 0) || (op->_request.count() == 0))          PEGASUS_ASSERT(op->_request.get() != 0);
         {  
             // ATTN: This may dereference a null pointer!  
             MessageQueue* queue = MessageQueue::lookup(op->_source_queue);  
   
             PEGASUS_ASSERT(queue != 0);  
   
             PEG_METHOD_EXIT();  
   
             // no request in op node  
             return(PEGASUS_THREAD_RETURN(1));  
         }  
  
         AsyncRequest* request =         AsyncRequest* request =
             static_cast<AsyncRequest*>(op->_request.next(0));              static_cast<AsyncRequest*>(op->_request.get());
  
         if ((request == 0) ||         if ((request == 0) ||
             (request->getType() != async_messages::ASYNC_LEGACY_OP_START))             (request->getType() != async_messages::ASYNC_LEGACY_OP_START))
         {         {
             // reply with NAK             // reply with NAK
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return(PEGASUS_THREAD_RETURN(0));              return(ThreadReturnType(0));
         }         }
  
         Message* legacy =         Message* legacy =
Line 278 
Line 280 
  
             if (msg != 0)             if (msg != 0)
             {             {
                 AcceptLanguages* langs = new AcceptLanguages(                  AcceptLanguageList* langs = new AcceptLanguageList(
                     ((AcceptLanguageListContainer)msg->operationContext.get(                     ((AcceptLanguageListContainer)msg->operationContext.get(
                         AcceptLanguageListContainer::NAME)).getLanguages());                         AcceptLanguageListContainer::NAME)).getLanguages());
                 Thread::setLanguages(langs);                 Thread::setLanguages(langs);
Line 304 
Line 306 
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
  
     return(PEGASUS_THREAD_RETURN(0));      return(ThreadReturnType(0));
 } }
  
 void ProviderManagerService::handleCimRequest( void ProviderManagerService::handleCimRequest(
Line 318 
Line 320 
     PEGASUS_ASSERT(request != 0);     PEGASUS_ASSERT(request != 0);
  
     // get request from op node     // get request from op node
     AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0));      AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.get());
     PEGASUS_ASSERT(async != 0);     PEGASUS_ASSERT(async != 0);
  
     Message * response = 0;     Message * response = 0;
Line 408 
Line 410 
                     "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",                     "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
                     "provider blocked."));                     "provider blocked."));
             response = cimResponse;             response = cimResponse;
   
                STAT_COPYDISPATCHER
         }         }
         else         else
         {         {
Line 436 
Line 440 
                 dynamic_cast<CIMEnableModuleResponseMessage*>(response);                 dynamic_cast<CIMEnableModuleResponseMessage*>(response);
             if (emResp->cimException.getCode() == CIM_ERR_SUCCESS)             if (emResp->cimException.getCode() == CIM_ERR_SUCCESS)
             {             {
                   //
                   //  On a successful enable, remove Stopped status and
                   //  append OK status
                   //
                   Array<Uint16> removeStatus;
                   Array<Uint16> appendStatus;
                   removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPED);
                   appendStatus.append (CIM_MSE_OPSTATUS_VALUE_OK);
                 _updateProviderModuleStatus(                 _updateProviderModuleStatus(
                     providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPED,                      providerModule, removeStatus, appendStatus);
                     CIM_MSE_OPSTATUS_VALUE_OK);  
             }             }
         }         }
         catch (Exception& e)         catch (Exception& e)
Line 450 
Line 461 
                     .getValue();                     .getValue();
             itValue.get(operationalStatus);             itValue.get(operationalStatus);
  
             if (response != 0)  
             {  
                 delete response;                 delete response;
             }  
  
             response = new CIMEnableModuleResponseMessage(             response = new CIMEnableModuleResponseMessage(
                 request->messageId,                 request->messageId,
Line 473 
Line 481 
  
         try         try
         {         {
             // Change module status from OK to STOPPING              //
               //  On issuing a disable request, append Stopping status
               //  Do not remove existing status
               //
             if (updateModuleStatus)             if (updateModuleStatus)
             {             {
                   Array<Uint16> removeStatus;
                   Array<Uint16> appendStatus;
                   appendStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING);
                 _updateProviderModuleStatus(                 _updateProviderModuleStatus(
                     providerModule, CIM_MSE_OPSTATUS_VALUE_OK,                      providerModule, removeStatus, appendStatus);
                     CIM_MSE_OPSTATUS_VALUE_STOPPING);  
             }             }
  
             // Forward the request to the ProviderManager             // Forward the request to the ProviderManager
Line 491 
Line 504 
                     dynamic_cast<CIMDisableModuleResponseMessage*>(response);                     dynamic_cast<CIMDisableModuleResponseMessage*>(response);
                 if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS)                 if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS)
                 {                 {
                     // Disable operation failed.  Module not stopped.                      //
                       //  On an unsuccessful disable, remove Stopping status
                       //
                       Array<Uint16> removeStatus;
                       Array<Uint16> appendStatus;
                       removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING);
                     _updateProviderModuleStatus(                     _updateProviderModuleStatus(
                         providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,                          providerModule, removeStatus, appendStatus);
                         CIM_MSE_OPSTATUS_VALUE_OK);  
                 }                 }
                 else                 else
                 {                 {
                     // Disable may or may not have been successful,                     // Disable may or may not have been successful,
                     // depending on whether there are outstanding requests.                     // depending on whether there are outstanding requests.
                     // Use last operationalStatus entry.                      // Remove Stopping status
                     _updateProviderModuleStatus(                      // Append status, if any, from disable module response
                         providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,                      Array<Uint16> removeStatus;
                         dmResp->operationalStatus[                      Array<Uint16> appendStatus;
                       removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING);
                       if (dmResp->operationalStatus.size() > 0)
                       {
                           //
                           //  On a successful disable, remove an OK or a Degraded
                           //  status, if present
                           //
                           if (dmResp->operationalStatus[
                               dmResp->operationalStatus.size()-1] ==
                               CIM_MSE_OPSTATUS_VALUE_STOPPED)
                           {
                               removeStatus.append (CIM_MSE_OPSTATUS_VALUE_OK);
                               removeStatus.append
                                   (CIM_MSE_OPSTATUS_VALUE_DEGRADED);
                           }
                           appendStatus.append (dmResp->operationalStatus[
                             dmResp->operationalStatus.size()-1]);                             dmResp->operationalStatus.size()-1]);
                 }                 }
                       _updateProviderModuleStatus(
                           providerModule, removeStatus, appendStatus);
                   }
             }             }
         }         }
         catch (Exception& e)         catch (Exception& e)
Line 517 
Line 553 
                     .getValue();                     .getValue();
             itValue.get(operationalStatus);             itValue.get(operationalStatus);
  
             if (response != 0)  
             {  
                 delete response;                 delete response;
             }  
  
             response = new CIMDisableModuleResponseMessage(             response = new CIMDisableModuleResponseMessage(
                 request->messageId,                 request->messageId,
Line 536 
Line 569 
  
     AsyncLegacyOperationResult * async_result =     AsyncLegacyOperationResult * async_result =
         new AsyncLegacyOperationResult(         new AsyncLegacyOperationResult(
         async->getKey(),  
         async->getRouting(),  
         op,         op,
         response);         response);
  
Line 546 
Line 577 
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
  
 void  void ProviderManagerService::responseChunkCallback(
 ProviderManagerService::handleCimResponse(CIMRequestMessage &request,      CIMRequestMessage* request,
                                                                                                                                                                         CIMResponseMessage &response)      CIMResponseMessage* response)
 { {
         CIMStatusCode code = CIM_ERR_SUCCESS;      PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
         String message;          "ProviderManagerService::responseChunkCallback");
  
         try         try
         {         {
                 // only incomplete messages are processed because the caller ends up                 // only incomplete messages are processed because the caller ends up
                 // sending the complete() stage                 // sending the complete() stage
                 PEGASUS_ASSERT(response.isComplete() == false);          PEGASUS_ASSERT(response->isComplete() == false);
  
                 AsyncLegacyOperationStart *requestAsync =                 AsyncLegacyOperationStart *requestAsync =
                         dynamic_cast<AsyncLegacyOperationStart *>(request._async);              dynamic_cast<AsyncLegacyOperationStart *>(request->_async);
                 PEGASUS_ASSERT(requestAsync);                 PEGASUS_ASSERT(requestAsync);
                 AsyncOpNode *op = requestAsync->op;                 AsyncOpNode *op = requestAsync->op;
                 PEGASUS_ASSERT(op);                 PEGASUS_ASSERT(op);
                 PEGASUS_ASSERT(! response._async);          PEGASUS_ASSERT(!response->_async);
                 response._async = new AsyncLegacyOperationResult          response->_async = new AsyncLegacyOperationResult(
                         (requestAsync->getKey(), requestAsync->getRouting(), op, &response);              op, response);
  
                 // set the destination                 // set the destination
                 op->_op_dest = op->_callback_response_q;                 op->_op_dest = op->_callback_response_q;
Line 584 
Line 615 
  
                 op->_async_callback(op, service, op->_callback_ptr);                 op->_async_callback(op, service, op->_callback_ptr);
         }         }
   
         catch(CIMException &e)  
         {  
                 code = e.getCode();  
                 message = e.getMessage();  
         }  
         catch(Exception &e)         catch(Exception &e)
         {         {
                 code = CIM_ERR_FAILED;          PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                 message = e.getMessage();              "Exception in ProviderManagerService::responseChunkCallback: " +
                   e.getMessage() + ".  Chunk not delivered.");
         }         }
         catch(...)         catch(...)
         {         {
                 code = CIM_ERR_FAILED;          PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                 message = cimStatusCodeToString(code);              "Exception in ProviderManagerService::responseChunkCallback.  "
                   "Chunk not delivered.");
         }         }
  
         if (code !=  CIM_ERR_SUCCESS)      PEG_METHOD_EXIT();
                 response.cimException = PEGASUS_CIM_EXCEPTION(code, message);  
 } }
  
 Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) Message* ProviderManagerService::_processMessage(CIMRequestMessage* request)
Line 623 
Line 649 
         {         {
             // Note: These responses do not contain interesting data, so just             // Note: These responses do not contain interesting data, so just
             // use the last one.             // use the last one.
             if (response)  
             {  
                 delete response;                 delete response;
             }  
  
             response = _oopProviderManagerRouter->processMessage(request);             response = _oopProviderManagerRouter->processMessage(request);
         }         }
Line 652 
Line 675 
             ProviderIdContainer pidc =             ProviderIdContainer pidc =
                 request->operationContext.get(ProviderIdContainer::NAME);                 request->operationContext.get(ProviderIdContainer::NAME);
             providerModule = pidc.getModule();             providerModule = pidc.getModule();
   #ifdef PEGASUS_ZOS_SECURITY
               if (request->getType() != CIM_EXPORT_INDICATION_REQUEST_MESSAGE)
               {
                   // this is a z/OS only function
                   // the function checks user authorization
                   // based on CIM operation versus provider profile
                   // Input: request and Provider ID Container
                   //Return: failure: a response message for the client
                   //        success: NULL
                   response = checkSAFProviderProfile(request, pidc);
                   if (response != NULL)
                   {
                       return response;
                   }
               }
   #endif
         }         }
  
         Uint16 userContext = 0;          Uint16 userContext = PEGASUS_DEFAULT_PROV_USERCTXT;
         Uint32 pos = providerModule.findProperty(         Uint32 pos = providerModule.findProperty(
             PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT);             PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT);
         if (pos != PEG_NOT_FOUND)         if (pos != PEG_NOT_FOUND)
Line 665 
Line 704 
         // Forward the request to the appropriate ProviderManagerRouter, based         // Forward the request to the appropriate ProviderManagerRouter, based
         // on the CIM Server configuration and the UserContext setting.         // on the CIM Server configuration and the UserContext setting.
  
         ConfigManager* configManager = ConfigManager::getInstance();          if (_forceProviderProcesses
         Boolean forceProviderProcesses = String::equal(  
             configManager->getCurrentValue("forceProviderProcesses"), "true");  
   
         if (forceProviderProcesses  
 #ifndef PEGASUS_DISABLE_PROV_USERCTXT #ifndef PEGASUS_DISABLE_PROV_USERCTXT
             || (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)             || (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)
             || (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)             || (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)
Line 693 
Line 728 
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
         "ProviderManagerService::unloadIdleProviders");         "ProviderManagerService::unloadIdleProviders");
       ThreadStatus rtn = PEGASUS_THREAD_OK;
     // Ensure that only one _unloadIdleProvidersHandler thread runs at a time     // Ensure that only one _unloadIdleProvidersHandler thread runs at a time
     _unloadIdleProvidersBusy++;     _unloadIdleProvidersBusy++;
     if ((_unloadIdleProvidersBusy.value() == 1) &&      if ((_unloadIdleProvidersBusy.get() == 1) &&
         (_thread_pool->allocate_and_awaken(          ((rtn = _thread_pool->allocate_and_awaken(
              (void*)this, ProviderManagerService::_unloadIdleProvidersHandler)))               (void*)this, ProviderManagerService::_unloadIdleProvidersHandler))==PEGASUS_THREAD_OK))
     {     {
         // _unloadIdleProvidersBusy is decremented in         // _unloadIdleProvidersBusy is decremented in
         // _unloadIdleProvidersHandler         // _unloadIdleProvidersHandler
Line 708 
Line 743 
         // If we fail to allocate a thread, don't retry now.         // If we fail to allocate a thread, don't retry now.
         _unloadIdleProvidersBusy--;         _unloadIdleProvidersBusy--;
     }     }
       if (rtn != PEGASUS_THREAD_OK)
       {
           Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
               "Not enough threads to unload idle providers.");
  
           Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
               "Could not allocate thread for %s to unload idle providers.",
               getQueueName());
       }
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
  
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL  ThreadReturnType PEGASUS_THREAD_CDECL
 ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw() ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw()
 { {
     try     try
Line 763 
Line 806 
             "Unexpected exception in _unloadIdleProvidersHandler");             "Unexpected exception in _unloadIdleProvidersHandler");
     }     }
  
     return(PEGASUS_THREAD_RETURN(0));      return(ThreadReturnType(0));
 } }
  
 // Updates the providerModule instance and the ProviderRegistrationManager // Updates the providerModule instance and the ProviderRegistrationManager
   //
   // This method is used to update the provider module status when the module is
   // disabled or enabled.  If a Degraded status has been set (appended) to the
   // OperationalStatus, it is cleared (removed) when the module is disabled or
   // enabled.
   //
 void ProviderManagerService::_updateProviderModuleStatus( void ProviderManagerService::_updateProviderModuleStatus(
     CIMInstance& providerModule,     CIMInstance& providerModule,
     Uint16 fromStatus,      const Array<Uint16>& removeStatus,
     Uint16 toStatus)      const Array<Uint16>& appendStatus)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
         "ProviderManagerService::_updateProviderModuleStatus");         "ProviderManagerService::_updateProviderModuleStatus");
Line 788 
Line 837 
     pos = providerModule.findProperty(CIMName("OperationalStatus"));     pos = providerModule.findProperty(CIMName("OperationalStatus"));
     PEGASUS_ASSERT(pos != PEG_NOT_FOUND);     PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
     CIMProperty operationalStatusProperty = providerModule.getProperty(pos);     CIMProperty operationalStatusProperty = providerModule.getProperty(pos);
     CIMValue operationalStatusValue = operationalStatusProperty.getValue();  
  
     if (!operationalStatusValue.isNull())      if (_providerRegistrationManager->updateProviderModuleStatus(
     {          providerModuleName, removeStatus, appendStatus, operationalStatus) ==
         operationalStatusValue.get(operationalStatus);          false)
     }  
   
     //  
     // update module status  
     //  
     for (Uint32 i = operationalStatus.size(); i > 0; i--)  
     {  
         if (operationalStatus[i-1] == fromStatus)  
         {  
             operationalStatus.remove(i-1);  
         }  
     }  
   
     operationalStatus.append(toStatus);  
   
     if (_providerRegistrationManager->setProviderModuleStatus(  
             providerModuleName, operationalStatus) == false)  
     {     {
         throw PEGASUS_CIM_EXCEPTION_L(         throw PEGASUS_CIM_EXCEPTION_L(
             CIM_ERR_FAILED,             CIM_ERR_FAILED,
Line 827 
Line 858 
 void ProviderManagerService::indicationCallback( void ProviderManagerService::indicationCallback(
     CIMProcessIndicationRequestMessage* request)     CIMProcessIndicationRequestMessage* request)
 { {
         try      if(request->operationContext.contains(AcceptLanguageListContainer::NAME))
         {         {
                 AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME);                 AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME);
         }catch(const Exception &)      }
       else
         {         {
                 request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY));          request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguageList()));
         }         }
  
         if (_indicationServiceQueueId == PEG_NOT_FOUND)         if (_indicationServiceQueueId == PEG_NOT_FOUND)
Line 851 
Line 883 
  
     AsyncLegacyOperationStart * asyncRequest =     AsyncLegacyOperationStart * asyncRequest =
         new AsyncLegacyOperationStart(         new AsyncLegacyOperationStart(
         providerManagerService->get_next_xid(),  
         0,         0,
         _indicationServiceQueueId,         _indicationServiceQueueId,
         request,         request,
         _indicationServiceQueueId);         _indicationServiceQueueId);
  
     providerManagerService->SendForget(asyncRequest);     providerManagerService->SendForget(asyncRequest);
   
   
   
   
   #ifdef PEGASUS_INDICATIONS_Q_THRESHOLD
   
       // See Comments in config.mak asociated with
       //  PEGASUS_INDICATIONS_Q_THRESHOLD
       //
       // if INDICATIONS_Q_STALL THRESHOLD is gt 0
       // then if there are over INDICATIONS_Q_STALL_THRESHOLD
       //           indications in the queue
       //      then force this provider to sleep until the queue count
       //      is lower than INDICATIONS_Q_RESUME_THRESHOLD
   
   static Mutex   indicationThresholdReportedLock;
   static Boolean indicationThresholdReported = false;
   
   #define INDICATIONS_Q_STALL_THRESHOLD PEGASUS_INDICATIONS_Q_THRESHOLD
   #define INDICATIONS_Q_RESUME_THRESHOLD (int)(PEGASUS_INDICATIONS_Q_THRESHOLD*.90)
   #define INDICATIONS_Q_STALL_DURATION 250 // milli-seconds
   
       MessageQueue * indicationsQueue = MessageQueue::lookup(_indicationServiceQueueId);
   
       if (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_STALL_THRESHOLD)
       {
           AutoMutex indicationThresholdReportedAutoMutex(indicationThresholdReportedLock);
           if (!indicationThresholdReported)
           {
               indicationThresholdReported = true;
               indicationThresholdReportedAutoMutex.unlock();
   
               // make log entry to record que max exceeded
   
               Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
                   "Indication generation stalled: maximum queue count ($0) exceeded.",
                   INDICATIONS_Q_STALL_THRESHOLD);
           }
           else
           {
               indicationThresholdReportedAutoMutex.unlock();
           }
   
           while (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_RESUME_THRESHOLD)
           {
               Threads::sleep(INDICATIONS_Q_STALL_DURATION);
           }
   
           AutoMutex indicationThresholdReportedAutoMutex1(indicationThresholdReportedLock);
           //        indicationThresholdReportedLock.lock();
           if(indicationThresholdReported)
           {
               indicationThresholdReported = false;
               indicationThresholdReportedAutoMutex1.unlock();
   
               Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
                     "Indication generation resumed: current queue count = $0",
                     ((MessageQueueService *)indicationsQueue)->getIncomingCount() );
   
           }
           else
           {
               indicationThresholdReportedAutoMutex1.unlock();
           }
       }
   #endif /* INDICATIONS_Q_STALL_THRESHOLD */
   
   }
   
   void ProviderManagerService::providerModuleFailureCallback
       (const String & moduleName,
        const String & userName,
        Uint16 userContext)
   {
       PEG_METHOD_ENTER (TRC_PROVIDERMANAGER,
           "ProviderManagerService::providerModuleFailureCallback");
   
       if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)
       {
           Logger::put_l (
               Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
               "ProviderManager.OOPProviderManagerRouter."
                   "OOP_PROVIDER_MODULE_USER_CTXT_FAILURE_DETECTED",
               "A failure was detected in provider module $0 with"
                   " user context $1.",
               moduleName, userName);
       }
       else  //  not requestor context
       {
           Logger::put_l (
               Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
               "ProviderManager.OOPProviderManagerRouter."
                   "OOP_PROVIDER_MODULE_FAILURE_DETECTED",
               "A failure was detected in provider module $0.",
               moduleName);
       }
   
       //
       //  Create Notify Provider Fail request message
       //
       CIMNotifyProviderFailRequestMessage * request =
           new CIMNotifyProviderFailRequestMessage
               (XmlWriter::getNextMessageId (),
               moduleName,
               userName,
               QueueIdStack ());
   
       //
       //  Send Notify Provider Fail request message to Indication Service
       //
       if (_indicationServiceQueueId == PEG_NOT_FOUND)
       {
           Array <Uint32> serviceIds;
   
           providerManagerService->find_services
               (PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds);
           PEGASUS_ASSERT (serviceIds.size () != 0);
   
           _indicationServiceQueueId = serviceIds [0];
       }
   
       request->queueIds = QueueIdStack
           (_indicationServiceQueueId, providerManagerService->getQueueId ());
   
       AsyncLegacyOperationStart * asyncRequest = new AsyncLegacyOperationStart(
           0,
           _indicationServiceQueueId,
           request,
           _indicationServiceQueueId);
   
       AutoPtr <AsyncReply> asyncReply
           (providerManagerService->SendWait (asyncRequest));
   
       AutoPtr <CIMNotifyProviderFailResponseMessage> response
           (reinterpret_cast <CIMNotifyProviderFailResponseMessage *>
               ((dynamic_cast <AsyncLegacyOperationResult *>
               (asyncReply.get ()))->get_result ()));
   
       if (response->cimException.getCode () != CIM_ERR_SUCCESS)
       {
           PEG_TRACE_STRING (TRC_DISCARDED_DATA, Tracer::LEVEL2,
               "Unexpected exception in providerModuleFailureCallback: " +
               response->cimException.getMessage ());
       }
       else
       {
           //
           //  Successful response
           //  Examine result to see if any subscriptions were affected
           //
           if (response->numSubscriptionsAffected > 0)
           {
               //
               //  Subscriptions were affected
               //  Update the provider module status to Degraded
               //
               try
               {
                   CIMInstance providerModule;
                   CIMKeyBinding keyBinding(
                       _PROPERTY_PROVIDERMODULE_NAME,
                       moduleName,
                       CIMKeyBinding::STRING);
                   Array<CIMKeyBinding> kbArray;
                   kbArray.append(keyBinding);
                   CIMObjectPath modulePath("", PEGASUS_NAMESPACENAME_INTEROP,
                       PEGASUS_CLASSNAME_PROVIDERMODULE, kbArray);
                   providerModule =
                       providerManagerService->_providerRegistrationManager->
                           getInstance(
                               modulePath, false, false, CIMPropertyList());
   
                   Array<Uint16> removeStatus;
                   Array<Uint16> appendStatus;
                   removeStatus.append(CIM_MSE_OPSTATUS_VALUE_OK);
                   appendStatus.append(CIM_MSE_OPSTATUS_VALUE_DEGRADED);
                   providerManagerService->_updateProviderModuleStatus(
                       providerModule, removeStatus, appendStatus);
               }
               catch (const Exception & e)
               {
                   PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                       "Failed to update provider module status: " +
                       e.getMessage());
               }
   
               //
               //  Log a warning message since subscriptions were affected
               //
               Logger::put_l (
                   Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
                   "ProviderManager.OOPProviderManagerRouter."
                       "OOP_PROVIDER_MODULE_SUBSCRIPTIONS_AFFECTED",
                   "The generation of indications by providers in module $0 "
                   "may be affected.  To ensure these providers are serving "
                   "active subscriptions, disable and then re-enable this "
                   "module using the cimprovider command.",
                   moduleName);
           }
       }
   
       PEG_METHOD_EXIT();
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.67  
changed lines
  Added in v.1.90

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2