(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.75.2.4 and 1.76

version 1.75.2.4, 2006/09/22 18:47:14 version 1.76, 2006/02/24 19:16:28
Line 55 
Line 55 
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/Logger.h> #include <Pegasus/Common/Logger.h>
 #include <Pegasus/Common/AutoPtr.h> #include <Pegasus/Common/AutoPtr.h>
   #include <Pegasus/Common/Constants.h>
  
 #include <Pegasus/Config/ConfigManager.h> #include <Pegasus/Config/ConfigManager.h>
  
Line 116 
Line 117 
     if (forceProviderProcesses)     if (forceProviderProcesses)
     {     {
         _oopProviderManagerRouter = new OOPProviderManagerRouter(         _oopProviderManagerRouter = new OOPProviderManagerRouter(
             indicationCallback, responseChunkCallback,              indicationCallback, responseChunkCallback);
             providerModuleFailureCallback);  
     }     }
     else     else
     {     {
Line 126 
Line 126 
     }     }
 #else #else
     _oopProviderManagerRouter = new OOPProviderManagerRouter(     _oopProviderManagerRouter = new OOPProviderManagerRouter(
         indicationCallback, responseChunkCallback,          indicationCallback, responseChunkCallback);
         providerModuleFailureCallback);  
  
     if (!forceProviderProcesses)     if (!forceProviderProcesses)
     {     {
Line 419 
Line 418 
             //             //
             CIMResponseMessage* cimResponse = request->buildResponse();             CIMResponseMessage* cimResponse = request->buildResponse();
             cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L(             cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L(
                 CIM_ERR_NOT_SUPPORTED,                  CIM_ERR_ACCESS_DENIED,
                 MessageLoaderParms(                 MessageLoaderParms(
                     "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",                     "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
                     "provider blocked."));                     "provider blocked."));
Line 454 
Line 453 
                 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, removeStatus, appendStatus);                      providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPED,
                       CIM_MSE_OPSTATUS_VALUE_OK);
             }             }
         }         }
         catch (Exception& e)         catch (Exception& e)
Line 498 
Line 490 
  
         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, removeStatus, appendStatus);                      providerModule, CIM_MSE_OPSTATUS_VALUE_OK,
                       CIM_MSE_OPSTATUS_VALUE_STOPPING);
             }             }
  
             // Forward the request to the ProviderManager             // Forward the request to the ProviderManager
Line 521 
Line 508 
                     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, removeStatus, appendStatus);                          providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,
                           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.
                     // Remove Stopping status                      // Use last operationalStatus entry.
                     // Append status, if any, from disable module response  
                     Array<Uint16> removeStatus;  
                     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]);  
                     }  
                     _updateProviderModuleStatus(                     _updateProviderModuleStatus(
                         providerModule, removeStatus, appendStatus);                          providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,
                           dmResp->operationalStatus[
                               dmResp->operationalStatus.size()-1]);
                 }                 }
             }             }
         }         }
Line 603 
Line 567 
     CIMRequestMessage* request,     CIMRequestMessage* request,
     CIMResponseMessage* response)     CIMResponseMessage* response)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,          CIMStatusCode code = CIM_ERR_SUCCESS;
         "ProviderManagerService::responseChunkCallback");          String message;
  
     try     try
     {     {
Line 637 
Line 601 
  
         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)
     {     {
         PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                  code = CIM_ERR_FAILED;
             "Exception in ProviderManagerService::responseChunkCallback: " +                  message = e.getMessage();
                 e.getMessage() + ".  Chunk not delivered.");  
     }     }
     catch(...)     catch(...)
     {     {
         PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                  code = CIM_ERR_FAILED;
             "Exception in ProviderManagerService::responseChunkCallback.  "                  message = cimStatusCodeToString(code);
                 "Chunk not delivered.");  
     }     }
  
     PEG_METHOD_EXIT();          if (code !=  CIM_ERR_SUCCESS)
                   response->cimException = PEGASUS_CIM_EXCEPTION(code, message);
 } }
  
 Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) Message* ProviderManagerService::_processMessage(CIMRequestMessage* request)
Line 702 
Line 671 
             providerModule = pidc.getModule();             providerModule = pidc.getModule();
         }         }
  
         Uint16 userContext = PEGASUS_DEFAULT_PROV_USERCTXT;          Uint16 userContext = 0;
         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 823 
Line 792 
 } }
  
 // 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,
     const Array<Uint16>& removeStatus,      Uint16 fromStatus,
     const Array<Uint16>& appendStatus)      Uint16 toStatus)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
         "ProviderManagerService::_updateProviderModuleStatus");         "ProviderManagerService::_updateProviderModuleStatus");
Line 850 
Line 813 
     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())
       {
           operationalStatusValue.get(operationalStatus);
       }
   
       //
       // update module status
       //
       for (Uint32 i = operationalStatus.size(); i > 0; i--)
       {
           if (operationalStatus[i-1] == fromStatus)
           {
               operationalStatus.remove(i-1);
           }
       }
  
     if (_providerRegistrationManager->updateProviderModuleStatus(      operationalStatus.append(toStatus);
         providerModuleName, removeStatus, appendStatus, operationalStatus) ==  
         false)      if (_providerRegistrationManager->setProviderModuleStatus(
               providerModuleName, operationalStatus) == false)
     {     {
         throw PEGASUS_CIM_EXCEPTION_L(         throw PEGASUS_CIM_EXCEPTION_L(
             CIM_ERR_FAILED,             CIM_ERR_FAILED,
Line 971 
Line 952 
  
 } }
  
 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  
         (providerManagerService->get_next_xid (),  
         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.75.2.4  
changed lines
  Added in v.1.76

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2