version 1.6, 2003/08/21 19:36:25
|
version 1.89, 2006/08/08 17:47:13
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%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> |
// ATTN: this section is a temporary solution to populate the list of enabled |
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
// provider managers for a given distribution. it includes another temporary |
|
// solution for converting a generic file name into a file name useable by |
|
// each platform. |
|
|
|
// BEGIN TEMP SECTION |
|
String _resolveFileName(const String & fileName) |
|
{ |
|
String temp; |
|
|
|
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
temp = fileName + String(".dll"); |
|
#elif defined(PEGASUS_OS_HPUX) && defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
|
temp = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
temp.append(String("/lib") + fileName + String(".sl")); |
|
#elif defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
|
temp = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
temp.append(String("/lib") + fileName + String(".so")); |
|
#elif defined(PEGASUS_OS_OS400) |
|
temp = fileName; |
|
#else |
|
temp = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
temp.append(String("/lib") + fileName + String(".so")); |
|
#endif |
|
|
|
return(temp); |
|
} |
|
|
|
Array<Pair<String, String> > _initializeFileNames(void) |
|
{ |
|
Array<Pair<String, String> > temp; |
|
|
|
#if defined(ENABLE_DEFAULT_PROVIDER_MANAGER) |
|
temp.append(Pair<String, String>(_resolveFileName("DefaultProviderManager"), String("DEFAULT"))); |
|
#endif |
|
| |
#if defined(ENABLE_CMPI_PROVIDER_MANAGER) |
PEGASUS_NAMESPACE_BEGIN |
temp.append(Pair<String, String>(_resolveFileName("CMPIProviderManager"), String("CMPI"))); |
|
#endif |
|
|
|
return(temp); |
|
} |
|
|
|
static const Array<Pair<String,String> > _fileNames = _initializeFileNames(); |
|
// END TEMP SECTION |
|
| |
inline Boolean _isSupportedRequestType(const Message * message) | inline Boolean _isSupportedRequestType(const Message * message) |
{ | { |
Boolean rc = false; |
// ATTN: needs implementation |
| |
if(message == 0) |
// for now, assume all requests are valid |
{ |
|
return(rc); |
|
} |
|
|
|
/* |
|
// ATTN : need to determine valid request message types |
|
// before enabling. |
|
|
|
switch(message->getType()) |
|
{ |
|
case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
|
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
|
case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
|
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
|
case CIM_REFERENCES_REQUEST_MESSAGE: |
|
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
|
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
|
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
|
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
|
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
|
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
case CIM_CONSUME_INDICATION_REQUEST_MESSAGE: |
|
rc = true; |
|
| |
break; |
return(true); |
default: |
|
rc = false; |
|
|
|
break; |
|
} |
|
*/ |
|
|
|
rc = true; |
|
|
|
return(rc); |
|
} | } |
| |
inline Boolean _isSupportedResponseType(const Message * message) | inline Boolean _isSupportedResponseType(const Message * message) |
{ | { |
Boolean rc = false; |
// ATTN: needs implementation |
| |
return(rc); |
// for now, assume all responses are invalid |
} |
|
| |
ProviderManagerService::ProviderManagerService(void) |
return(false); |
: MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) |
|
{ |
|
} | } |
| |
ProviderManagerService::ProviderManagerService(ProviderRegistrationManager * providerRegistrationManager) |
ProviderManagerService* ProviderManagerService::providerManagerService=NULL; |
|
Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; |
|
|
|
ProviderManagerService::ProviderManagerService( |
|
ProviderRegistrationManager * providerRegistrationManager, |
|
CIMRepository * repository, |
|
ProviderManager* (*createDefaultProviderManagerCallback)()) |
: MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) | : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) |
{ | { |
for(Uint32 i = 0, n = _fileNames.size(); i < n; i++) |
providerManagerService=this; |
{ |
_repository=repository; |
String message; |
|
| |
message = "ProviderManagerService::ProviderManagerService() loading " + |
_providerRegistrationManager = providerRegistrationManager; |
_fileNames[i].first + "(" + _fileNames[i].second + ")"; |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, message); |
_unloadIdleProvidersBusy = 0; |
|
|
try |
|
{ |
|
ProviderManagerModule module(_fileNames[i].first); |
|
| |
if(module.load() == false) |
_basicProviderManagerRouter = 0; |
{ |
_oopProviderManagerRouter = 0; |
throw 0; // ATTN: inefficient |
|
} |
|
| |
ProviderManager * manager = module.getProviderManager(_fileNames[i].second); |
// Determine which ProviderManagerRouter(s) to use |
| |
if(manager == 0) |
_forceProviderProcesses = ConfigManager::parseBooleanValue( |
{ |
ConfigManager::getInstance()->getCurrentValue( |
throw 0; // ATTN: inefficient |
"forceProviderProcesses")); |
} |
|
| |
// ATTN: only set the hacked/cached provider registration manager pointer after the |
#ifdef PEGASUS_DISABLE_PROV_USERCTXT |
// DEFAULT provider manager is loaded. |
if (_forceProviderProcesses) |
if(String::equalNoCase(_fileNames[i].second, "DEFAULT")) |
|
{ | { |
manager->setProviderRegistrationManager(providerRegistrationManager); |
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
providerModuleFailureCallback); |
} | } |
|
else |
_providerManagers.append(Pair<ProviderManager *, ProviderManagerModule>(manager, module)); |
|
} |
|
catch(...) |
|
{ | { |
message = "ProviderManagerService::ProviderManagerService() exception loading " + |
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
_fileNames[i].first + "(" + _fileNames[i].second + ")"; |
indicationCallback, responseChunkCallback, |
|
createDefaultProviderManagerCallback); |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, message); |
|
} | } |
|
#else |
|
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
providerModuleFailureCallback); |
|
|
|
if (!_forceProviderProcesses) |
|
{ |
|
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
createDefaultProviderManagerCallback); |
} | } |
|
#endif |
} | } |
| |
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 |
|
ProviderManagerService::handleCimOperation(void* arg) |
{ | { |
// get the service from argument |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg); |
"ProviderManagerService::handleCimOperation"); |
|
|
PEGASUS_ASSERT(service != 0); |
|
| |
// get message from service queue |
PEGASUS_ASSERT(arg != 0); |
Message * message = service->_incomingQueue.dequeue(); |
|
| |
PEGASUS_ASSERT(message != 0); |
// get the service from argument |
|
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 ); | PEGASUS_ASSERT(op != 0 ); |
|
PEGASUS_ASSERT(op->_request.get() != 0); |
| |
if(op->_request.count() == 0) |
AsyncRequest* request = |
|
static_cast<AsyncRequest*>(op->_request.get()); |
|
|
|
if ((request == 0) || |
|
(request->getType() != async_messages::ASYNC_LEGACY_OP_START)) |
{ | { |
MessageQueue * queue = MessageQueue::lookup(op->_source_queue); |
// reply with NAK |
|
PEG_METHOD_EXIT(); |
|
return(PEGASUS_THREAD_RETURN(0)); |
|
} |
| |
PEGASUS_ASSERT(queue != 0); |
Message* legacy = |
|
static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
|
|
|
if(_isSupportedRequestType(legacy)) |
|
{ |
|
AutoPtr<Message> xmessage(legacy); |
|
|
|
// Set the client's requested language into this service thread. |
|
// This will allow functions in this service to return messages |
|
// in the correct language. |
|
CIMMessage* msg = dynamic_cast<CIMMessage *>(legacy); |
|
|
|
if (msg != 0) |
|
{ |
|
AcceptLanguageList* langs = new AcceptLanguageList( |
|
((AcceptLanguageListContainer)msg->operationContext.get( |
|
AcceptLanguageListContainer::NAME)).getLanguages()); |
|
Thread::setLanguages(langs); |
|
} |
|
else |
|
{ |
|
Thread::clearLanguages(); |
|
} |
|
|
|
service->handleCimRequest(op, legacy); |
|
} |
|
} |
|
catch (const Exception& e) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Unexpected exception in handleCimOperation: " + e.getMessage()); |
|
} |
|
catch (...) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Unexpected exception in handleCimOperation."); |
|
} |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
// no request in op node |
return(PEGASUS_THREAD_RETURN(0)); |
return(PEGASUS_THREAD_RETURN(1)); |
|
} | } |
| |
return(0); |
void ProviderManagerService::handleCimRequest( |
|
AsyncOpNode * op, |
|
Message * message) |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::handleCimRequest"); |
|
|
|
CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message); |
|
PEGASUS_ASSERT(request != 0); |
|
|
|
// get request from op node |
|
AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.get()); |
|
PEGASUS_ASSERT(async != 0); |
|
|
|
Message * response = 0; |
|
Boolean consumerLookupFailed = false; |
|
|
|
if (request->getType() == CIM_EXPORT_INDICATION_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)) |
|
{ |
|
request->operationContext.insert( |
|
ProviderIdContainer(providerModule, provider)); |
|
} |
|
else |
|
{ |
|
consumerLookupFailed = true; |
|
} |
} | } |
*/ |
|
| |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleCimOperation(void * arg) throw() |
if (consumerLookupFailed) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimOperation"); |
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.) |
| |
// get the service from argument |
// |
ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg); |
// Get the provider module instance to check for a disabled module |
|
// |
|
CIMInstance providerModule; |
| |
PEGASUS_ASSERT(service != 0); |
// The provider ID container is added to the OperationContext |
|
// 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(); |
| |
if(service->_incomingQueue.size() == 0) |
// |
|
// 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++) |
|
{ |
|
if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) || |
|
(operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
moduleDisabled = true; |
"ProviderManagerService::handleCimOperation() called with no op node in queue" ); |
break; |
|
} |
|
} |
| |
PEG_METHOD_EXIT(); |
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; |
| |
// thread started with no message in queue. |
STAT_COPYDISPATCHER |
return(PEGASUS_THREAD_RETURN(1)); |
|
} | } |
|
else |
|
{ |
|
// |
|
// Forward the request to the appropriate ProviderManagerRouter |
|
// |
|
response = _processMessage(request); |
|
} |
|
} |
|
else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
|
{ |
|
// Handle CIMEnableModuleRequestMessage |
|
CIMEnableModuleRequestMessage * emReq = |
|
dynamic_cast<CIMEnableModuleRequestMessage*>(request); |
| |
AsyncOpNode * op = service->_incomingQueue.dequeue(); |
CIMInstance providerModule = emReq->providerModule; |
| |
PEGASUS_ASSERT(op != 0 ); |
try |
|
{ |
|
// Forward the request to the ProviderManager |
|
response = _processMessage(request); |
| |
if(op->_request.count() == 0) |
// If successful, update provider module status to OK |
|
// 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) |
{ | { |
MessageQueue * queue = MessageQueue::lookup(op->_source_queue); |
// 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(queue != 0); |
delete response; |
| |
PEG_METHOD_EXIT(); |
response = new CIMEnableModuleResponseMessage( |
|
request->messageId, |
|
CIMException(CIM_ERR_FAILED, e.getMessage()), |
|
request->queueIds.copyAndPop(), |
|
operationalStatus); |
|
} |
|
} |
|
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) |
|
{ |
|
// Handle CIMDisableModuleRequestMessage |
|
CIMDisableModuleRequestMessage * dmReq = |
|
dynamic_cast<CIMDisableModuleRequestMessage*>(request); |
| |
// no request in op node |
CIMInstance providerModule = dmReq->providerModule; |
return(PEGASUS_THREAD_RETURN(1)); |
Boolean updateModuleStatus = !dmReq->disableProviderOnly; |
|
|
|
try |
|
{ |
|
// |
|
// 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); |
} | } |
| |
AsyncRequest * request = static_cast<AsyncRequest *>(op->_request.next(0)); |
// Forward the request to the ProviderManager |
|
response = _processMessage(request); |
| |
PEGASUS_ASSERT(request != 0); |
// Update provider module status based on success or failure |
|
if (updateModuleStatus) |
|
{ |
|
CIMDisableModuleResponseMessage * dmResp = |
|
dynamic_cast<CIMDisableModuleResponseMessage*>(response); |
|
if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS) |
|
{ |
|
// |
|
// 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); |
|
|
|
delete response; |
|
|
|
response = new CIMDisableModuleResponseMessage( |
|
request->messageId, |
|
CIMException(CIM_ERR_FAILED, e.getMessage()), |
|
request->queueIds.copyAndPop(), |
|
operationalStatus); |
|
} |
|
} |
|
else |
|
{ |
|
response = _processMessage(request); |
|
} |
|
|
|
AsyncLegacyOperationResult * async_result = |
|
new AsyncLegacyOperationResult( |
|
op, |
|
response); |
| |
if(request->getType() != async_messages::ASYNC_LEGACY_OP_START) |
_complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0); |
|
|
|
PEG_METHOD_EXIT(); |
|
} |
|
|
|
void ProviderManagerService::responseChunkCallback( |
|
CIMRequestMessage* request, |
|
CIMResponseMessage* response) |
{ | { |
// reply with NAK |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::responseChunkCallback"); |
|
|
|
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."); |
|
} |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
} |
| |
return(PEGASUS_THREAD_RETURN(0)); |
Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) |
|
{ |
|
Message* response = 0; |
|
|
|
if ((request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) || |
|
(request->getType() == |
|
CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE) || |
|
(request->getType() == CIM_NOTIFY_CONFIG_CHANGE_REQUEST_MESSAGE)) |
|
{ |
|
if (_basicProviderManagerRouter) |
|
{ |
|
response = _basicProviderManagerRouter->processMessage(request); |
} | } |
| |
Message * legacy = static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
if (_oopProviderManagerRouter) |
|
{ |
|
// Note: These responses do not contain interesting data, so just |
|
// use the last one. |
|
delete response; |
| |
if(_isSupportedRequestType(legacy)) |
response = _oopProviderManagerRouter->processMessage(request); |
|
} |
|
} |
|
else |
{ | { |
Destroyer<Message> xmessage(legacy); |
CIMInstance providerModule; |
| |
// Set the client's requested language into this service thread. |
if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
// This will allow functions in this service to return messages |
{ |
// in the correct language. |
CIMEnableModuleRequestMessage* emReq = |
CIMMessage * msg = dynamic_cast<CIMMessage *>(legacy); |
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) |
|
{ |
|
return response; |
|
} |
|
} |
|
#endif |
|
} |
| |
if(msg != 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. |
|
|
|
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 |
{ | { |
AcceptLanguages * langs = new AcceptLanguages(msg->acceptLanguages); |
response = _basicProviderManagerRouter->processMessage(request); |
|
} |
|
} |
| |
Thread::setLanguages(langs); |
return response; |
|
} |
|
|
|
void ProviderManagerService::unloadIdleProviders() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::unloadIdleProviders"); |
|
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 | else |
{ | { |
Thread::clearLanguages(); |
// 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."); |
| |
|
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Could not allocate thread for %s to unload idle providers.", |
|
getQueueName()); |
|
} |
|
PEG_METHOD_EXIT(); |
|
} |
|
|
|
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
|
ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw() |
|
{ |
try | try |
{ | { |
service->handleCimRequest(op, legacy); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::unloadIdleProvidersHandler"); |
|
|
|
ProviderManagerService* myself = |
|
reinterpret_cast<ProviderManagerService*>(arg); |
|
|
|
if (myself->_basicProviderManagerRouter) |
|
{ |
|
try |
|
{ |
|
myself->_basicProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"BasicProviderManagerRouter::_unloadIdleProviders"); |
|
} |
|
} |
|
|
|
if (myself->_oopProviderManagerRouter) |
|
{ |
|
try |
|
{ |
|
myself->_oopProviderManagerRouter->unloadIdleProviders(); |
} | } |
catch(...) | catch(...) |
{ | { |
// ATTN: log error |
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"OOPProviderManagerRouter::_unloadIdleProviders"); |
} | } |
} | } |
| |
|
myself->_unloadIdleProvidersBusy--; |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception in _unloadIdleProvidersHandler"); |
|
} |
| |
return(PEGASUS_THREAD_RETURN(0)); | return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
void ProviderManagerService::handleCimRequest(AsyncOpNode * op, const Message * message) throw() |
// 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( |
|
CIMInstance& providerModule, |
|
const Array<Uint16>& removeStatus, |
|
const Array<Uint16>& appendStatus) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::_updateProviderModuleStatus"); |
| |
// ATTN: ensure message is a request??? |
Array<Uint16> operationalStatus; |
CIMMessage * request = dynamic_cast<CIMMessage *>(const_cast<Message *>(message)); |
String providerModuleName; |
| |
// get request from op node |
Uint32 pos = providerModule.findProperty(CIMName("Name")); |
AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0)); |
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
providerModule.getProperty(pos).getValue().get(providerModuleName); |
| |
PEGASUS_ASSERT((request != 0) && (async != 0)); |
// |
|
// 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.")); |
|
} |
| |
Message * response = 0; |
operationalStatusProperty.setValue(CIMValue(operationalStatus)); |
| |
// find provider manager |
PEG_METHOD_EXIT(); |
// ATTN: implement efficient lookup |
} |
ProviderManager * manager = _providerManagers[0].first; |
|
| |
try |
void ProviderManagerService::indicationCallback( |
|
CIMProcessIndicationRequestMessage* request) |
|
{ |
|
if(request->operationContext.contains(AcceptLanguageListContainer::NAME)) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
"ProviderManagerService::handleCimRequest() passing control to provider manager."); |
} |
|
else |
|
{ |
|
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguageList())); |
|
} |
|
|
|
if (_indicationServiceQueueId == PEG_NOT_FOUND) |
|
{ |
|
Array<Uint32> serviceIds; |
| |
// forward request |
providerManagerService->find_services( |
response = manager->processMessage(request); |
PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds); |
|
PEGASUS_ASSERT(serviceIds.size() != 0); |
|
|
|
_indicationServiceQueueId = serviceIds[0]; |
} | } |
catch(...) |
|
|
request->queueIds = QueueIdStack( |
|
_indicationServiceQueueId, providerManagerService->getQueueId()); |
|
|
|
AsyncLegacyOperationStart * asyncRequest = |
|
new AsyncLegacyOperationStart( |
|
0, |
|
_indicationServiceQueueId, |
|
request, |
|
_indicationServiceQueueId); |
|
|
|
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) |
{ | { |
// ATTN: create response with error message |
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(); |
} | } |
| |
// preserve message key |
while (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_RESUME_THRESHOLD) |
response->setKey(request->getKey()); |
{ |
|
pegasus_sleep(INDICATIONS_Q_STALL_DURATION); |
|
} |
| |
// set HTTP method in response from request |
AutoMutex indicationThresholdReportedAutoMutex1(indicationThresholdReportedLock); |
response->setHttpMethod(request->getHttpMethod()); |
// indicationThresholdReportedLock.lock(pegasus_thread_self()); |
|
if(indicationThresholdReported) |
|
{ |
|
indicationThresholdReported = false; |
|
indicationThresholdReportedAutoMutex1.unlock(); |
| |
AsyncLegacyOperationResult * async_result = |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
new AsyncLegacyOperationResult( |
"Indication generation resumed: current queue count = $0", |
async->getKey(), |
((MessageQueueService *)indicationsQueue)->getIncomingCount() ); |
async->getRouting(), |
|
op, |
|
response); |
|
| |
_complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0); |
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex1.unlock(); |
|
} |
|
} |
|
#endif /* INDICATIONS_Q_STALL_THRESHOLD */ |
| |
PEG_METHOD_EXIT(); |
|
} | } |
| |
void ProviderManagerService::unload_idle_providers(void) |
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 |