version 1.13, 2003/10/17 04:02:11
|
version 1.88, 2006/08/04 19:05:59
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// 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 |
|
|
// Mike Day, IBM (mdday@us.ibm.com) | // Mike Day, IBM (mdday@us.ibm.com) |
// Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators. | // Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators. |
// Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) | // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
|
// Adrian Schuur, IBM (schuur@de.ibm.com) |
|
// Amit K Arora (amita@in.ibm.com) for PEP-101 |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Seema Gupta (gseema@in.ibm.com for PEP135) |
|
// Jim Wunderlich (Jim_Wunderlich@prodigy.net) |
|
// Aruran, IBM (ashanmug@in.ibm.com)for Bug# 3881 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "ProviderManagerService.h" | #include "ProviderManagerService.h" |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/PegasusVersion.h> |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
|
#include <Pegasus/Common/Thread.h> |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/Destroyer.h> |
#include <Pegasus/Common/AutoPtr.h> |
|
#include <Pegasus/Common/Constants.h> |
| |
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
| |
PEGASUS_NAMESPACE_BEGIN |
#include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> |
|
#include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h> |
// BEGIN TEMP SECTION |
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
class ProviderManagerContainer |
|
{ |
|
public: |
|
ProviderManagerContainer(const String & physicalName, const String & logicalName, const String & interfaceName) |
|
{ |
|
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
_physicalName = physicalName + String(".dll"); |
|
#elif defined(PEGASUS_OS_HPUX) && defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
|
_physicalName = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
_physicalName.append(String("/lib") + physical + String(".sl")); |
|
#elif defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
|
_physicalName = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
_physicalName.append(String("/lib") + physical + String(".so")); |
|
#elif defined(PEGASUS_OS_OS400) |
|
_physicalName = physicalName; |
|
#else |
|
_physicalName = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
_physicalName.append(String("/lib") + physical + String(".so")); |
|
#endif |
|
|
|
_logicalName = logicalName; |
|
|
|
_interfaceName = interfaceName; |
|
|
|
_module = ProviderManagerModule(_physicalName); |
|
|
|
_module.load(); |
|
|
|
_manager = _module.getProviderManager(_logicalName); |
|
} |
|
|
|
~ProviderManagerContainer(void) |
|
{ |
|
_module.unload(); |
|
} |
|
|
|
ProviderManager & getProviderManager(void) |
|
{ |
|
return(*_manager); |
|
} |
|
|
|
String & getPhysicalName(void) |
|
{ |
|
return(_physicalName); |
|
} |
|
|
|
String & getLogicalName(void) |
|
{ |
|
return(_logicalName); |
|
} |
|
| |
String & getInterfaceName(void) |
PEGASUS_NAMESPACE_BEGIN |
{ |
|
return(_interfaceName); |
|
} |
|
|
|
private: |
|
String _physicalName; |
|
String _logicalName; |
|
String _interfaceName; |
|
|
|
ProviderManagerModule _module; |
|
ProviderManager * _manager; |
|
|
|
}; |
|
|
|
static Array<ProviderManagerContainer> _providerManagers; |
|
// END TEMP SECTION |
|
| |
inline Boolean _isSupportedRequestType(const Message * message) | inline Boolean _isSupportedRequestType(const Message * message) |
{ | { |
|
|
return(false); | return(false); |
} | } |
| |
|
ProviderManagerService* ProviderManagerService::providerManagerService=NULL; |
|
Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; |
|
|
ProviderManagerService::ProviderManagerService(void) | ProviderManagerService::ProviderManagerService(void) |
: MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) | : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) |
{ | { |
|
providerManagerService=this; |
} | } |
| |
ProviderManagerService::ProviderManagerService(ProviderRegistrationManager * providerRegistrationManager) |
ProviderManagerService::ProviderManagerService( |
|
ProviderRegistrationManager * providerRegistrationManager, |
|
CIMRepository * repository, |
|
ProviderManager* (*createDefaultProviderManagerCallback)()) |
: MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) | : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) |
{ | { |
SetProviderRegistrationManager(providerRegistrationManager); |
providerManagerService=this; |
|
_repository=repository; |
| |
// ATTN: this section is a temporary solution to populate the list of enabled |
_providerRegistrationManager = providerRegistrationManager; |
// provider managers for a given distribution. it includes another temporary |
|
// solution for converting a generic file name into a file name useable by |
_unloadIdleProvidersBusy = 0; |
// each platform. |
|
|
_basicProviderManagerRouter = 0; |
// BEGIN TEMP SECTION |
_oopProviderManagerRouter = 0; |
//#if defined(PEGASUS_OS_OS400) |
|
//_providerManagers.append(ProviderManagerContainer("QSYS/??????????", "INTERNAL", "INTERNAL")); |
|
//#else |
|
//_providerManager.append(ProviderManagerContainer("InternalProviderManager", "DEFAULT", "INTERNAL")); |
|
//#endif |
|
|
|
/* |
|
#if defined(ENABLE_DEFAULT_PROVIDER_MANAGER) |
|
#if defined(PEGASUS_OS_OS400) |
|
_providerManagers.append(ProviderManagerContainer("QSYS/QYCMDFTPVM", "DEFAULT", "C++Default")); |
|
#else |
|
_providerManagers.append(ProviderManagerContainer("DefaultProviderManager", "DEFAULT", "C++Default")); |
|
#endif |
|
#endif |
|
| |
#if defined(ENABLE_CMPI_PROVIDER_MANAGER) |
// Determine which ProviderManagerRouter(s) to use |
#if defined(PEGASUS_OS_OS400) |
|
_providerManagers.append(ProviderManagerContainer("QSYS/QYCMCMPIPM", "CMPI", "CMPI")); |
ConfigManager* configManager = ConfigManager::getInstance(); |
|
Boolean forceProviderProcesses = String::equal( |
|
configManager->getCurrentValue("forceProviderProcesses"), "true"); |
|
|
|
#ifdef PEGASUS_DISABLE_PROV_USERCTXT |
|
if (forceProviderProcesses) |
|
{ |
|
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
providerModuleFailureCallback); |
|
} |
|
else |
|
{ |
|
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
createDefaultProviderManagerCallback); |
|
} |
#else | #else |
_providerManagers.append(ProviderManagerContainer("CMPIProviderManager", "CMPI", "CMPI")); |
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
#endif |
indicationCallback, responseChunkCallback, |
|
providerModuleFailureCallback); |
|
|
|
if (!forceProviderProcesses) |
|
{ |
|
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
createDefaultProviderManagerCallback); |
|
} |
#endif | #endif |
*/ |
|
// END TEMP SECTION |
|
} | } |
| |
ProviderManagerService::~ProviderManagerService(void) | ProviderManagerService::~ProviderManagerService(void) |
{ | { |
|
delete _basicProviderManagerRouter; |
|
delete _oopProviderManagerRouter; |
|
providerManagerService=NULL; |
} | } |
| |
Boolean ProviderManagerService::messageOK(const Message * message) | Boolean ProviderManagerService::messageOK(const Message * message) |
|
|
else | else |
{ | { |
asyncRequest = new AsyncLegacyOperationStart( | asyncRequest = new AsyncLegacyOperationStart( |
get_next_xid(), |
|
0, | 0, |
this->getQueueId(), | this->getQueueId(), |
message, | message, |
|
|
{ | { |
request->op->processing(); | request->op->processing(); |
| |
_incomingQueue.enqueue(request->op); |
_incomingQueue.insert_back(request->op); |
|
ThreadStatus rtn = PEGASUS_THREAD_OK; |
|
while (( rtn =_thread_pool->allocate_and_awaken( |
|
(void *)this, ProviderManagerService::handleCimOperation)) != PEGASUS_THREAD_OK) |
|
{ |
|
if (rtn==PEGASUS_THREAD_INSUFFICIENT_RESOURCES) |
|
pegasus_yield(); |
|
else |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"Not enough threads to service provider manager." ); |
| |
_thread_pool->allocate_and_awaken((void *)this, ProviderManagerService::handleCimOperation); |
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Could not allocate thread for %s.", |
|
getQueueName()); |
|
break; |
|
} |
|
} |
} | } |
else | else |
{ | { |
|
|
return; | return; |
} | } |
| |
/* |
// Note: This method should not throw an exception. It is used as a thread |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleServiceOperation(void * arg) throw() |
// entry point, and any exceptions thrown are ignored. |
{ |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
// get the service from argument |
ProviderManagerService::handleCimOperation(void* arg) |
ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg); |
|
|
|
PEGASUS_ASSERT(service != 0); |
|
|
|
// get message from service queue |
|
Message * message = service->_incomingQueue.dequeue(); |
|
|
|
PEGASUS_ASSERT(message != 0); |
|
|
|
if(service->_incomingQueue.size() == 0) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::handleCimOperation() called with no op node in queue" ); |
"ProviderManagerService::handleCimOperation"); |
|
|
PEG_METHOD_EXIT(); |
|
|
|
// thread started with no message in queue. |
|
return(PEGASUS_THREAD_RETURN(1)); |
|
} |
|
|
|
AsyncOpNode * op = service->_incomingQueue.dequeue(); |
|
|
|
PEGASUS_ASSERT(op != 0 ); |
|
|
|
if(op->_request.count() == 0) |
|
{ |
|
MessageQueue * queue = MessageQueue::lookup(op->_source_queue); |
|
|
|
PEGASUS_ASSERT(queue != 0); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
// no request in op node |
|
return(PEGASUS_THREAD_RETURN(1)); |
|
} |
|
|
|
return(0); |
|
} |
|
*/ |
|
|
|
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleCimOperation(void * arg) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimOperation"); |
|
| |
if(arg == 0) |
PEGASUS_ASSERT(arg != 0); |
{ |
|
// thread started with invalid argument. |
|
return(PEGASUS_THREAD_RETURN(1)); |
|
} |
|
| |
// get the service from argument | // get the service from argument |
ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg); |
ProviderManagerService* service = |
|
reinterpret_cast<ProviderManagerService *>(arg); |
|
PEGASUS_ASSERT(service != 0); |
| |
|
try |
|
{ |
if(service->_incomingQueue.size() == 0) | if(service->_incomingQueue.size() == 0) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"ProviderManagerService::handleCimOperation() called with no op node in queue" ); |
"ProviderManagerService::handleCimOperation() called with no " |
|
"op node in queue"); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
// thread started with no message in queue. |
|
return(PEGASUS_THREAD_RETURN(1)); | return(PEGASUS_THREAD_RETURN(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); |
{ |
|
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 = static_cast<AsyncRequest *>(op->_request.next(0)); |
AsyncRequest* request = |
|
static_cast<AsyncRequest*>(op->_request.get()); |
| |
if((request == 0) || (request->getType() != async_messages::ASYNC_LEGACY_OP_START)) |
if ((request == 0) || |
|
(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(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
try |
Message* legacy = |
{ |
static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
Message * legacy = static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
|
| |
if(_isSupportedRequestType(legacy)) | if(_isSupportedRequestType(legacy)) |
{ | { |
Destroyer<Message> xmessage(legacy); |
AutoPtr<Message> xmessage(legacy); |
| |
// Set the client's requested language into this service thread. | // Set the client's requested language into this service thread. |
// This will allow functions in this service to return messages | // This will allow functions in this service to return messages |
|
|
| |
if(msg != 0) | if(msg != 0) |
{ | { |
AcceptLanguages * langs = new AcceptLanguages(msg->acceptLanguages); |
AcceptLanguageList* langs = new AcceptLanguageList( |
|
((AcceptLanguageListContainer)msg->operationContext.get( |
|
AcceptLanguageListContainer::NAME)).getLanguages()); |
Thread::setLanguages(langs); | Thread::setLanguages(langs); |
} | } |
else | else |
|
|
service->handleCimRequest(op, legacy); | service->handleCimRequest(op, legacy); |
} | } |
} | } |
|
catch (const Exception& e) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Unexpected exception in handleCimOperation: " + e.getMessage()); |
|
} |
catch(...) | catch(...) |
{ | { |
// ATTN: log error |
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Unexpected exception in handleCimOperation."); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
return(PEGASUS_THREAD_RETURN(0)); | return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
void ProviderManagerService::handleCimRequest(AsyncOpNode * op, const Message * message) |
void ProviderManagerService::handleCimRequest( |
|
AsyncOpNode * op, |
|
Message * message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::handleCimRequest"); |
| |
// ATTN: ensure message is a request??? |
CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message); |
CIMMessage * request = dynamic_cast<CIMMessage *>(const_cast<Message *>(message)); |
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((request != 0) && (async != 0)); |
|
| |
Message * response = 0; | Message * response = 0; |
|
Boolean consumerLookupFailed = false; |
| |
// get namespace and class name from message |
if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) |
String nameSpace; |
|
String className; |
|
|
|
switch(message->getType()) |
|
{ | { |
case CIM_GET_CLASS_REQUEST_MESSAGE: |
// |
|
// Get a ProviderIdContainer for ExportIndicationRequestMessage. |
|
// Note: This can be removed when the CIMExportRequestDispatcher |
|
// is updated to add the ProviderIdContainer to the message. |
|
// |
|
CIMInstance providerModule; |
|
CIMInstance provider; |
|
const CIMExportIndicationRequestMessage* expRequest = |
|
dynamic_cast<const CIMExportIndicationRequestMessage*>(request); |
|
if (_providerRegistrationManager->lookupIndicationConsumer( |
|
expRequest->destinationPath, provider, providerModule)) |
{ | { |
const CIMGetClassRequestMessage * p = dynamic_cast<const CIMGetClassRequestMessage *>(message); |
request->operationContext.insert( |
|
ProviderIdContainer(providerModule, provider)); |
PEGASUS_ASSERT(p != 0); |
} |
|
else |
nameSpace = p->nameSpace.getString(); |
{ |
className = p->className.getString(); |
consumerLookupFailed = true; |
|
} |
} | } |
| |
break; |
if (consumerLookupFailed) |
case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE: |
|
{ | { |
const CIMEnumerateClassesRequestMessage * p = dynamic_cast<const CIMEnumerateClassesRequestMessage *>(message); |
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
response = cimResponse; |
|
} |
|
else if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
|
(dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) || |
|
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) || |
|
(request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE)) |
|
{ |
|
// Handle CIMOperationRequestMessage, CIMExportIndicationRequestMessage, |
|
// CIMIndicationRequestMessage, and CIMInitializeProviderRequestMessage. |
|
// (These should be blocked when the provider module is disabled.) |
| |
PEGASUS_ASSERT(p != 0); |
// |
|
// Get the provider module instance to check for a disabled module |
|
// |
|
CIMInstance providerModule; |
| |
nameSpace = p->nameSpace.getString(); |
// The provider ID container is added to the OperationContext |
className = p->className.getString(); |
// by the CIMOperationRequestDispatcher for all CIM operation |
} |
// requests to providers, so it does not need to be added again. |
|
// CIMInitializeProviderRequestMessage also has a provider ID |
|
// container. |
|
ProviderIdContainer pidc = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
| |
break; |
// |
case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE: |
// Check if the target provider is disabled |
|
// |
|
Boolean moduleDisabled = false; |
|
Uint32 pos = providerModule.findProperty(CIMName("OperationalStatus")); |
|
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
Array<Uint16> operationalStatus; |
|
providerModule.getProperty(pos).getValue().get(operationalStatus); |
|
|
|
for(Uint32 i = 0; i < operationalStatus.size(); i++) |
{ | { |
const CIMEnumerateClassNamesRequestMessage * p = dynamic_cast<const CIMEnumerateClassNamesRequestMessage *>(message); |
if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) || |
|
(operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)) |
|
{ |
|
moduleDisabled = true; |
|
break; |
|
} |
|
} |
| |
PEGASUS_ASSERT(p != 0); |
if (moduleDisabled) |
|
{ |
|
// |
|
// Send a "provider blocked" response |
|
// |
|
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_ACCESS_DENIED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService.PROVIDER_BLOCKED", |
|
"provider blocked.")); |
|
response = cimResponse; |
| |
nameSpace = p->nameSpace.getString(); |
STAT_COPYDISPATCHER |
className = p->className.getString(); |
|
} | } |
|
else |
break; |
{ |
case CIM_CREATE_CLASS_REQUEST_MESSAGE: |
// |
|
// Forward the request to the appropriate ProviderManagerRouter |
|
// |
|
response = _processMessage(request); |
|
} |
|
} |
|
else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
{ | { |
const CIMCreateClassRequestMessage * p = dynamic_cast<const CIMCreateClassRequestMessage *>(message); |
// Handle CIMEnableModuleRequestMessage |
|
CIMEnableModuleRequestMessage * emReq = |
|
dynamic_cast<CIMEnableModuleRequestMessage*>(request); |
| |
PEGASUS_ASSERT(p != 0); |
CIMInstance providerModule = emReq->providerModule; |
| |
nameSpace = p->nameSpace.getString(); |
try |
//className = p->className.getString(); |
{ |
} |
// Forward the request to the ProviderManager |
|
response = _processMessage(request); |
| |
break; |
// If successful, update provider module status to OK |
case CIM_MODIFY_CLASS_REQUEST_MESSAGE: |
// ATTN: Use CIMEnableModuleResponseMessage operationalStatus? |
|
CIMEnableModuleResponseMessage * emResp = |
|
dynamic_cast<CIMEnableModuleResponseMessage*>(response); |
|
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( |
|
providerModule, removeStatus, appendStatus); |
|
} |
|
} |
|
catch (Exception& e) |
{ | { |
const CIMModifyClassRequestMessage * p = dynamic_cast<const CIMModifyClassRequestMessage *>(message); |
// Get the OperationalStatus property from the provider module |
|
Array<Uint16> operationalStatus; |
|
CIMValue itValue = emReq->providerModule.getProperty( |
|
emReq->providerModule.findProperty("OperationalStatus")) |
|
.getValue(); |
|
itValue.get(operationalStatus); |
| |
PEGASUS_ASSERT(p != 0); |
delete response; |
| |
nameSpace = p->nameSpace.getString(); |
response = new CIMEnableModuleResponseMessage( |
//className = p->className.getString(); |
request->messageId, |
|
CIMException(CIM_ERR_FAILED, e.getMessage()), |
|
request->queueIds.copyAndPop(), |
|
operationalStatus); |
} | } |
|
} |
break; |
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) |
case CIM_DELETE_CLASS_REQUEST_MESSAGE: |
|
{ | { |
const CIMDeleteClassRequestMessage * p = dynamic_cast<const CIMDeleteClassRequestMessage *>(message); |
// Handle CIMDisableModuleRequestMessage |
|
CIMDisableModuleRequestMessage * dmReq = |
|
dynamic_cast<CIMDisableModuleRequestMessage*>(request); |
| |
PEGASUS_ASSERT(p != 0); |
CIMInstance providerModule = dmReq->providerModule; |
|
Boolean updateModuleStatus = !dmReq->disableProviderOnly; |
| |
nameSpace = p->nameSpace.getString(); |
try |
className = p->className.getString(); |
{ |
|
// |
|
// On issuing a disable request, append Stopping status |
|
// Do not remove existing status |
|
// |
|
if (updateModuleStatus) |
|
{ |
|
Array<Uint16> removeStatus; |
|
Array<Uint16> appendStatus; |
|
appendStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING); |
|
_updateProviderModuleStatus( |
|
providerModule, removeStatus, appendStatus); |
} | } |
| |
break; |
// Forward the request to the ProviderManager |
case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
response = _processMessage(request); |
|
|
|
// Update provider module status based on success or failure |
|
if (updateModuleStatus) |
|
{ |
|
CIMDisableModuleResponseMessage * dmResp = |
|
dynamic_cast<CIMDisableModuleResponseMessage*>(response); |
|
if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS) |
{ | { |
const CIMGetInstanceRequestMessage * p = dynamic_cast<const CIMGetInstanceRequestMessage *>(message); |
// |
|
// On an unsuccessful disable, remove Stopping status |
|
// |
|
Array<Uint16> removeStatus; |
|
Array<Uint16> appendStatus; |
|
removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING); |
|
_updateProviderModuleStatus( |
|
providerModule, removeStatus, appendStatus); |
|
} |
|
else |
|
{ |
|
// Disable may or may not have been successful, |
|
// depending on whether there are outstanding requests. |
|
// Remove Stopping status |
|
// 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( |
|
providerModule, removeStatus, appendStatus); |
|
} |
|
} |
|
} |
|
catch (Exception& e) |
|
{ |
|
// Get the OperationalStatus property from the provider module |
|
Array<Uint16> operationalStatus; |
|
CIMValue itValue = dmReq->providerModule.getProperty( |
|
dmReq->providerModule.findProperty("OperationalStatus")) |
|
.getValue(); |
|
itValue.get(operationalStatus); |
| |
PEGASUS_ASSERT(p != 0); |
delete response; |
| |
nameSpace = p->nameSpace.getString(); |
response = new CIMDisableModuleResponseMessage( |
//className = p->className.getString(); |
request->messageId, |
|
CIMException(CIM_ERR_FAILED, e.getMessage()), |
|
request->queueIds.copyAndPop(), |
|
operationalStatus); |
} | } |
|
} |
break; |
else |
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
{ | { |
const CIMEnumerateInstancesRequestMessage * p = dynamic_cast<const CIMEnumerateInstancesRequestMessage *>(message); |
response = _processMessage(request); |
|
} |
|
|
|
AsyncLegacyOperationResult * async_result = |
|
new AsyncLegacyOperationResult( |
|
op, |
|
response); |
| |
PEGASUS_ASSERT(p != 0); |
_complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0); |
| |
nameSpace = p->nameSpace.getString(); |
PEG_METHOD_EXIT(); |
className = p->className.getString(); |
|
} | } |
| |
break; |
void ProviderManagerService::responseChunkCallback( |
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
CIMRequestMessage* request, |
|
CIMResponseMessage* response) |
{ | { |
const CIMEnumerateInstanceNamesRequestMessage * p = dynamic_cast<const CIMEnumerateInstanceNamesRequestMessage *>(message); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::responseChunkCallback"); |
| |
PEGASUS_ASSERT(p != 0); |
try |
|
{ |
|
// only incomplete messages are processed because the caller ends up |
|
// sending the complete() stage |
|
PEGASUS_ASSERT(response->isComplete() == false); |
|
|
|
AsyncLegacyOperationStart *requestAsync = |
|
dynamic_cast<AsyncLegacyOperationStart *>(request->_async); |
|
PEGASUS_ASSERT(requestAsync); |
|
AsyncOpNode *op = requestAsync->op; |
|
PEGASUS_ASSERT(op); |
|
PEGASUS_ASSERT(!response->_async); |
|
response->_async = new AsyncLegacyOperationResult( |
|
op, response); |
|
|
|
// set the destination |
|
op->_op_dest = op->_callback_response_q; |
|
|
|
MessageQueueService *service = |
|
dynamic_cast<MessageQueueService *>(op->_callback_response_q); |
|
|
|
PEGASUS_ASSERT(service); |
|
|
|
// the last chunk MUST be sent last, so use execute the callback |
|
// not all chunks are going through the dispatcher's chunk |
|
// resequencer, so this must be a synchronous call here |
|
// After the call is done, response and asyncResponse are now invalid |
|
// as they have been sent and deleted externally |
|
|
|
op->_async_callback(op, service, op->_callback_ptr); |
|
} |
|
catch(Exception &e) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Exception in ProviderManagerService::responseChunkCallback: " + |
|
e.getMessage() + ". Chunk not delivered."); |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Exception in ProviderManagerService::responseChunkCallback. " |
|
"Chunk not delivered."); |
|
} |
| |
nameSpace = p->nameSpace.getString(); |
PEG_METHOD_EXIT(); |
className = p->className.getString(); |
|
} | } |
| |
break; |
Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) |
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
|
{ | { |
const CIMCreateInstanceRequestMessage * p = dynamic_cast<const CIMCreateInstanceRequestMessage *>(message); |
Message* response = 0; |
|
|
PEGASUS_ASSERT(p != 0); |
|
| |
nameSpace = p->nameSpace.getString(); |
if ((request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) || |
//className = p->className.getString(); |
(request->getType() == |
|
CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE) || |
|
(request->getType() == CIM_NOTIFY_CONFIG_CHANGE_REQUEST_MESSAGE)) |
|
{ |
|
if (_basicProviderManagerRouter) |
|
{ |
|
response = _basicProviderManagerRouter->processMessage(request); |
} | } |
| |
break; |
if (_oopProviderManagerRouter) |
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
|
{ | { |
const CIMModifyInstanceRequestMessage * p = dynamic_cast<const CIMModifyInstanceRequestMessage *>(message); |
// Note: These responses do not contain interesting data, so just |
|
// use the last one. |
PEGASUS_ASSERT(p != 0); |
delete response; |
| |
nameSpace = p->nameSpace.getString(); |
response = _oopProviderManagerRouter->processMessage(request); |
//className = p->className.getString(); |
|
} | } |
|
} |
|
else |
|
{ |
|
CIMInstance providerModule; |
| |
break; |
if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
{ |
|
CIMEnableModuleRequestMessage* emReq = |
|
dynamic_cast<CIMEnableModuleRequestMessage*>(request); |
|
providerModule = emReq->providerModule; |
|
} |
|
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) |
|
{ |
|
CIMDisableModuleRequestMessage* dmReq = |
|
dynamic_cast<CIMDisableModuleRequestMessage*>(request); |
|
providerModule = dmReq->providerModule; |
|
} |
|
else |
|
{ |
|
ProviderIdContainer pidc = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
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) |
{ | { |
const CIMDeleteInstanceRequestMessage * p = dynamic_cast<const CIMDeleteInstanceRequestMessage *>(message); |
return response; |
|
} |
|
} |
|
#endif |
|
} |
| |
PEGASUS_ASSERT(p != 0); |
Uint16 userContext = PEGASUS_DEFAULT_PROV_USERCTXT; |
|
Uint32 pos = providerModule.findProperty( |
|
PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT); |
|
if (pos != PEG_NOT_FOUND) |
|
{ |
|
providerModule.getProperty(pos).getValue().get(userContext); |
|
} |
|
|
|
// Forward the request to the appropriate ProviderManagerRouter, based |
|
// on the CIM Server configuration and the UserContext setting. |
|
|
|
ConfigManager* configManager = ConfigManager::getInstance(); |
|
Boolean forceProviderProcesses = String::equal( |
|
configManager->getCurrentValue("forceProviderProcesses"), "true"); |
|
|
|
if (forceProviderProcesses |
|
#ifndef PEGASUS_DISABLE_PROV_USERCTXT |
|
|| (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) |
|
|| (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED) |
|
|| ((userContext == PG_PROVMODULE_USERCTXT_PRIVILEGED) && |
|
!System::isPrivilegedUser(System::getEffectiveUserName())) |
|
#endif |
|
) |
|
{ |
|
response = _oopProviderManagerRouter->processMessage(request); |
|
} |
|
else |
|
{ |
|
response = _basicProviderManagerRouter->processMessage(request); |
|
} |
|
} |
| |
nameSpace = p->nameSpace.getString(); |
return response; |
//className = p->className.getString(); |
|
} | } |
| |
break; |
void ProviderManagerService::unloadIdleProviders() |
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
|
break; |
|
case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
|
{ | { |
const CIMAssociatorsRequestMessage * p = dynamic_cast<const CIMAssociatorsRequestMessage *>(message); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::unloadIdleProviders"); |
PEGASUS_ASSERT(p != 0); |
ThreadStatus rtn = PEGASUS_THREAD_OK; |
|
// Ensure that only one _unloadIdleProvidersHandler thread runs at a time |
|
_unloadIdleProvidersBusy++; |
|
if ((_unloadIdleProvidersBusy.get() == 1) && |
|
((rtn = _thread_pool->allocate_and_awaken( |
|
(void*)this, ProviderManagerService::_unloadIdleProvidersHandler))==PEGASUS_THREAD_OK)) |
|
{ |
|
// _unloadIdleProvidersBusy is decremented in |
|
// _unloadIdleProvidersHandler |
|
} |
|
else |
|
{ |
|
// If we fail to allocate a thread, don't retry now. |
|
_unloadIdleProvidersBusy--; |
|
} |
|
if (rtn != PEGASUS_THREAD_OK) |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"Not enough threads to unload idle providers."); |
| |
nameSpace = p->nameSpace.getString(); |
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
//className = p->className.getString(); |
"Could not allocate thread for %s to unload idle providers.", |
|
getQueueName()); |
|
} |
|
PEG_METHOD_EXIT(); |
} | } |
| |
break; |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw() |
|
{ |
|
try |
{ | { |
const CIMAssociatorNamesRequestMessage * p = dynamic_cast<const CIMAssociatorNamesRequestMessage *>(message); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::unloadIdleProvidersHandler"); |
| |
PEGASUS_ASSERT(p != 0); |
ProviderManagerService* myself = |
|
reinterpret_cast<ProviderManagerService*>(arg); |
| |
nameSpace = p->nameSpace.getString(); |
if (myself->_basicProviderManagerRouter) |
//className = p->className.getString(); |
{ |
|
try |
|
{ |
|
myself->_basicProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"BasicProviderManagerRouter::_unloadIdleProviders"); |
|
} |
} | } |
| |
break; |
if (myself->_oopProviderManagerRouter) |
case CIM_REFERENCES_REQUEST_MESSAGE: |
{ |
|
try |
|
{ |
|
myself->_oopProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
{ | { |
const CIMReferencesRequestMessage * p = dynamic_cast<const CIMReferencesRequestMessage *>(message); |
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"OOPProviderManagerRouter::_unloadIdleProviders"); |
|
} |
|
} |
| |
PEGASUS_ASSERT(p != 0); |
myself->_unloadIdleProvidersBusy--; |
|
PEG_METHOD_EXIT(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception in _unloadIdleProvidersHandler"); |
|
} |
| |
nameSpace = p->nameSpace.getString(); |
return(PEGASUS_THREAD_RETURN(0)); |
//className = p->className.getString(); |
|
} | } |
| |
break; |
// Updates the providerModule instance and the ProviderRegistrationManager |
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
// |
|
// 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( |
|
CIMInstance& providerModule, |
|
const Array<Uint16>& removeStatus, |
|
const Array<Uint16>& appendStatus) |
{ | { |
const CIMReferenceNamesRequestMessage * p = dynamic_cast<const CIMReferenceNamesRequestMessage *>(message); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::_updateProviderModuleStatus"); |
| |
PEGASUS_ASSERT(p != 0); |
Array<Uint16> operationalStatus; |
|
String providerModuleName; |
| |
nameSpace = p->nameSpace.getString(); |
Uint32 pos = providerModule.findProperty(CIMName("Name")); |
//className = p->className.getString(); |
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
providerModule.getProperty(pos).getValue().get(providerModuleName); |
|
|
|
// |
|
// get operational status |
|
// |
|
pos = providerModule.findProperty(CIMName("OperationalStatus")); |
|
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
CIMProperty operationalStatusProperty = providerModule.getProperty(pos); |
|
|
|
if (_providerRegistrationManager->updateProviderModuleStatus( |
|
providerModuleName, removeStatus, appendStatus, operationalStatus) == |
|
false) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService." |
|
"SET_MODULE_STATUS_FAILED", |
|
"set module status failed.")); |
} | } |
| |
break; |
operationalStatusProperty.setValue(CIMValue(operationalStatus)); |
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
|
{ |
|
const CIMGetPropertyRequestMessage * p = dynamic_cast<const CIMGetPropertyRequestMessage *>(message); |
|
| |
PEGASUS_ASSERT(p != 0); |
PEG_METHOD_EXIT(); |
|
} |
| |
nameSpace = p->nameSpace.getString(); |
void ProviderManagerService::indicationCallback( |
//className = p->className.getString(); |
CIMProcessIndicationRequestMessage* request) |
|
{ |
|
if(request->operationContext.contains(AcceptLanguageListContainer::NAME)) |
|
{ |
|
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
|
} |
|
else |
|
{ |
|
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguageList())); |
} | } |
| |
break; |
if (_indicationServiceQueueId == PEG_NOT_FOUND) |
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
{ | { |
const CIMSetPropertyRequestMessage * p = dynamic_cast<const CIMSetPropertyRequestMessage *>(message); |
Array<Uint32> serviceIds; |
| |
PEGASUS_ASSERT(p != 0); |
providerManagerService->find_services( |
|
PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds); |
|
PEGASUS_ASSERT(serviceIds.size() != 0); |
| |
nameSpace = p->nameSpace.getString(); |
_indicationServiceQueueId = serviceIds[0]; |
//className = p->className.getString(); |
|
} | } |
| |
break; |
request->queueIds = QueueIdStack( |
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
_indicationServiceQueueId, providerManagerService->getQueueId()); |
{ |
|
const CIMInvokeMethodRequestMessage * p = dynamic_cast<const CIMInvokeMethodRequestMessage *>(message); |
|
| |
PEGASUS_ASSERT(p != 0); |
AsyncLegacyOperationStart * asyncRequest = |
|
new AsyncLegacyOperationStart( |
|
0, |
|
_indicationServiceQueueId, |
|
request, |
|
_indicationServiceQueueId); |
| |
nameSpace = p->nameSpace.getString(); |
providerManagerService->SendForget(asyncRequest); |
//className = p->className.getString(); |
|
} |
|
| |
break; |
|
/* |
|
case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
|
{ |
|
const CIMEnableIndicationsSubscriptionRequestMessage * p = dynamic_cast<const CIMEnableIndicationsRequestMessage *>(message); |
|
| |
PEGASUS_ASSERT(p != 0); |
|
| |
nameSpace = p->nameSpace.getString(); |
|
className = p->className.getString(); |
|
} |
|
| |
break; |
#ifdef PEGASUS_INDICATIONS_Q_THRESHOLD |
case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
|
{ |
|
const CIMModifyIndicationsRequestMessage * p = dynamic_cast<const CIMModifyIndicationsRequestMessage *>(message); |
|
| |
PEGASUS_ASSERT(p != 0); |
// 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 |
| |
nameSpace = p->nameSpace.getString(); |
static Mutex indicationThresholdReportedLock; |
className = p->className.getString(); |
static Boolean indicationThresholdReported = false; |
} |
|
| |
break; |
#define INDICATIONS_Q_STALL_THRESHOLD PEGASUS_INDICATIONS_Q_THRESHOLD |
case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
#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) |
{ | { |
const CIMGetClassRequestMessage * p = dynamic_cast<const CIMGetClassRequestMessage *>(message); |
AutoMutex indicationThresholdReportedAutoMutex(indicationThresholdReportedLock); |
|
if (!indicationThresholdReported) |
|
{ |
|
indicationThresholdReported = true; |
|
indicationThresholdReportedAutoMutex.unlock(); |
| |
PEGASUS_ASSERT(p != 0); |
// make log entry to record que max exceeded |
| |
nameSpace = p->nameSpace.getString(); |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
className = p->className.getString(); |
"Indication generation stalled: maximum queue count ($0) exceeded.", |
|
INDICATIONS_Q_STALL_THRESHOLD); |
|
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex.unlock(); |
} | } |
| |
break; |
while (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_RESUME_THRESHOLD) |
*/ |
{ |
default: |
pegasus_sleep(INDICATIONS_Q_STALL_DURATION); |
break; |
|
} | } |
| |
ProviderName name( |
AutoMutex indicationThresholdReportedAutoMutex1(indicationThresholdReportedLock); |
CIMObjectPath(String::EMPTY, nameSpace, className).toString(), |
// indicationThresholdReportedLock.lock(pegasus_thread_self()); |
String::EMPTY, |
if(indicationThresholdReported) |
String::EMPTY, |
{ |
String::EMPTY, |
indicationThresholdReported = false; |
0); |
indicationThresholdReportedAutoMutex1.unlock(); |
| |
// find provider manager |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
name = ProviderRegistrar().findProvider(name); |
"Indication generation resumed: current queue count = $0", |
|
((MessageQueueService *)indicationsQueue)->getIncomingCount() ); |
| |
// find provider manager for provider interface |
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex1.unlock(); |
|
} |
|
} |
|
#endif /* INDICATIONS_Q_STALL_THRESHOLD */ |
| |
|
} |
| |
try |
void ProviderManagerService::providerModuleFailureCallback |
|
(const String & moduleName, |
|
const String & userName, |
|
Uint16 userContext) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_METHOD_ENTER (TRC_PROVIDERMANAGER, |
"ProviderManagerService::handleCimRequest() passing control to provider manager."); |
"ProviderManagerService::providerModuleFailureCallback"); |
| |
// forward request |
if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) |
response = _providerManagers[0].getProviderManager().processMessage(request); |
|
} |
|
catch(...) |
|
{ | { |
// ATTN: create response with error message |
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); |
} | } |
| |
// preserve message key |
// |
response->setKey(request->getKey()); |
// Create Notify Provider Fail request message |
|
// |
// set HTTP method in response from request |
CIMNotifyProviderFailRequestMessage * request = |
response->setHttpMethod(request->getHttpMethod()); |
new CIMNotifyProviderFailRequestMessage |
|
(XmlWriter::getNextMessageId (), |
|
moduleName, |
|
userName, |
|
QueueIdStack ()); |
| |
AsyncLegacyOperationResult * async_result = |
// |
new AsyncLegacyOperationResult( |
// Send Notify Provider Fail request message to Indication Service |
async->getKey(), |
// |
async->getRouting(), |
if (_indicationServiceQueueId == PEG_NOT_FOUND) |
op, |
{ |
response); |
Array <Uint32> serviceIds; |
| |
_complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0); |
providerManagerService->find_services |
|
(PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds); |
|
PEGASUS_ASSERT (serviceIds.size () != 0); |
| |
PEG_METHOD_EXIT(); |
_indicationServiceQueueId = serviceIds [0]; |
} | } |
| |
void ProviderManagerService::unload_idle_providers(void) |
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()); |
} | } |
| |
PEGASUS_NAMESPACE_END |
// |
|
// 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 |