Re: Unloading a CMPI provider

Ashok K Pathak <[email protected]> Thu, 9 May 2013 11:22:33 +0530
Newsgroups gmane.network.open-pegasus.general
Message-ID <OFF45D74B9.322FBAE2-ON65257B66.00202AEE-65257B66.00205BFC@in.ibm.com>
Some times back I have discussion w/ Marek for the same issue
Thanks to Marek for the nice explanation to prevent unloading of  CMPI
provider  .

For  CMPI provider the way to prevent unload of your CMPI provider is to
implement the cleanup() function for each MI (in the provider).

To give you an example how to do this, lets assume a provider named
"Example" with an InstanceMI (provides enumerateInstances etc.).
Assuming you use the CMPI convenience macro
CMInstanceMIStub(
    Example,
    Example,
    _broker,
    CMNoHook)

You would have to implement the function: ExampleCleanup().

CMPIStatus ExampleCleanup(
    CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    CMPIBoolean terminating)
{
    if (!terminating)
    {
            CMReturn(CMPI_RC_NEVER_UNLOAD);
    }
    else
    {
        /* CIM Server is terminating, we HAVE to do cleanup now */
    }
}




C++ providers may use the CIMOMHandle::disallowProviderUnload() method to
remain loaded even when idle by using the disallowProviderUnload() call in
the initialize method of your Provider


void disallowProviderUnload()
Provides a hint to the CIM Server that the provider calling this method
prefers not to be unloaded. This hint applies in situations where a
provider unload is not necessary, such as when the CIM Server unloads idle
providers for efficiency reasons. A provider may rescind this hint by using
the allowProviderUnload method. Note that disallowProviderUnload is
cumulative, such that each call to disallowProviderUnload must be matched
with a call to allowProviderUnload.

For example you can refer link
http://cvs.opengroup.org/cgi-bin/viewcvs.cgi/pegasus/src/Pegasus/Provider/CIMOMHandle.h
http://cvs.opengroup.org/cgi-bin/viewcvs.cgi/pegasus/src/Providers/slp/SLPProvider.cpp

Regards
Ashok


                                                                           
             Vijayalakshmi                                                 
             Subramanyam                                                   
             <viji.sub87@gmail                                          To 
             .com>                     Devchandra L Meetei                 
                                       <[email protected]>,               
             05/09/2013 09:19                                           cc 
             AM                        "[email protected]"         
                                       <[email protected]>         
                                                                   Subject 
                                       Re: Unloading a CMPI provider       
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi Dev,

I checked both the cases and there seems to be no valid reason why the
provider is not getting unload .
Is it possible that during registration of this provider , i may have set
some property to avoid unloading ?

Thanks,
Viji

On Wed, May 8, 2013 at 10:00 AM, Devchandra L Meetei <[email protected]>
wrote:
  By Default, idle providers unload when it is idle for 5 minutes, By idle,
  we mean, It is not processing any request.

  Another case where module will not unload is when group of provider
  module is *cimserver*.

  So you might like to verify above two cases also.


  On Wed, May 8, 2013 at 9:45 AM, Vijayalakshmi Subramanyam <
  [email protected]> wrote:
   Hi All,

   I have three CMPI providers in my system. Two of them unload
   automatially when idle.

   One provider fails to unload. I do not see the terminate() call come
   into the provider itself. I am sure there are no open subscriptions.

   I also checked that the provider is not returning  CMPI_RC_DO_NOT_UNLOAD
   or CMPI_RC_NEVER_UNLOAD in any condition.

   This is the log message that i see in the cimtrace file for this
   provider -

   [2876:18446744073709551614:CMPILocalProviderManager.cpp:256]:
   CMPILocalProviderManager::_provider_ctrl:
   UNLOAD_IDLE_PROVIDERS
   1367898721s-801162us: ProviderManager
   [2876:18446744073709551614:CMPILocalProviderManager.cpp:309]: Checking
   timeout data for CMPIProvider: arcRAIDProvider15
   1367898721s-801162us: ProviderManager
   [2876:18446744073709551614:CMPILocalProviderManager.cpp:318]:
   provider->unload_ok() returns: false
   1367898721s-801162us: Thread
   [2876:18446744073709551614:ThreadPool.cpp:224]: Work finished.

   Is there something I am missing ?

   Regards,
   Viji



  --
  Warm Regards
  --Dev
  OpenPegasus Developer/Committer

  (\__/)
  (='.'=) This is Bunny. Copy and paste bunny
  (")_(") to help him gain world domination.