version 1.39, 2004/05/18 23:58:41
|
version 1.84, 2006/07/14 20:12:49
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // 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 |
|
|
// Adrian Schuur, IBM (schuur@de.ibm.com) | // Adrian Schuur, IBM (schuur@de.ibm.com) |
// Amit K Arora (amita@in.ibm.com) for PEP-101 | // Amit K Arora (amita@in.ibm.com) for PEP-101 |
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Seema Gupta (gseema@in.ibm.com for PEP135) |
|
// 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/Thread.h> |
|
|
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
| |
#include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> | #include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> |
|
#include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h> |
|
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
static const Uint16 _MODULE_OK = 2; |
|
static const Uint16 _MODULE_STOPPING = 9; |
|
static const Uint16 _MODULE_STOPPED = 10; |
|
|
|
inline Boolean _isSupportedRequestType(const Message * message) | inline Boolean _isSupportedRequestType(const Message * message) |
{ | { |
// ATTN: needs implementation | // ATTN: needs implementation |
|
|
} | } |
| |
ProviderManagerService* ProviderManagerService::providerManagerService=NULL; | ProviderManagerService* ProviderManagerService::providerManagerService=NULL; |
CIMRepository* ProviderManagerService::_repository=NULL; |
|
Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; | Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; |
| |
ProviderManagerService::ProviderManagerService(void) | ProviderManagerService::ProviderManagerService(void) |
|
|
| |
ProviderManagerService::ProviderManagerService( | ProviderManagerService::ProviderManagerService( |
ProviderRegistrationManager * providerRegistrationManager, | ProviderRegistrationManager * providerRegistrationManager, |
CIMRepository * repository) |
CIMRepository * repository, |
|
ProviderManager* (*createDefaultProviderManagerCallback)()) |
: MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) | : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) |
{ | { |
providerManagerService=this; | providerManagerService=this; |
_repository=repository; | _repository=repository; |
| |
_providerRegistrationManager = providerRegistrationManager; | _providerRegistrationManager = providerRegistrationManager; |
_providerManagerRouter = |
|
new BasicProviderManagerRouter(indicationCallback); |
_unloadIdleProvidersBusy = 0; |
|
|
|
_basicProviderManagerRouter = 0; |
|
_oopProviderManagerRouter = 0; |
|
|
|
// Determine which ProviderManagerRouter(s) to use |
|
|
|
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 |
|
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
providerModuleFailureCallback); |
|
|
|
if (!forceProviderProcesses) |
|
{ |
|
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
|
indicationCallback, responseChunkCallback, |
|
createDefaultProviderManagerCallback); |
|
} |
|
#endif |
} | } |
| |
ProviderManagerService::~ProviderManagerService(void) | ProviderManagerService::~ProviderManagerService(void) |
{ | { |
delete _providerManagerRouter; |
delete _basicProviderManagerRouter; |
|
delete _oopProviderManagerRouter; |
providerManagerService=NULL; | providerManagerService=NULL; |
} | } |
| |
|
|
{ | { |
request->op->processing(); | request->op->processing(); |
| |
_incomingQueue.enqueue(request->op); |
_incomingQueue.insert_back(request->op); |
|
ThreadStatus rtn = PEGASUS_THREAD_OK; |
while (!_thread_pool->allocate_and_awaken( |
while (( rtn =_thread_pool->allocate_and_awaken( |
(void *)this, ProviderManagerService::handleCimOperation)) |
(void *)this, ProviderManagerService::handleCimOperation)) != PEGASUS_THREAD_OK) |
{ | { |
|
if (rtn==PEGASUS_THREAD_INSUFFICIENT_RESOURCES) |
pegasus_yield(); | pegasus_yield(); |
|
else |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"Not enough threads to service provider manager." ); |
|
|
|
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Could not allocate thread for %s.", |
|
getQueueName()); |
|
break; |
|
} |
} | } |
} | } |
else | else |
|
|
return; | return; |
} | } |
| |
|
// Note: This method should not throw an exception. It is used as a thread |
|
// entry point, and any exceptions thrown are ignored. |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL | PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
ProviderManagerService::handleCimOperation(void * arg) throw() |
ProviderManagerService::handleCimOperation(void* arg) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::handleCimOperation"); | "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 = | ProviderManagerService * service = |
reinterpret_cast<ProviderManagerService *>(arg); | 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 " | "ProviderManagerService::handleCimOperation() called with no " |
"op node in queue"); | "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(); |
| |
if((op == 0) || (op->_request.count() == 0)) |
if ((op == 0) || (op->_request.size() == 0)) |
{ | { |
// ATTN: This may dereference a null pointer! | // ATTN: This may dereference a null pointer! |
MessageQueue * queue = MessageQueue::lookup(op->_source_queue); | MessageQueue * queue = MessageQueue::lookup(op->_source_queue); |
|
|
return(PEGASUS_THREAD_RETURN(1)); | return(PEGASUS_THREAD_RETURN(1)); |
} | } |
| |
AsyncRequest * request = static_cast<AsyncRequest *>(op->_request.next(0)); |
AsyncRequest* request = |
|
static_cast<AsyncRequest*>(op->_request.front()); |
| |
if ((request == 0) || | if ((request == 0) || |
(request->getType() != async_messages::ASYNC_LEGACY_OP_START)) | (request->getType() != async_messages::ASYNC_LEGACY_OP_START)) |
|
|
return(PEGASUS_THREAD_RETURN(0)); | return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
try |
|
{ |
|
Message* legacy = | Message* legacy = |
static_cast<AsyncLegacyOperationStart *>(request)->get_action(); | static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
| |
|
|
| |
if (msg != 0) | if (msg != 0) |
{ | { |
AcceptLanguages* langs = |
AcceptLanguageList* langs = new AcceptLanguageList( |
new AcceptLanguages(msg->acceptLanguages); |
((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(); |
|
|
PEGASUS_ASSERT(request != 0); | PEGASUS_ASSERT(request != 0); |
| |
// get request from op node | // get request from op node |
AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0)); |
AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.front()); |
PEGASUS_ASSERT(async != 0); | PEGASUS_ASSERT(async != 0); |
| |
Message * response = 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; |
|
} |
|
} |
|
|
|
if (consumerLookupFailed) |
|
{ |
|
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 provider module instance to check for a disabled module |
|
// |
|
CIMInstance providerModule; |
|
|
|
// 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(); |
|
|
|
// |
|
// 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); |
| |
if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
for(Uint32 i = 0; i < operationalStatus.size(); i++) |
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)) |
{ |
|
if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) || |
|
(operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)) |
{ | { |
// Handle CIMOperationRequestMessage and |
moduleDisabled = true; |
// CIMExportIndicationRequestMessage |
break; |
|
} |
|
} |
| |
// Add provider information to OperationContext for the ProviderManager |
if (moduleDisabled) |
ProviderIdContainer pidc = _getProviderIdContainer(request); |
{ |
request->operationContext.insert(pidc); |
// |
|
// 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; |
| |
response = _providerManagerRouter->processMessage(request); |
STAT_COPYDISPATCHER |
|
} |
|
else |
|
{ |
|
// |
|
// Forward the request to the appropriate ProviderManagerRouter |
|
// |
|
response = _processMessage(request); |
|
} |
} | } |
else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) | else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
{ | { |
|
|
try | try |
{ | { |
// Forward the request to the ProviderManager | // Forward the request to the ProviderManager |
response = _providerManagerRouter->processMessage(request); |
response = _processMessage(request); |
| |
// If successful, update provider module status to OK | // If successful, update provider module status to OK |
// ATTN: Use CIMEnableModuleResponseMessage operationalStatus? | // ATTN: Use CIMEnableModuleResponseMessage operationalStatus? |
|
|
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, _MODULE_STOPPED, _MODULE_OK); |
providerModule, removeStatus, appendStatus); |
} | } |
} | } |
catch (Exception& e) | catch (Exception& e) |
|
|
.getValue(); | .getValue(); |
itValue.get(operationalStatus); | itValue.get(operationalStatus); |
| |
if (response != 0) |
|
{ |
|
delete response; | delete response; |
} |
|
| |
response = new CIMEnableModuleResponseMessage( | response = new CIMEnableModuleResponseMessage( |
request->messageId, | request->messageId, |
|
|
| |
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, _MODULE_OK, _MODULE_STOPPING); |
providerModule, removeStatus, appendStatus); |
} | } |
| |
// Forward the request to the ProviderManager | // Forward the request to the ProviderManager |
response = _providerManagerRouter->processMessage(request); |
response = _processMessage(request); |
| |
// Update provider module status based on success or failure | // Update provider module status based on success or failure |
if (updateModuleStatus) | if (updateModuleStatus) |
|
|
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, _MODULE_STOPPING, _MODULE_OK); |
providerModule, removeStatus, appendStatus); |
} | } |
else | else |
{ | { |
// Disable may or may not have been successful, | // Disable may or may not have been successful, |
// depending on whether there are outstanding requests. | // depending on whether there are outstanding requests. |
// Use last operationalStatus entry. |
// Remove Stopping status |
_updateProviderModuleStatus( |
// Append status, if any, from disable module response |
providerModule, _MODULE_STOPPING, |
Array<Uint16> removeStatus; |
dmResp->operationalStatus[ |
Array<Uint16> appendStatus; |
|
removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING); |
|
if (dmResp->operationalStatus.size() > 0) |
|
{ |
|
// |
|
// On a successful disable, remove an OK or a Degraded |
|
// status, if present |
|
// |
|
if (dmResp->operationalStatus[ |
|
dmResp->operationalStatus.size()-1] == |
|
CIM_MSE_OPSTATUS_VALUE_STOPPED) |
|
{ |
|
removeStatus.append (CIM_MSE_OPSTATUS_VALUE_OK); |
|
removeStatus.append |
|
(CIM_MSE_OPSTATUS_VALUE_DEGRADED); |
|
} |
|
appendStatus.append (dmResp->operationalStatus[ |
dmResp->operationalStatus.size()-1]); | dmResp->operationalStatus.size()-1]); |
} | } |
|
_updateProviderModuleStatus( |
|
providerModule, removeStatus, appendStatus); |
|
} |
} | } |
} | } |
catch (Exception& e) | catch (Exception& e) |
|
|
.getValue(); | .getValue(); |
itValue.get(operationalStatus); | itValue.get(operationalStatus); |
| |
if (response != 0) |
|
{ |
|
delete response; | delete response; |
} |
|
| |
response = new CIMDisableModuleResponseMessage( | response = new CIMDisableModuleResponseMessage( |
request->messageId, | request->messageId, |
|
|
} | } |
else | else |
{ | { |
response = _providerManagerRouter->processMessage(request); |
response = _processMessage(request); |
} | } |
| |
AsyncLegacyOperationResult * async_result = | AsyncLegacyOperationResult * async_result = |
new AsyncLegacyOperationResult( | new AsyncLegacyOperationResult( |
async->getKey(), |
|
async->getRouting(), | async->getRouting(), |
op, | op, |
response); | response); |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void ProviderManagerService::unload_idle_providers(void) |
void ProviderManagerService::responseChunkCallback( |
{ |
CIMRequestMessage* request, |
_providerManagerRouter->unload_idle_providers(); |
CIMResponseMessage* response) |
} |
|
|
|
ProviderIdContainer ProviderManagerService::_getProviderIdContainer( |
|
const CIMRequestMessage* message) |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::_getProviderIdContainer"); |
"ProviderManagerService::responseChunkCallback"); |
| |
CIMInstance providerModule; |
try |
CIMInstance provider; |
{ |
|
// 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( |
|
requestAsync->getRouting(), 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 |
| |
switch (message->getType()) |
op->_async_callback(op, service, op->_callback_ptr); |
|
} |
|
catch(Exception &e) |
{ | { |
case CIM_GET_CLASS_REQUEST_MESSAGE: |
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
case CIM_DELETE_CLASS_REQUEST_MESSAGE: |
"Exception in ProviderManagerService::responseChunkCallback: " + |
case CIM_CREATE_CLASS_REQUEST_MESSAGE: |
e.getMessage() + ". Chunk not delivered."); |
case CIM_MODIFY_CLASS_REQUEST_MESSAGE: |
} |
case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE: |
catch(...) |
case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE: |
{ |
case CIM_GET_QUALIFIER_REQUEST_MESSAGE: |
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
case CIM_SET_QUALIFIER_REQUEST_MESSAGE: |
"Exception in ProviderManagerService::responseChunkCallback. " |
case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE: |
"Chunk not delivered."); |
case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE: |
} |
// The ProviderManagerService does not support class operations |
|
PEGASUS_ASSERT(0); |
|
break; |
|
| |
case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
PEG_METHOD_EXIT(); |
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
{ |
|
// Look up instance provider |
|
const CIMOperationRequestMessage* request = |
|
dynamic_cast<const CIMOperationRequestMessage*>(message); |
|
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule); |
|
break; |
|
} | } |
| |
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) |
{ | { |
// Look up instance query provider |
Message* response = 0; |
const CIMOperationRequestMessage* request = |
|
dynamic_cast<const CIMOperationRequestMessage*>(message); |
|
Boolean hasNoQuery; |
|
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule, |
|
0, &hasNoQuery); |
|
// We shouldn't have gotten this far if this isn't a query provider |
|
PEGASUS_ASSERT(!hasNoQuery); |
|
break; |
|
} |
|
| |
case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
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)) |
{ | { |
// Look up association provider |
if (_basicProviderManagerRouter) |
const CIMAssociatorsRequestMessage* request = |
{ |
dynamic_cast<const CIMAssociatorsRequestMessage*>(message); |
response = _basicProviderManagerRouter->processMessage(request); |
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->assocClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
if (_oopProviderManagerRouter) |
{ | { |
// Look up association provider |
// Note: These responses do not contain interesting data, so just |
const CIMAssociatorNamesRequestMessage* request = |
// use the last one. |
dynamic_cast<const CIMAssociatorNamesRequestMessage*>(message); |
delete response; |
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
response = _oopProviderManagerRouter->processMessage(request); |
_providerRegistrationManager->lookupAssociationProvider( |
} |
request->nameSpace, request->assocClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
|
else |
|
{ |
|
CIMInstance providerModule; |
| |
case CIM_REFERENCES_REQUEST_MESSAGE: |
if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
{ | { |
// Look up association provider |
CIMEnableModuleRequestMessage* emReq = |
const CIMReferencesRequestMessage* request = |
dynamic_cast<CIMEnableModuleRequestMessage*>(request); |
dynamic_cast<const CIMReferencesRequestMessage*>(message); |
providerModule = emReq->providerModule; |
Array<CIMInstance> providerModules; |
} |
Array<CIMInstance> providers; |
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) |
_providerRegistrationManager->lookupAssociationProvider( |
{ |
request->nameSpace, request->resultClass, |
CIMDisableModuleRequestMessage* dmReq = |
providers, providerModules); |
dynamic_cast<CIMDisableModuleRequestMessage*>(request); |
providerModule = providerModules[0]; |
providerModule = dmReq->providerModule; |
provider = providers[0]; |
} |
break; |
else |
|
{ |
|
ProviderIdContainer pidc = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
} | } |
| |
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
Uint16 userContext = PEGASUS_DEFAULT_PROV_USERCTXT; |
|
Uint32 pos = providerModule.findProperty( |
|
PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT); |
|
if (pos != PEG_NOT_FOUND) |
{ | { |
// Look up association provider |
providerModule.getProperty(pos).getValue().get(userContext); |
const CIMReferenceNamesRequestMessage* request = |
|
dynamic_cast<const CIMReferenceNamesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->resultClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
// 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 |
|
) |
{ | { |
// Look up method provider |
response = _oopProviderManagerRouter->processMessage(request); |
const CIMInvokeMethodRequestMessage* request = |
} |
dynamic_cast<const CIMInvokeMethodRequestMessage*>(message); |
else |
_providerRegistrationManager->lookupMethodProvider( |
{ |
request->nameSpace, request->className, request->methodName, |
response = _basicProviderManagerRouter->processMessage(request); |
provider, providerModule); |
} |
break; |
|
} | } |
| |
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
return response; |
|
} |
|
|
|
void ProviderManagerService::unloadIdleProviders() |
{ | { |
const CIMExportIndicationRequestMessage* request = |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
dynamic_cast<const CIMExportIndicationRequestMessage*>(message); |
"ProviderManagerService::unloadIdleProviders"); |
_providerRegistrationManager->lookupIndicationConsumer( |
ThreadStatus rtn = PEGASUS_THREAD_OK; |
request->destinationPath, provider, providerModule); |
// Ensure that only one _unloadIdleProvidersHandler thread runs at a time |
break; |
_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."); |
| |
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
"Could not allocate thread for %s to unload idle providers.", |
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
getQueueName()); |
case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
} |
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
PEG_METHOD_EXIT(); |
{ |
|
// Provider information is already in the message |
|
const CIMIndicationRequestMessage* request = |
|
dynamic_cast<const CIMIndicationRequestMessage*>(message); |
|
providerModule = request->providerModule; |
|
provider = request->provider; |
|
break; |
|
} | } |
| |
case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw() |
case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
{ |
case CIM_PROCESS_INDICATION_REQUEST_MESSAGE: |
try |
case CIM_HANDLE_INDICATION_REQUEST_MESSAGE: |
{ |
case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE: |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE: |
"ProviderManagerService::unloadIdleProvidersHandler"); |
// These messages are not handled by the ProviderManagerService |
|
PEGASUS_ASSERT(0); |
|
break; |
|
| |
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
ProviderManagerService* myself = |
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
reinterpret_cast<ProviderManagerService*>(arg); |
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
// These messages are handled specially by the ProviderManagerService |
if (myself->_basicProviderManagerRouter) |
PEGASUS_ASSERT(0); |
{ |
break; |
try |
|
{ |
|
myself->_basicProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"BasicProviderManagerRouter::_unloadIdleProviders"); |
|
} |
} | } |
| |
PEGASUS_ASSERT(!providerModule.isUninitialized()); |
if (myself->_oopProviderManagerRouter) |
PEGASUS_ASSERT(!provider.isUninitialized()); |
{ |
|
try |
|
{ |
|
myself->_oopProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"OOPProviderManagerRouter::_unloadIdleProviders"); |
|
} |
|
} |
| |
|
myself->_unloadIdleProvidersBusy--; |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return ProviderIdContainer(providerModule, provider); |
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception in _unloadIdleProvidersHandler"); |
|
} |
|
|
|
return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
// Updates the providerModule instance and the ProviderRegistrationManager | // Updates the providerModule instance and the ProviderRegistrationManager |
|
// |
|
// This method is used to update the provider module status when the module is |
|
// disabled or enabled. If a Degraded status has been set (appended) to the |
|
// OperationalStatus, it is cleared (removed) when the module is disabled or |
|
// enabled. |
|
// |
void ProviderManagerService::_updateProviderModuleStatus( | void ProviderManagerService::_updateProviderModuleStatus( |
CIMInstance& providerModule, | CIMInstance& providerModule, |
Uint16 fromStatus, |
const Array<Uint16>& removeStatus, |
Uint16 toStatus) |
const Array<Uint16>& appendStatus) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::_updateProviderModuleStatus"); | "ProviderManagerService::_updateProviderModuleStatus"); |
|
|
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); |
|
} |
|
} |
|
|
|
operationalStatus.append(toStatus); |
|
| |
if (_providerRegistrationManager->setProviderModuleStatus( |
if (_providerRegistrationManager->updateProviderModuleStatus( |
providerModuleName, operationalStatus) == false) |
providerModuleName, removeStatus, appendStatus, operationalStatus) == |
|
false) |
{ | { |
throw PEGASUS_CIM_EXCEPTION_L( | throw PEGASUS_CIM_EXCEPTION_L( |
CIM_ERR_FAILED, | CIM_ERR_FAILED, |
|
|
void ProviderManagerService::indicationCallback( | void ProviderManagerService::indicationCallback( |
CIMProcessIndicationRequestMessage* request) | CIMProcessIndicationRequestMessage* request) |
{ | { |
|
try |
|
{ |
|
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
|
}catch(const Exception &) |
|
{ |
|
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguageList())); |
|
} |
|
|
if (_indicationServiceQueueId == PEG_NOT_FOUND) | if (_indicationServiceQueueId == PEG_NOT_FOUND) |
{ | { |
Array<Uint32> serviceIds; | Array<Uint32> serviceIds; |
|
|
_indicationServiceQueueId); | _indicationServiceQueueId); |
| |
providerManagerService->SendForget(asyncRequest); | providerManagerService->SendForget(asyncRequest); |
|
|
|
|
|
|
|
|
|
#ifdef PEGASUS_INDICATIONS_Q_THRESHOLD |
|
|
|
// See Comments in config.mak asociated with |
|
// PEGASUS_INDICATIONS_Q_THRESHOLD |
|
// |
|
// if INDICATIONS_Q_STALL THRESHOLD is gt 0 |
|
// then if there are over INDICATIONS_Q_STALL_THRESHOLD |
|
// indications in the queue |
|
// then force this provider to sleep until the queue count |
|
// is lower than INDICATIONS_Q_RESUME_THRESHOLD |
|
|
|
static Mutex indicationThresholdReportedLock; |
|
static Boolean indicationThresholdReported = false; |
|
|
|
#define INDICATIONS_Q_STALL_THRESHOLD PEGASUS_INDICATIONS_Q_THRESHOLD |
|
#define INDICATIONS_Q_RESUME_THRESHOLD (int)(PEGASUS_INDICATIONS_Q_THRESHOLD*.90) |
|
#define INDICATIONS_Q_STALL_DURATION 250 // milli-seconds |
|
|
|
MessageQueue * indicationsQueue = MessageQueue::lookup(_indicationServiceQueueId); |
|
|
|
if (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_STALL_THRESHOLD) |
|
{ |
|
AutoMutex indicationThresholdReportedAutoMutex(indicationThresholdReportedLock); |
|
if (!indicationThresholdReported) |
|
{ |
|
indicationThresholdReported = true; |
|
indicationThresholdReportedAutoMutex.unlock(); |
|
|
|
// make log entry to record que max exceeded |
|
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"Indication generation stalled: maximum queue count ($0) exceeded.", |
|
INDICATIONS_Q_STALL_THRESHOLD); |
|
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex.unlock(); |
|
} |
|
|
|
while (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_RESUME_THRESHOLD) |
|
{ |
|
pegasus_sleep(INDICATIONS_Q_STALL_DURATION); |
|
} |
|
|
|
AutoMutex indicationThresholdReportedAutoMutex1(indicationThresholdReportedLock); |
|
// indicationThresholdReportedLock.lock(pegasus_thread_self()); |
|
if(indicationThresholdReported) |
|
{ |
|
indicationThresholdReported = false; |
|
indicationThresholdReportedAutoMutex1.unlock(); |
|
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"Indication generation resumed: current queue count = $0", |
|
((MessageQueueService *)indicationsQueue)->getIncomingCount() ); |
|
|
|
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex1.unlock(); |
|
} |
|
} |
|
#endif /* INDICATIONS_Q_STALL_THRESHOLD */ |
|
|
|
} |
|
|
|
void ProviderManagerService::providerModuleFailureCallback |
|
(const String & moduleName, |
|
const String & userName, |
|
Uint16 userContext) |
|
{ |
|
PEG_METHOD_ENTER (TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::providerModuleFailureCallback"); |
|
|
|
if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) |
|
{ |
|
Logger::put_l ( |
|
Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
|
"ProviderManager.OOPProviderManagerRouter." |
|
"OOP_PROVIDER_MODULE_USER_CTXT_FAILURE_DETECTED", |
|
"A failure was detected in provider module $0 with" |
|
" user context $1.", |
|
moduleName, userName); |
|
} |
|
else // not requestor context |
|
{ |
|
Logger::put_l ( |
|
Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
|
"ProviderManager.OOPProviderManagerRouter." |
|
"OOP_PROVIDER_MODULE_FAILURE_DETECTED", |
|
"A failure was detected in provider module $0.", |
|
moduleName); |
|
} |
|
|
|
// |
|
// Create Notify Provider Fail request message |
|
// |
|
CIMNotifyProviderFailRequestMessage * request = |
|
new CIMNotifyProviderFailRequestMessage |
|
(XmlWriter::getNextMessageId (), |
|
moduleName, |
|
userName, |
|
QueueIdStack ()); |
|
|
|
// |
|
// Send Notify Provider Fail request message to Indication Service |
|
// |
|
if (_indicationServiceQueueId == PEG_NOT_FOUND) |
|
{ |
|
Array <Uint32> serviceIds; |
|
|
|
providerManagerService->find_services |
|
(PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds); |
|
PEGASUS_ASSERT (serviceIds.size () != 0); |
|
|
|
_indicationServiceQueueId = serviceIds [0]; |
|
} |
|
|
|
request->queueIds = QueueIdStack |
|
(_indicationServiceQueueId, providerManagerService->getQueueId ()); |
|
|
|
AsyncLegacyOperationStart * asyncRequest = new AsyncLegacyOperationStart |
|
(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 |