Giter Club home page Giter Club logo

cmpi-bindings's People

Contributors

alexanderlaw avatar jsafrane avatar kkaempf avatar mibanescu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmpi-bindings's Issues

segfaults when fetching instances

I traced it down to get_property_at. It was returning a tuple of 2 values, the first one being NULL (not None).

Looking at swig/cmpi_types.i, right in the TARGET_THREAD_BEGIN_BLOCK, looks like tdata could get set to Target_Null if the property is not set, which (for SWIGPYTHON) is NULL. So later down in the #if defined (SWIGPYTHON) section, tdata is set as the first item of the tuple, and therein lies the problem. Looking at the #define sections, I believe that should have been Target_Void. Looks like Target_Null and Target_Void are identical in Ruby, but they're not in python.

Also, you should incref Py_None before you pass it to PyTuple_SetItem, since PyTuple_SetItem steals the reference (in other words, it doesn't incref itself).

cmpi2pywbem_inst with NULL properties

If the value of a property is not set, the following code inside cmpi2pywbem_inst fails:

        data, name = cmpiinst.get_property_at(i)
        _type, is_array = _cmpi_type2string(data.type)

This is because data is None, so it has no data.type

I think data_data is at fault again, right now it does:

else if (dp->state & CMPI_nullValue) {
  result = Target_Null;
  Target_INCREF(result);
}

when it should really return dp.

Providers cannot call ExecQuery?

I noticed that providers cannot execute a query as upcall to CIMOM, is this an intention? Looking at CMPI API it looks it should be possible, but CMPIProxyProvider.exec_query explicitly returns CIM_ERR_NOT_SUPPORTED.

INCREF and Target_Append

(opening new issue with the last 2 comments from #1)

I'm looking at data_data in swig/cmpi.i. Just trying to clarify something for myself.
I think there is an unnecessary INCREF here:

else if ((dp->type) & CMPI_ARRAY) {
int size = CMGetArrayCount(dp->value.array, NULL);
int i;
result = Target_SizedArray(size);
for (i = 0; i < size; --i) {
CMPIData data = CMGetArrayElementAt(dp->value.array, i, NULL);
Target_Append(result, data_data(&data));
}
Target_INCREF(result);
}

To my knowledge, PyList_New (which is what Target_SizedArray is defined to) will return a "protected" object (a new reference). So the last Target_INCREF will leak memory.

(same problem in data_value)

...

I am even more confused now. Target_SizedArray will return a Python list of the specified size. We shouldn't append to that list (which is what Target_Append does), I think we should use PyList_SetItem. Or you could define an empty list initially and then append to it, although I would expect the former approach to be more memory-efficient.

InvokeMethod upcall doesn't work

Documentation at http://sourceforge.net/apps/mediawiki/pywbem/index.php?title=Upcalls#InvokeMethod says, that InvokeMethod() should be called with simple parameters like this:

InvokeMethod(myInstanceName, 'HelloWorld', firstParam = pywbem.Uint16(0))

However, this raises an exception:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cmpi_pywbem_bindings.py", line 82, in __call__
    return self.meth(*args, **kwds)
  File "/usr/lib/python2.7/site-packages/cmpi_pywbem_bindings.py", line 595, in invoke_method
    op, method, pinargs)
  File "/usr/lib/python2.7/site-packages/pywbem/cim_provider2.py", line 2011, in MI_invokeMethod
    (env, objectName, methodName, inputParams)
  File "/usr/lib/python2.7/site-packages/pywbem/cim_provider2.py", line 878, in MI_invokeMethod
    **new_inputs)
  File "/usr/lib/python2.7/site-packages/pycim/ASP_StorageConfigurationService.py", line 1963, in cim_method_createraid
    (ret, outparams) = cliconn.InvokeMethod(partService, 'SetPartitionStyle', Extent = disk, PartitionStyle = partStyle)
  File "/usr/lib/python2.7/site-packages/cmpi_pywbem_bindings.py", line 313, in InvokeMethod
    inargs=self.proxy.pywbem2cmpi_args(params)
  File "/usr/lib/python2.7/site-packages/cmpi_pywbem_bindings.py", line 727, in pywbem2cmpi_args
    for name, (_type, pval) in pargs.items():
  File "/usr/lib/python2.7/site-packages/pywbem/cim_obj.py", line 533, in __getitem__
    def __getitem__(self, key): return self.keybindings[key]
  File "/usr/lib/python2.7/site-packages/pywbem/cim_obj.py", line 76, in __getitem__
    return self.data[k][1]

InvokeMethod() tries to convert *_params to cmpi format using pywbem2cmpi_args, and pywbem2cmpi_args expects, that *_params is dictionary of (type, value) tuples. And it is not. Either the documentation or the code is wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.