In order to understand the rest of this chapter, you will need to know a little about the way in which the openPegasus WBEM server handles providers. openPegasus is code made available from www.openpegasus.org under the conditions of the licence described in Appendix H. All code is written in C++ and it is anticipated, at least until the CMPI interface is available, that providers will also be written in C++.
Providers are loaded from shared library files (.so) when first invoked and, in version 2.2 of the openPegasus code, run in the WBEM server's address space. This is unfortunate because a faulty provider can bring the server down and it is planned that this will be resolved in a later openPegasus release. A particular provider may be flagged as "unloadable" and will be unloaded by the WBEM server following a preset period of inactivity: this can be particularly useful for providers which are invoked once at system initialisation and never again but might be inappropriate for providers which contain a great deal of state. Such state would need to be stored before the provider was unloaded and reloaded when it was again invoked.
The provider interface used for this example follows the interchanges shown in Figure 11.2 on page 209: the openPegasus WBEM server passes an address of a handler (not to be confused with an indication handler ”this is just the normal C++ use of the term handler) to the provider with the request; the provider is expected to call handler.processing() before starting to return the response, then handler.deliver() any number of times with the ( parts of the) response and finally handler.complete() to indicate that the response is complete. At this point the handler address becomes stale and must not be used.
Note that, at least in openPegasus version 2.2, the handler is not guaranteed to be thread-safe, so the whole provider must be implemented in a single thread. This is not an issue for the example in this chapter as it is extremely simple but it is something you may wish to consider for larger systems.
The openPegasus program suite contains a program for manipulating running providers, cimprovider , which allows you to disable (and thereby unload) specific providers. This is useful during debugging when it may be necessary to force the loading of a new version of a provider. The most useful commands are:
cimprovider -L -s: List all providers known to the WBEM server with their current status.
cimprovider -d -m providerName: Disable the named provider.
cimprovider -e -m providerName: Enable the named provider.
cimprovider -r -m providerName: Remove the named provider.
As a point of detail, it is perhaps worth noting that the default repository for openPegasus is a set of directories and files on disc. Although this makes debugging easy and allows the repository to persist while the WBEM server is unloaded and reloaded, it can sometimes be a nuisance. If, during debugging, you have made a mess of your mof code and want to clean everything out, then its persistence can be annoying. To clean everything out of the repository, it is only necessary to go into $PEGASUS_HOME/Schemas and type make clean .