CIM Provider HOWTO Document

Jan Safranek jsafrane at redhat.com
Mon Apr 8 15:03:54 UTC 2013


On 04/08/2013 04:38 PM, John Dennis wrote:
> On 04/08/2013 10:28 AM, Jan Safranek wrote:
>> On 04/08/2013 03:59 PM, John Dennis wrote:
>>> On 04/08/2013 04:51 AM, Roman Rakus wrote:
>>>> On 04/05/2013 08:47 PM, John Dennis wrote:
>>>>> On 04/05/2013 07:35 AM, Roman Rakus wrote:
>>>>>> I'm confused in section where you are describing structures and
>>>>>> array of
>>>>>> structures. I think this is where Embedded Instances take place.
>>>>>> However, the KonkretCMPI does not support embedded instances.
>>>>>
>>>>> Hello Roman:
>>>>>
>>>>> I'm not familiar with embedded instances. Can you elaborate or
>>>>> provide a
>>>>> pointer to documentation?
>>>>>
>>>>> Thanks.
>>>>>
>>>> I can't find much in documentation. Just in CIM Metamodel (CIM
>>>> Infrastructure Specification) [1] are few words about Embedded Objects.
>>>>
>>>> Embedded object is qualifier. For example you can have parameter of
>>>> method with this qualifier. Such parameter will be embedded object
>>>> (instance or class). The type of parameter is string. When we talk
>>>> about
>>>> instances - this string is encoded (embedded) instance of some class.
>>>> There are functions in CMPI to create instance from this string
>>>> representation.
>>>>
>>>> I have never used this. But I think it could help to encapsulate
>>>> definition of parameter and passing it, but with need of such
>>>> definition
>>>> in model.
>>>
>>> Ah, O.K. yes this now rings a bell with me and I did momentarily
>>> consider this as an option.  My understanding is it amounts to
>>> formatting the data in MOF syntax and passing it as a string. One then
>>> parses the MOF formatted string.
>>>
>>> My take on this is:
>>>
>>> * It's very awkward to use, it's not a friendly API scheme.
>>>
>>> * I didn't find any support for parsing MOF syntax in any of the
>>> libraries a provider links with.
>>
>> It's not MOF formatted string, it's CIM object instance encoded in XML
>> as string-value of a property.
>>
>> On server (CIMOM) side, this is automatically handled and translated
>> into CMPI_instance property, on client side, pywbem handles it
>> transparently too.
> 
> Thank you Jan, great information!
> 
> Is this supported on all the CIMOM's we're interested in?
> 
> Is there client support for generating the XML?

EmbeddedInstance qualifier is supported both by SFCB and Pegasus. There
is also similar EmbeddedObject qualifier, which is 99% the same:

EmbeddedInstance qualifier must include a class name. Method parameter
or property with this qualifier then must have instance of the specified
class, encoded into XML, as its value.

class CIM_FileSystemConfigurationService : CIM_Service
{
//...
    uint32 CreateFileSystem(
        //...
        [IN, Description ( "..."),
          EmbeddedInstance ( "CIM_FileSystemSetting" )]
      string Goal,
};

On the other hand, EmbeddedObject qualifier does *not* include a class
name and method parameter or property can be of any class.
EmbeddedObjects are problematic in Pegasus, but upstream is working on a
fix.

class CIM_InstMethodCall : CIM_InstIndication
{
//...
   [Description (
          "The parameters of the method, formatted as an "
          "EmbeddedObject (with a predefined class name of "
          "\"__MethodParameters\"." ),
       EmbeddedObject]
   string MethodParameters;
};

I'm mainly working on server side, e.g. I'm implementing
CIM_MethodResult, which has property PreCallIndication, which is
EmbeddedInstance of CIM_InstMethodCall, which has property
MethodParameters, which is EmbeddedObject and all wraps nicely.

On client side, I can access these properties transparently using pywbem
- the XML string is translated from/to CIMInstance  automatically. I
guess that the same applies to parameters of methods, just pass
CIMInstance instead of string with XML as a method argument.

Regarding other CIM client libraries, I have no idea if EmbeddedInstance
is supported or not.

Jan


More information about the openlmi-devel mailing list