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

   1 karl  1.75 //%2006////////////////////////////////////////////////////////////////////////
   2 chip  1.1  //
   3 karl  1.59 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 karl  1.15 // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.59 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 karl  1.63 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl  1.75 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12            // EMC Corporation; Symantec Corporation; The Open Group.
  13 chip  1.1  //
  14            // Permission is hereby granted, free of charge, to any person obtaining a copy
  15            // of this software and associated documentation files (the "Software"), to
  16            // deal in the Software without restriction, including without limitation the
  17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  18            // sell copies of the Software, and to permit persons to whom the Software is
  19            // furnished to do so, subject to the following conditions:
  20 karl  1.59 // 
  21 chip  1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29            //
  30            //==============================================================================
  31            //
  32            // Author: Chip Vincent (cvincent@us.ibm.com)
  33            //
  34            // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
  35            //                  (carolann_graves@hp.com)
  36            //              Mike Day, IBM (mdday@us.ibm.com)
  37            //              Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators.
  38 chip  1.9  //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
  39 schuur 1.19 //              Adrian Schuur, IBM (schuur@de.ibm.com)
  40 a.arora 1.37 //              Amit K Arora (amita@in.ibm.com) for PEP-101
  41 kumpf   1.39 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
  42 se.gupta 1.41 //              Seema Gupta (gseema@in.ibm.com for PEP135)
  43 jim.wunderlich 1.69 //              Jim Wunderlich (Jim_Wunderlich@prodigy.net)
  44 aruran.ms      1.71 //              Aruran, IBM (ashanmug@in.ibm.com)for Bug# 3881
  45 chip           1.1  //
  46                     //%/////////////////////////////////////////////////////////////////////////////
  47                     
  48                     #include "ProviderManagerService.h"
  49                     
  50                     #include <Pegasus/Common/Config.h>
  51 kumpf          1.65 #include <Pegasus/Common/PegasusVersion.h>
  52 chip           1.1  #include <Pegasus/Common/Constants.h>
  53                     #include <Pegasus/Common/CIMMessage.h>
  54 kumpf          1.39 #include <Pegasus/Common/Thread.h>
  55 chip           1.1  #include <Pegasus/Common/Tracer.h>
  56                     #include <Pegasus/Common/Logger.h>
  57 a.arora        1.37 #include <Pegasus/Common/AutoPtr.h>
  58 chip           1.1  
  59 chip           1.6  #include <Pegasus/Config/ConfigManager.h>
  60                     
  61 kumpf          1.39 #include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h>
  62 kumpf          1.51 #include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h>
  63 brian.campbell 1.60 #include <Pegasus/ProviderManager2/OperationResponseHandler.h>
  64 chip           1.17 
  65 chip           1.1  PEGASUS_NAMESPACE_BEGIN
  66                     
  67 chip           1.11 inline Boolean _isSupportedRequestType(const Message * message)
  68                     {
  69                         // ATTN: needs implementation
  70                     
  71                         // for now, assume all requests are valid
  72                     
  73                         return(true);
  74 chip           1.3  }
  75                     
  76                     inline Boolean _isSupportedResponseType(const Message * message)
  77                     {
  78 chip           1.11     // ATTN: needs implementation
  79                     
  80                         // for now, assume all responses are invalid
  81 chip           1.3  
  82 chip           1.11     return(false);
  83 chip           1.3  }
  84                     
  85 schuur         1.19 ProviderManagerService* ProviderManagerService::providerManagerService=NULL;
  86 kumpf          1.39 Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND;
  87 schuur         1.19 
  88 chip           1.1  ProviderManagerService::ProviderManagerService(void)
  89                         : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
  90                     {
  91 schuur         1.19     providerManagerService=this;
  92 chip           1.1  }
  93                     
  94 schuur         1.25 ProviderManagerService::ProviderManagerService(
  95                             ProviderRegistrationManager * providerRegistrationManager,
  96                             CIMRepository * repository)
  97 chip           1.1      : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
  98                     {
  99 schuur         1.19     providerManagerService=this;
 100 schuur         1.25     _repository=repository;
 101 dj.gorey       1.31 
 102 kumpf          1.38     _providerRegistrationManager = providerRegistrationManager;
 103 kumpf          1.44 
 104                         _unloadIdleProvidersBusy = 0;
 105                     
 106 kumpf          1.62     _basicProviderManagerRouter = 0;
 107                         _oopProviderManagerRouter = 0;
 108                     
 109                         // Determine which ProviderManagerRouter(s) to use
 110                     
 111 kumpf          1.51     ConfigManager* configManager = ConfigManager::getInstance();
 112 kumpf          1.62     Boolean forceProviderProcesses = String::equal(
 113                             configManager->getCurrentValue("forceProviderProcesses"), "true");
 114                     
 115                     #ifdef PEGASUS_DISABLE_PROV_USERCTXT
 116                         if (forceProviderProcesses)
 117 kumpf          1.51     {
 118 kumpf          1.75.2.1         _oopProviderManagerRouter = new OOPProviderManagerRouter(
 119 carolann.graves 1.75.2.3             indicationCallback, responseChunkCallback,
 120                                      providerModuleFailureCallback);
 121 kumpf           1.51         }
 122                              else
 123                              {
 124 kumpf           1.75.2.1         _basicProviderManagerRouter = new BasicProviderManagerRouter(
 125                                      indicationCallback, responseChunkCallback);
 126 kumpf           1.62         }
 127                          #else
 128 kumpf           1.75.2.1     _oopProviderManagerRouter = new OOPProviderManagerRouter(
 129 carolann.graves 1.75.2.3         indicationCallback, responseChunkCallback,
 130                                  providerModuleFailureCallback);
 131 kumpf           1.62     
 132                              if (!forceProviderProcesses)
 133                              {
 134 kumpf           1.75.2.1         _basicProviderManagerRouter = new BasicProviderManagerRouter(
 135                                      indicationCallback, responseChunkCallback);
 136 kumpf           1.51         }
 137 kumpf           1.62     #endif
 138 chip            1.1      }
 139                          
 140                          ProviderManagerService::~ProviderManagerService(void)
 141                          {
 142 kumpf           1.62         delete _basicProviderManagerRouter;
 143                              delete _oopProviderManagerRouter;
 144 schuur          1.19         providerManagerService=NULL;
 145 chip            1.1      }
 146                          
 147                          Boolean ProviderManagerService::messageOK(const Message * message)
 148                          {
 149                              PEGASUS_ASSERT(message != 0);
 150                          
 151 chip            1.3          if(_isSupportedRequestType(message))
 152 chip            1.1          {
 153 chip            1.3              return(MessageQueueService::messageOK(message));
 154 chip            1.1          }
 155                          
 156 chip            1.3          return(false);
 157 chip            1.1      }
 158                          
 159                          void ProviderManagerService::handleEnqueue(void)
 160                          {
 161                              Message * message = dequeue();
 162                          
 163                              handleEnqueue(message);
 164                          }
 165                          
 166                          void ProviderManagerService::handleEnqueue(Message * message)
 167                          {
 168                              PEGASUS_ASSERT(message != 0);
 169                          
 170                              AsyncLegacyOperationStart * asyncRequest;
 171                          
 172                              if(message->_async != NULL)
 173                              {
 174                                  asyncRequest = static_cast<AsyncLegacyOperationStart *>(message->_async);
 175                              }
 176                              else
 177                              {
 178 chip            1.1              asyncRequest = new AsyncLegacyOperationStart(
 179                                      get_next_xid(),
 180                                      0,
 181                                      this->getQueueId(),
 182                                      message,
 183                                      this->getQueueId());
 184                              }
 185                          
 186                              _handle_async_request(asyncRequest);
 187                          }
 188                          
 189                          void ProviderManagerService::_handle_async_request(AsyncRequest * request)
 190                          {
 191                              PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 192                                  "ProviderManagerService::_handle_async_request");
 193                          
 194                              PEGASUS_ASSERT((request != 0) && (request->op != 0));
 195                          
 196                              if(request->getType() == async_messages::ASYNC_LEGACY_OP_START)
 197                              {
 198                                  request->op->processing();
 199 chip            1.1      
 200                                  _incomingQueue.enqueue(request->op);
 201 konrad.r        1.68             ThreadStatus rtn = PEGASUS_THREAD_OK;
 202 kumpf           1.75.2.2         while (( rtn =_thread_pool->allocate_and_awaken(
 203 konrad.r        1.68                          (void *)this, ProviderManagerService::handleCimOperation)) != PEGASUS_THREAD_OK)
 204 kumpf           1.75.2.2         {
 205                                      if (rtn==PEGASUS_THREAD_INSUFFICIENT_RESOURCES)
 206                                          pegasus_yield();
 207                                      else
 208                                      {
 209                                          Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 210                                              "Not enough threads to service provider manager." );
 211                          
 212                                          Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
 213                                              "Could not allocate thread for %s.",
 214                                              getQueueName());
 215                                          break;
 216                                     }
 217 konrad.r        1.68             }
 218 chip            1.1          }
 219                              else
 220                              {
 221                                  // pass all other operations to the default handler
 222                                  MessageQueueService::_handle_async_request(request);
 223                              }
 224                          
 225                              PEG_METHOD_EXIT();
 226                          
 227                              return;
 228                          }
 229                          
 230 kumpf           1.57     // Note: This method should not throw an exception.  It is used as a thread
 231                          // entry point, and any exceptions thrown are ignored.
 232 kumpf           1.39     PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL
 233 kumpf           1.75.2.2 ProviderManagerService::handleCimOperation(void* arg)
 234 chip            1.1      {
 235 kumpf           1.39         PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 236                                  "ProviderManagerService::handleCimOperation");
 237 chip            1.1      
 238 kumpf           1.67         PEGASUS_ASSERT(arg != 0);
 239 chip            1.8      
 240 chip            1.1          // get the service from argument
 241 kumpf           1.67         ProviderManagerService* service =
 242 kumpf           1.39             reinterpret_cast<ProviderManagerService *>(arg);
 243 kumpf           1.67         PEGASUS_ASSERT(service != 0);
 244 chip            1.1      
 245 kumpf           1.67         try
 246 chip            1.1          {
 247 kumpf           1.67             if (service->_incomingQueue.size() == 0)
 248                                  {
 249                                      PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
 250                                          "ProviderManagerService::handleCimOperation() called with no "
 251                                              "op node in queue");
 252 chip            1.1      
 253 kumpf           1.67                 PEG_METHOD_EXIT();
 254                                      return(PEGASUS_THREAD_RETURN(1));
 255                                  }
 256 chip            1.1      
 257 kumpf           1.67             AsyncOpNode* op = service->_incomingQueue.dequeue();
 258 chip            1.1      
 259 kumpf           1.67             if ((op == 0) || (op->_request.count() == 0))
 260                                  {
 261                                      // ATTN: This may dereference a null pointer!
 262                                      MessageQueue* queue = MessageQueue::lookup(op->_source_queue);
 263 chip            1.1      
 264 kumpf           1.67                 PEGASUS_ASSERT(queue != 0);
 265 chip            1.1      
 266 kumpf           1.67                 PEG_METHOD_EXIT();
 267 chip            1.1      
 268 kumpf           1.67                 // no request in op node
 269                                      return(PEGASUS_THREAD_RETURN(1));
 270                                  }
 271 chip            1.1      
 272 kumpf           1.67             AsyncRequest* request =
 273                                      static_cast<AsyncRequest*>(op->_request.next(0));
 274 chip            1.1      
 275 kumpf           1.67             if ((request == 0) ||
 276                                      (request->getType() != async_messages::ASYNC_LEGACY_OP_START))
 277                                  {
 278                                      // reply with NAK
 279                                      PEG_METHOD_EXIT();
 280                                      return(PEGASUS_THREAD_RETURN(0));
 281                                  }
 282 chip            1.1      
 283 kumpf           1.39             Message* legacy =
 284                                      static_cast<AsyncLegacyOperationStart *>(request)->get_action();
 285 chip            1.1      
 286 chip            1.8              if(_isSupportedRequestType(legacy))
 287 chip            1.1              {
 288 a.arora         1.37                 AutoPtr<Message> xmessage(legacy);
 289 chip            1.1      
 290 chip            1.8                  // Set the client's requested language into this service thread.
 291                                      // This will allow functions in this service to return messages
 292                                      // in the correct language.
 293 kumpf           1.39                 CIMMessage* msg = dynamic_cast<CIMMessage *>(legacy);
 294 chip            1.8      
 295 kumpf           1.39                 if (msg != 0)
 296 chip            1.8                  {
 297 kumpf           1.74                     AcceptLanguageList* langs = new AcceptLanguageList(
 298 kumpf           1.67                         ((AcceptLanguageListContainer)msg->operationContext.get(
 299                                                  AcceptLanguageListContainer::NAME)).getLanguages());
 300 chip            1.8                      Thread::setLanguages(langs);
 301                                      }
 302                                      else
 303                                      {
 304                                          Thread::clearLanguages();
 305                                      }
 306 chip            1.1      
 307                                      service->handleCimRequest(op, legacy);
 308 chip            1.3              }
 309 chip            1.8          }
 310 konrad.r        1.66         catch (const Exception& e)
 311 kumpf           1.67         {
 312 konrad.r        1.66             PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
 313 kumpf           1.67                 "Unexpected exception in handleCimOperation: " + e.getMessage());
 314                              }
 315 konrad.r        1.66         catch (...)
 316 kumpf           1.67         {
 317 konrad.r        1.66             PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
 318 kumpf           1.67                 "Unexpected exception in handleCimOperation.");
 319                              }
 320 chip            1.1      
 321                              PEG_METHOD_EXIT();
 322                          
 323                              return(PEGASUS_THREAD_RETURN(0));
 324                          }
 325                          
 326 kumpf           1.39     void ProviderManagerService::handleCimRequest(
 327                              AsyncOpNode * op,
 328                              Message * message)
 329 chip            1.1      {
 330 kumpf           1.39         PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 331                                  "ProviderManagerService::handleCimRequest");
 332 chip            1.1      
 333 kumpf           1.38         CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message);
 334                              PEGASUS_ASSERT(request != 0);
 335 chip            1.1      
 336                              // get request from op node
 337                              AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0));
 338 kumpf           1.38         PEGASUS_ASSERT(async != 0);
 339                          
 340                              Message * response = 0;
 341 kumpf           1.58         Boolean consumerLookupFailed = false;
 342 chip            1.1      
 343 kumpf           1.58         if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)
 344                              {
 345                                  //
 346                                  // Get a ProviderIdContainer for ExportIndicationRequestMessage.
 347                                  // Note: This can be removed when the CIMExportRequestDispatcher
 348                                  // is updated to add the ProviderIdContainer to the message.
 349                                  //
 350                                  CIMInstance providerModule;
 351                                  CIMInstance provider;
 352                                  const CIMExportIndicationRequestMessage* expRequest =
 353                                      dynamic_cast<const CIMExportIndicationRequestMessage*>(request);
 354                                  if (_providerRegistrationManager->lookupIndicationConsumer(
 355                                          expRequest->destinationPath, provider, providerModule))
 356                                  {
 357                                      request->operationContext.insert(
 358                                          ProviderIdContainer(providerModule, provider));
 359                                  }
 360                                  else
 361                                  {
 362                                      consumerLookupFailed = true;
 363                                  }
 364 kumpf           1.58         }
 365                          
 366                              if (consumerLookupFailed)
 367                              {
 368                                  CIMResponseMessage* cimResponse = request->buildResponse();
 369                                  cimResponse->cimException = PEGASUS_CIM_EXCEPTION(
 370                                      CIM_ERR_NOT_SUPPORTED, String::EMPTY);
 371                                  response = cimResponse;
 372                              }
 373                              else if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) ||
 374 kumpf           1.46             (dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) ||
 375 kumpf           1.40             (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) ||
 376 kumpf           1.45             (request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE))
 377 kumpf           1.38         {
 378 kumpf           1.45             // Handle CIMOperationRequestMessage, CIMExportIndicationRequestMessage,
 379 kumpf           1.46             // CIMIndicationRequestMessage, and CIMInitializeProviderRequestMessage.
 380                                  // (These should be blocked when the provider module is disabled.)
 381 kumpf           1.45     
 382 kumpf           1.46             //
 383                                  // Get the provider module instance to check for a disabled module
 384                                  //
 385                                  CIMInstance providerModule;
 386 kumpf           1.45     
 387 kumpf           1.58             // The provider ID container is added to the OperationContext
 388                                  // by the CIMOperationRequestDispatcher for all CIM operation
 389                                  // requests to providers, so it does not need to be added again.
 390                                  // CIMInitializeProviderRequestMessage also has a provider ID
 391                                  // container.
 392                                  ProviderIdContainer pidc =
 393                                      request->operationContext.get(ProviderIdContainer::NAME);
 394                                  providerModule = pidc.getModule();
 395 kumpf           1.38     
 396 kumpf           1.45             //
 397                                  // Check if the target provider is disabled
 398                                  //
 399                                  Boolean moduleDisabled = false;
 400                                  Uint32 pos = providerModule.findProperty(CIMName("OperationalStatus"));
 401                                  PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
 402                                  Array<Uint16> operationalStatus;
 403                                  providerModule.getProperty(pos).getValue().get(operationalStatus);
 404                          
 405                                  for(Uint32 i = 0; i < operationalStatus.size(); i++)
 406                                  {
 407 kumpf           1.50                 if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) ||
 408                                          (operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING))
 409 kumpf           1.45                 {
 410                                          moduleDisabled = true;
 411                                          break;
 412                                      }
 413                                  }
 414                          
 415                                  if (moduleDisabled)
 416                                  {
 417                                      //
 418                                      // Send a "provider blocked" response
 419                                      //
 420                                      CIMResponseMessage* cimResponse = request->buildResponse();
 421                                      cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L(
 422                                          CIM_ERR_ACCESS_DENIED,
 423                                          MessageLoaderParms(
 424                                              "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
 425                                              "provider blocked."));
 426                                      response = cimResponse;
 427 w.white         1.70     
 428                                       STAT_COPYDISPATCHER
 429 kumpf           1.45             }
 430                                  else
 431                                  {
 432                                      //
 433                                      // Forward the request to the appropriate ProviderManagerRouter
 434                                      //
 435 kumpf           1.62                 response = _processMessage(request);
 436 kumpf           1.45             }
 437 schuur          1.19         }
 438 kumpf           1.38         else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE)
 439                              {
 440                                  // Handle CIMEnableModuleRequestMessage
 441                                  CIMEnableModuleRequestMessage * emReq =
 442                                      dynamic_cast<CIMEnableModuleRequestMessage*>(request);
 443                          
 444                                  CIMInstance providerModule = emReq->providerModule;
 445 dj.gorey        1.31     
 446 kumpf           1.38             try
 447                                  {
 448 kumpf           1.39                 // Forward the request to the ProviderManager
 449 kumpf           1.62                 response = _processMessage(request);
 450 kumpf           1.38     
 451                                      // If successful, update provider module status to OK
 452                                      // ATTN: Use CIMEnableModuleResponseMessage operationalStatus?
 453                                      CIMEnableModuleResponseMessage * emResp =
 454                                          dynamic_cast<CIMEnableModuleResponseMessage*>(response);
 455                                      if (emResp->cimException.getCode() == CIM_ERR_SUCCESS)
 456                                      {
 457 carolann.graves 1.75.2.3                 //
 458                                          //  On a successful enable, remove Stopped status and
 459                                          //  append OK status
 460                                          //
 461                                          Array<Uint16> removeStatus;
 462                                          Array<Uint16> appendStatus;
 463                                          removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPED);
 464                                          appendStatus.append (CIM_MSE_OPSTATUS_VALUE_OK);
 465 kumpf           1.38                     _updateProviderModuleStatus(
 466 carolann.graves 1.75.2.3                     providerModule, removeStatus, appendStatus);
 467 kumpf           1.38                 }
 468                                  }
 469                                  catch (Exception& e)
 470                                  {
 471                                      // Get the OperationalStatus property from the provider module
 472                                      Array<Uint16> operationalStatus;
 473                                      CIMValue itValue = emReq->providerModule.getProperty(
 474                                          emReq->providerModule.findProperty("OperationalStatus"))
 475                                              .getValue();
 476                                      itValue.get(operationalStatus);
 477                          
 478                                      if (response != 0)
 479                                      {
 480                                          delete response;
 481                                      }
 482                          
 483                                      response = new CIMEnableModuleResponseMessage(
 484                                          request->messageId,
 485                                          CIMException(CIM_ERR_FAILED, e.getMessage()),
 486                                          request->queueIds.copyAndPop(),
 487                                          operationalStatus);
 488 kumpf           1.38             }
 489                              }
 490                              else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE)
 491                              {
 492                                  // Handle CIMDisableModuleRequestMessage
 493                                  CIMDisableModuleRequestMessage * dmReq =
 494                                      dynamic_cast<CIMDisableModuleRequestMessage*>(request);
 495                          
 496                                  CIMInstance providerModule = dmReq->providerModule;
 497                                  Boolean updateModuleStatus = !dmReq->disableProviderOnly;
 498                          
 499                                  try
 500                                  {
 501 carolann.graves 1.75.2.3             //
 502                                      //  On issuing a disable request, append Stopping status
 503                                      //  Do not remove existing status
 504                                      //
 505 kumpf           1.38                 if (updateModuleStatus)
 506                                      {
 507 carolann.graves 1.75.2.3                 Array<Uint16> removeStatus;
 508                                          Array<Uint16> appendStatus;
 509                                          appendStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING);
 510 kumpf           1.38                     _updateProviderModuleStatus(
 511 carolann.graves 1.75.2.3                     providerModule, removeStatus, appendStatus);
 512 kumpf           1.38                 }
 513                          
 514 kumpf           1.39                 // Forward the request to the ProviderManager
 515 kumpf           1.62                 response = _processMessage(request);
 516 kumpf           1.38     
 517                                      // Update provider module status based on success or failure
 518                                      if (updateModuleStatus)
 519                                      {
 520                                          CIMDisableModuleResponseMessage * dmResp =
 521                                              dynamic_cast<CIMDisableModuleResponseMessage*>(response);
 522                                          if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS)
 523                                          {
 524 carolann.graves 1.75.2.3                     //
 525                                              //  On an unsuccessful disable, remove Stopping status
 526                                              //
 527                                              Array<Uint16> removeStatus;
 528                                              Array<Uint16> appendStatus;
 529                                              removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING);
 530 kumpf           1.38                         _updateProviderModuleStatus(
 531 carolann.graves 1.75.2.3                         providerModule, removeStatus, appendStatus);
 532 kumpf           1.38                     }
 533                                          else
 534                                          {
 535                                              // Disable may or may not have been successful,
 536                                              // depending on whether there are outstanding requests.
 537 carolann.graves 1.75.2.3                     // Remove Stopping status
 538                                              // Append status, if any, from disable module response
 539                                              Array<Uint16> removeStatus;
 540                                              Array<Uint16> appendStatus;
 541                                              removeStatus.append (CIM_MSE_OPSTATUS_VALUE_STOPPING);
 542                                              if (dmResp->operationalStatus.size() > 0)
 543                                              {
 544                                                  //
 545                                                  //  On a successful disable, remove an OK or a Degraded
 546                                                  //  status, if present
 547                                                  //
 548                                                  if (dmResp->operationalStatus[
 549                                                      dmResp->operationalStatus.size()-1] ==
 550                                                      CIM_MSE_OPSTATUS_VALUE_STOPPED)
 551                                                  {
 552                                                      removeStatus.append (CIM_MSE_OPSTATUS_VALUE_OK);
 553                                                      removeStatus.append
 554                                                          (CIM_MSE_OPSTATUS_VALUE_DEGRADED);
 555                                                  }
 556                                                  appendStatus.append (dmResp->operationalStatus[
 557 kumpf           1.38                                 dmResp->operationalStatus.size()-1]);
 558 carolann.graves 1.75.2.3                     }
 559                                              _updateProviderModuleStatus(
 560                                                  providerModule, removeStatus, appendStatus);
 561 kumpf           1.38                     }
 562                                      }
 563                                  }
 564                                  catch (Exception& e)
 565                                  {
 566                                      // Get the OperationalStatus property from the provider module
 567                                      Array<Uint16> operationalStatus;
 568                                      CIMValue itValue = dmReq->providerModule.getProperty(
 569                                          dmReq->providerModule.findProperty("OperationalStatus"))
 570                                              .getValue();
 571                                      itValue.get(operationalStatus);
 572                          
 573                                      if (response != 0)
 574                                      {
 575                                          delete response;
 576                                      }
 577                          
 578                                      response = new CIMDisableModuleResponseMessage(
 579                                          request->messageId,
 580                                          CIMException(CIM_ERR_FAILED, e.getMessage()),
 581                                          request->queueIds.copyAndPop(),
 582 kumpf           1.38                     operationalStatus);
 583                                  }
 584                              }
 585                              else
 586                              {
 587 kumpf           1.62             response = _processMessage(request);
 588 schuur          1.23         }
 589 chip            1.13     
 590 schuur          1.19         AsyncLegacyOperationResult * async_result =
 591                                  new AsyncLegacyOperationResult(
 592                                  async->getKey(),
 593                                  async->getRouting(),
 594                                  op,
 595                                  response);
 596 chip            1.13     
 597 schuur          1.19         _complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0);
 598 chip            1.13     
 599 schuur          1.19         PEG_METHOD_EXIT();
 600                          }
 601 chip            1.13     
 602 kumpf           1.75.2.1 void ProviderManagerService::responseChunkCallback(
 603                              CIMRequestMessage* request,
 604                              CIMResponseMessage* response)
 605 brian.campbell  1.60     {
 606 kumpf           1.75.2.2     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 607                                  "ProviderManagerService::responseChunkCallback");
 608 brian.campbell  1.60     
 609 kumpf           1.75.2.2     try
 610                              {
 611                                  // only incomplete messages are processed because the caller ends up
 612                                  // sending the complete() stage
 613                                  PEGASUS_ASSERT(response->isComplete() == false);
 614                          
 615                                  AsyncLegacyOperationStart *requestAsync =
 616                                      dynamic_cast<AsyncLegacyOperationStart *>(request->_async);
 617                                  PEGASUS_ASSERT(requestAsync);
 618                                  AsyncOpNode *op = requestAsync->op;
 619                                  PEGASUS_ASSERT(op);
 620                                  PEGASUS_ASSERT(!response->_async);
 621                                  response->_async = new AsyncLegacyOperationResult(
 622                                      requestAsync->getKey(), requestAsync->getRouting(), op, response);
 623                          
 624                                  // set the destination
 625                                  op->_op_dest = op->_callback_response_q;
 626                          
 627                                  MessageQueueService *service =
 628                                      dynamic_cast<MessageQueueService *>(op->_callback_response_q);
 629                          
 630 kumpf           1.75.2.2         PEGASUS_ASSERT(service);
 631                          
 632                                  // the last chunk MUST be sent last, so use execute the callback
 633                                  // not all chunks are going through the dispatcher's chunk
 634                                  // resequencer, so this must be a synchronous call here
 635                                  // After the call is done, response and asyncResponse are now invalid
 636                                  // as they have been sent and deleted externally
 637 brian.campbell  1.60     
 638 kumpf           1.75.2.2         op->_async_callback(op, service, op->_callback_ptr);
 639                              }
 640                              catch(Exception &e)
 641                              {
 642                                  PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
 643                                      "Exception in ProviderManagerService::responseChunkCallback: " +
 644                                          e.getMessage() + ".  Chunk not delivered.");
 645                              }
 646                              catch(...)
 647                              {
 648                                  PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
 649                                      "Exception in ProviderManagerService::responseChunkCallback.  "
 650                                          "Chunk not delivered.");
 651                              }
 652                          
 653                              PEG_METHOD_EXIT();
 654 brian.campbell  1.60     }
 655                          
 656 kumpf           1.62     Message* ProviderManagerService::_processMessage(CIMRequestMessage* request)
 657                          {
 658                              Message* response = 0;
 659                          
 660                              if ((request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) ||
 661 kumpf           1.75.2.2         (request->getType() ==
 662 carolann.graves 1.64                 CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE) ||
 663 kumpf           1.62             (request->getType() == CIM_NOTIFY_CONFIG_CHANGE_REQUEST_MESSAGE))
 664                              {
 665                                  if (_basicProviderManagerRouter)
 666                                  {
 667                                      response = _basicProviderManagerRouter->processMessage(request);
 668                                  }
 669                          
 670                                  if (_oopProviderManagerRouter)
 671                                  {
 672                                      // Note: These responses do not contain interesting data, so just
 673                                      // use the last one.
 674                                      if (response)
 675                                      {
 676                                          delete response;
 677                                      }
 678                          
 679                                      response = _oopProviderManagerRouter->processMessage(request);
 680                                  }
 681                              }
 682                              else
 683                              {
 684 kumpf           1.62             CIMInstance providerModule;
 685                          
 686                                  if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE)
 687                                  {
 688                                      CIMEnableModuleRequestMessage* emReq =
 689                                          dynamic_cast<CIMEnableModuleRequestMessage*>(request);
 690                                      providerModule = emReq->providerModule;
 691                                  }
 692                                  else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE)
 693                                  {
 694                                      CIMDisableModuleRequestMessage* dmReq =
 695                                          dynamic_cast<CIMDisableModuleRequestMessage*>(request);
 696                                      providerModule = dmReq->providerModule;
 697                                  }
 698                                  else
 699                                  {
 700                                      ProviderIdContainer pidc =
 701                                          request->operationContext.get(ProviderIdContainer::NAME);
 702                                      providerModule = pidc.getModule();
 703                                  }
 704                          
 705 carolann.graves 1.75.2.3         Uint16 userContext = PEGASUS_DEFAULT_PROV_USERCTXT;
 706 kumpf           1.62             Uint32 pos = providerModule.findProperty(
 707                                      PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT);
 708                                  if (pos != PEG_NOT_FOUND)
 709                                  {
 710                                      providerModule.getProperty(pos).getValue().get(userContext);
 711                                  }
 712                          
 713                                  // Forward the request to the appropriate ProviderManagerRouter, based
 714                                  // on the CIM Server configuration and the UserContext setting.
 715                          
 716                                  ConfigManager* configManager = ConfigManager::getInstance();
 717                                  Boolean forceProviderProcesses = String::equal(
 718                                      configManager->getCurrentValue("forceProviderProcesses"), "true");
 719                          
 720                                  if (forceProviderProcesses
 721                          #ifndef PEGASUS_DISABLE_PROV_USERCTXT
 722                                      || (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)
 723                                      || (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)
 724                                      || ((userContext == PG_PROVMODULE_USERCTXT_PRIVILEGED) &&
 725                                          !System::isPrivilegedUser(System::getEffectiveUserName()))
 726                          #endif
 727 kumpf           1.62                )
 728                                  {
 729                                      response = _oopProviderManagerRouter->processMessage(request);
 730                                  }
 731                                  else
 732                                  {
 733                                      response = _basicProviderManagerRouter->processMessage(request);
 734                                  }
 735                              }
 736                          
 737                              return response;
 738                          }
 739                          
 740 kumpf           1.44     void ProviderManagerService::unloadIdleProviders()
 741                          {
 742                              PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 743                                  "ProviderManagerService::unloadIdleProviders");
 744 konrad.r        1.68         ThreadStatus rtn = PEGASUS_THREAD_OK;
 745 kumpf           1.44         // Ensure that only one _unloadIdleProvidersHandler thread runs at a time
 746                              _unloadIdleProvidersBusy++;
 747 mike            1.72         if ((_unloadIdleProvidersBusy.get() == 1) &&
 748 konrad.r        1.68             ((rtn = _thread_pool->allocate_and_awaken(
 749                                       (void*)this, ProviderManagerService::_unloadIdleProvidersHandler))==PEGASUS_THREAD_OK))
 750 kumpf           1.44         {
 751                                  // _unloadIdleProvidersBusy is decremented in
 752                                  // _unloadIdleProvidersHandler
 753                              }
 754                              else
 755                              {
 756                                  // If we fail to allocate a thread, don't retry now.
 757                                  _unloadIdleProvidersBusy--;
 758                              }
 759 kumpf           1.75.2.2     if (rtn != PEGASUS_THREAD_OK)
 760 konrad.r        1.68         {
 761 kumpf           1.75.2.2         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 762                                      "Not enough threads to unload idle providers.");
 763                          
 764                                  Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
 765                                      "Could not allocate thread for %s to unload idle providers.",
 766                                      getQueueName());
 767 konrad.r        1.68         }
 768 kumpf           1.44         PEG_METHOD_EXIT();
 769                          }
 770                          
 771                          PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL
 772                          ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw()
 773 chip            1.1      {
 774 kumpf           1.44         try
 775                              {
 776                                  PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 777                                      "ProviderManagerService::unloadIdleProvidersHandler");
 778                          
 779                                  ProviderManagerService* myself =
 780                                      reinterpret_cast<ProviderManagerService*>(arg);
 781                          
 782 kumpf           1.62             if (myself->_basicProviderManagerRouter)
 783 kumpf           1.44             {
 784 kumpf           1.62                 try
 785                                      {
 786                                          myself->_basicProviderManagerRouter->unloadIdleProviders();
 787                                      }
 788                                      catch (...)
 789                                      {
 790                                          // Ignore errors
 791                                          PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
 792                                              "Unexpected exception from "
 793                                                  "BasicProviderManagerRouter::_unloadIdleProviders");
 794                                      }
 795 kumpf           1.44             }
 796 kumpf           1.62     
 797                                  if (myself->_oopProviderManagerRouter)
 798 kumpf           1.44             {
 799 kumpf           1.62                 try
 800                                      {
 801                                          myself->_oopProviderManagerRouter->unloadIdleProviders();
 802                                      }
 803                                      catch (...)
 804                                      {
 805                                          // Ignore errors
 806                                          PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
 807                                              "Unexpected exception from "
 808                                                  "OOPProviderManagerRouter::_unloadIdleProviders");
 809                                      }
 810 kumpf           1.44             }
 811                          
 812                                  myself->_unloadIdleProvidersBusy--;
 813                                  PEG_METHOD_EXIT();
 814                              }
 815                              catch (...)
 816                              {
 817                                  // Ignore errors
 818                                  PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
 819                                      "Unexpected exception in _unloadIdleProvidersHandler");
 820                              }
 821                          
 822                              return(PEGASUS_THREAD_RETURN(0));
 823 kumpf           1.38     }
 824                          
 825                          // Updates the providerModule instance and the ProviderRegistrationManager
 826 carolann.graves 1.75.2.3 //
 827                          // This method is used to update the provider module status when the module is
 828                          // disabled or enabled.  If a Degraded status has been set (appended) to the
 829                          // OperationalStatus, it is cleared (removed) when the module is disabled or
 830                          // enabled.
 831                          //
 832 kumpf           1.38     void ProviderManagerService::_updateProviderModuleStatus(
 833                              CIMInstance& providerModule,
 834 carolann.graves 1.75.2.3     const Array<Uint16>& removeStatus,
 835                              const Array<Uint16>& appendStatus)
 836 kumpf           1.38     {
 837                              PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 838                                  "ProviderManagerService::_updateProviderModuleStatus");
 839                          
 840                              Array<Uint16> operationalStatus;
 841                              String providerModuleName;
 842                          
 843                              Uint32 pos = providerModule.findProperty(CIMName("Name"));
 844                              PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
 845                              providerModule.getProperty(pos).getValue().get(providerModuleName);
 846                          
 847                              //
 848                              // get operational status
 849                              //
 850                              pos = providerModule.findProperty(CIMName("OperationalStatus"));
 851                              PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
 852                              CIMProperty operationalStatusProperty = providerModule.getProperty(pos);
 853                          
 854 carolann.graves 1.75.2.3     if (_providerRegistrationManager->updateProviderModuleStatus(
 855                                  providerModuleName, removeStatus, appendStatus, operationalStatus) ==
 856                                  false)
 857 kumpf           1.38         {
 858                                  throw PEGASUS_CIM_EXCEPTION_L(
 859                                      CIM_ERR_FAILED,
 860                                      MessageLoaderParms(
 861                                          "ProviderManager.ProviderManagerService."
 862                                              "SET_MODULE_STATUS_FAILED",
 863                                          "set module status failed."));
 864                              }
 865                          
 866                              operationalStatusProperty.setValue(CIMValue(operationalStatus));
 867                          
 868                              PEG_METHOD_EXIT();
 869 kumpf           1.39     }
 870                          
 871                          void ProviderManagerService::indicationCallback(
 872                              CIMProcessIndicationRequestMessage* request)
 873                          {
 874 kumpf           1.75.2.2     try
 875                              {
 876                                  AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME);
 877                              }catch(const Exception &)
 878                              {
 879                                  request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguageList()));
 880                              }
 881                          
 882                              if (_indicationServiceQueueId == PEG_NOT_FOUND)
 883 kumpf           1.39         {
 884                                  Array<Uint32> serviceIds;
 885                          
 886                                  providerManagerService->find_services(
 887                                      PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds);
 888                                  PEGASUS_ASSERT(serviceIds.size() != 0);
 889                          
 890                                  _indicationServiceQueueId = serviceIds[0];
 891                              }
 892                          
 893                              request->queueIds = QueueIdStack(
 894                                  _indicationServiceQueueId, providerManagerService->getQueueId());
 895                          
 896                              AsyncLegacyOperationStart * asyncRequest =
 897                                  new AsyncLegacyOperationStart(
 898                                  providerManagerService->get_next_xid(),
 899                                  0,
 900                                  _indicationServiceQueueId,
 901                                  request,
 902                                  _indicationServiceQueueId);
 903                          
 904 kumpf           1.39         providerManagerService->SendForget(asyncRequest);
 905 jim.wunderlich  1.69     
 906                          
 907                          
 908                          
 909                          #ifdef PEGASUS_INDICATIONS_Q_THRESHOLD
 910                          
 911 kumpf           1.75.2.2     // See Comments in config.mak asociated with
 912 jim.wunderlich  1.69         //  PEGASUS_INDICATIONS_Q_THRESHOLD
 913                              //
 914                              // if INDICATIONS_Q_STALL THRESHOLD is gt 0
 915                              // then if there are over INDICATIONS_Q_STALL_THRESHOLD
 916 kumpf           1.75.2.2     //           indications in the queue
 917 jim.wunderlich  1.69         //      then force this provider to sleep until the queue count
 918                              //      is lower than INDICATIONS_Q_RESUME_THRESHOLD
 919                          
 920                          static Mutex   indicationThresholdReportedLock;
 921                          static Boolean indicationThresholdReported = false;
 922                          
 923                          #define INDICATIONS_Q_STALL_THRESHOLD PEGASUS_INDICATIONS_Q_THRESHOLD
 924                          #define INDICATIONS_Q_RESUME_THRESHOLD (int)(PEGASUS_INDICATIONS_Q_THRESHOLD*.90)
 925                          #define INDICATIONS_Q_STALL_DURATION 250 // milli-seconds
 926                          
 927                              MessageQueue * indicationsQueue = MessageQueue::lookup(_indicationServiceQueueId);
 928                          
 929                              if (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_STALL_THRESHOLD)
 930 kumpf           1.75.2.2     {
 931 jim.wunderlich  1.69             AutoMutex indicationThresholdReportedAutoMutex(indicationThresholdReportedLock);
 932                                  if (!indicationThresholdReported)
 933 kumpf           1.75.2.2         {
 934 jim.wunderlich  1.69                 indicationThresholdReported = true;
 935                                      indicationThresholdReportedAutoMutex.unlock();
 936                          
 937 kumpf           1.75.2.2             // make log entry to record que max exceeded
 938 jim.wunderlich  1.69     
 939                                      Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
 940 kumpf           1.75.2.2                 "Indication generation stalled: maximum queue count ($0) exceeded.",
 941 jim.wunderlich  1.69                     INDICATIONS_Q_STALL_THRESHOLD);
 942 kumpf           1.75.2.2         }
 943                                  else
 944                                  {
 945 jim.wunderlich  1.69                 indicationThresholdReportedAutoMutex.unlock();
 946 kumpf           1.75.2.2         }
 947 jim.wunderlich  1.69     
 948                                  while (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_RESUME_THRESHOLD)
 949 kumpf           1.75.2.2         {
 950 jim.wunderlich  1.69                 pegasus_sleep(INDICATIONS_Q_STALL_DURATION);
 951 kumpf           1.75.2.2         }
 952 jim.wunderlich  1.69     
 953                                  AutoMutex indicationThresholdReportedAutoMutex1(indicationThresholdReportedLock);
 954                                  //        indicationThresholdReportedLock.lock(pegasus_thread_self());
 955                                  if(indicationThresholdReported)
 956 kumpf           1.75.2.2         {
 957 jim.wunderlich  1.69                 indicationThresholdReported = false;
 958                                      indicationThresholdReportedAutoMutex1.unlock();
 959 kumpf           1.75.2.2 
 960 jim.wunderlich  1.69                 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
 961 kumpf           1.75.2.2                   "Indication generation resumed: current queue count = $0",
 962 jim.wunderlich  1.69                       ((MessageQueueService *)indicationsQueue)->getIncomingCount() );
 963                          
 964 kumpf           1.75.2.2         }
 965 jim.wunderlich  1.69             else
 966 kumpf           1.75.2.2         {
 967 jim.wunderlich  1.69                 indicationThresholdReportedAutoMutex1.unlock();
 968 kumpf           1.75.2.2         }
 969                              }
 970 jim.wunderlich  1.69     #endif /* INDICATIONS_Q_STALL_THRESHOLD */
 971                          
 972 chip            1.1      }
 973                          
 974 carolann.graves 1.75.2.3 void ProviderManagerService::providerModuleFailureCallback
 975                              (const String & moduleName,
 976                               const String & userName,
 977                               Uint16 userContext)
 978                          {
 979                              PEG_METHOD_ENTER (TRC_PROVIDERMANAGER,
 980                                  "ProviderManagerService::providerModuleFailureCallback");
 981                          
 982                              if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)
 983                              {
 984                                  Logger::put_l (
 985                                      Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
 986                                      "ProviderManager.OOPProviderManagerRouter."
 987                                          "OOP_PROVIDER_MODULE_USER_CTXT_FAILURE_DETECTED", 
 988                                      "A failure was detected in provider module $0 with"
 989                                          " user context $1.",
 990                                      moduleName, userName);
 991                              }
 992                              else  //  not requestor context
 993                              {
 994                                  Logger::put_l (
 995 carolann.graves 1.75.2.3             Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
 996                                      "ProviderManager.OOPProviderManagerRouter."
 997                                          "OOP_PROVIDER_MODULE_FAILURE_DETECTED", 
 998                                      "A failure was detected in provider module $0.",
 999                                      moduleName);
1000                              }
1001                          
1002                              //
1003                              //  Create Notify Provider Fail request message
1004                              //
1005                              CIMNotifyProviderFailRequestMessage * request =
1006                                  new CIMNotifyProviderFailRequestMessage
1007                                      (XmlWriter::getNextMessageId (),
1008                                      moduleName,
1009                                      userName,
1010                                      QueueIdStack ());
1011                          
1012                              //
1013                              //  Send Notify Provider Fail request message to Indication Service
1014                              //
1015                              if (_indicationServiceQueueId == PEG_NOT_FOUND)
1016 carolann.graves 1.75.2.3     {
1017                                  Array <Uint32> serviceIds;
1018                          
1019                                  providerManagerService->find_services
1020                                      (PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds);
1021                                  PEGASUS_ASSERT (serviceIds.size () != 0);
1022                          
1023                                  _indicationServiceQueueId = serviceIds [0];
1024                              }
1025                          
1026                              request->queueIds = QueueIdStack
1027                                  (_indicationServiceQueueId, providerManagerService->getQueueId ());
1028                          
1029                              AsyncLegacyOperationStart * asyncRequest = new AsyncLegacyOperationStart
1030                                  (providerManagerService->get_next_xid (),
1031                                  0,
1032                                  _indicationServiceQueueId,
1033                                  request,
1034                                  _indicationServiceQueueId);
1035                          
1036                              AutoPtr <AsyncReply> asyncReply
1037 carolann.graves 1.75.2.3         (providerManagerService->SendWait (asyncRequest));
1038                          
1039                              AutoPtr <CIMNotifyProviderFailResponseMessage> response
1040                                  (reinterpret_cast <CIMNotifyProviderFailResponseMessage *>
1041                                      ((dynamic_cast <AsyncLegacyOperationResult *>
1042                                      (asyncReply.get ()))->get_result ()));
1043                          
1044                              if (response->cimException.getCode () != CIM_ERR_SUCCESS)
1045                              {
1046                                  PEG_TRACE_STRING (TRC_DISCARDED_DATA, Tracer::LEVEL2,
1047                                      "Unexpected exception in providerModuleFailureCallback: " +
1048                                      response->cimException.getMessage ());
1049                              }
1050                              else
1051                              {
1052                                  //
1053                                  //  Successful response
1054                                  //  Examine result to see if any subscriptions were affected
1055                                  //
1056                                  if (response->numSubscriptionsAffected > 0)
1057                                  {
1058 carolann.graves 1.75.2.3             //
1059                                      //  Subscriptions were affected
1060                                      //  Update the provider module status to Degraded
1061                                      //
1062                                      try
1063                                      {
1064                                          CIMInstance providerModule;
1065                                          CIMKeyBinding keyBinding(
1066                                              _PROPERTY_PROVIDERMODULE_NAME,
1067                                              moduleName,
1068                                              CIMKeyBinding::STRING);
1069                                          Array<CIMKeyBinding> kbArray;
1070                                          kbArray.append(keyBinding);
1071                                          CIMObjectPath modulePath("", PEGASUS_NAMESPACENAME_INTEROP,
1072                                              PEGASUS_CLASSNAME_PROVIDERMODULE, kbArray);
1073                                          providerModule =
1074                                              providerManagerService->_providerRegistrationManager->
1075                                                  getInstance(
1076                                                      modulePath, false, false, CIMPropertyList());
1077                          
1078                                          Array<Uint16> removeStatus;
1079 carolann.graves 1.75.2.3                 Array<Uint16> appendStatus;
1080                                          removeStatus.append(CIM_MSE_OPSTATUS_VALUE_OK);
1081                                          appendStatus.append(CIM_MSE_OPSTATUS_VALUE_DEGRADED);
1082                                          providerManagerService->_updateProviderModuleStatus(
1083                                              providerModule, removeStatus, appendStatus);
1084                                      }
1085                                      catch (const Exception & e)
1086                                      {
1087                                          PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
1088                                              "Failed to update provider module status: " +
1089                                              e.getMessage());
1090                                      }
1091                          
1092                                      //
1093                                      //  Log a warning message since subscriptions were affected
1094                                      //
1095                                      Logger::put_l (
1096                                          Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
1097                                          "ProviderManager.OOPProviderManagerRouter."
1098                                              "OOP_PROVIDER_MODULE_SUBSCRIPTIONS_AFFECTED", 
1099                                          "The generation of indications by providers in module $0 "
1100 carolann.graves 1.75.2.3                 "may be affected.  To ensure these providers are serving "
1101                                          "active subscriptions, disable and then re-enable this "
1102                                          "module using the cimprovider command.",
1103                                          moduleName);
1104                                  }
1105                              }
1106                          
1107                              PEG_METHOD_EXIT();
1108                          }
1109                          
1110 a.arora         1.37     PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2