1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

7 Commits

Author SHA1 Message Date
Tony Asleson
bbff143d54 python-lvm: Memory leaks & seg. fault fixes
Issues found (thus far) in unit test developemnt for python bindings.

Added Py_DECREF(ptr) in liblvm_lvm_vg_open & liblvm_lvm_vg_create
in error paths so that we correctly clean up memory.

Added a call to lvm_vg_close when we remove a vg.  The code was
clearing out the vg pointer which prevented us from actually
calling lvm_vg_close in the close path.

liblvm_lvm_vg_create_lv_linear was not initializing
lvobj->parent_vgobj and if lvm_vg_create_lv_linear failed
we went through liblvm_lv_dealloc on clean up and tried to
Py_DECREF an invalid pointer.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2012-10-25 18:09:10 -05:00
Tony Asleson
8073ce1690 python-lvm: seg. fault in liblvm_lvm_percent_to_float
The first parameter needs to be present even if it isn't being
used, otherwise the one any only parameter we get is null
which causes PyArg_ParseTuple to seg. fault.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2012-10-23 14:54:06 -05:00
Andy Grover
0e47639a44 python-lvm: Implement proper refcounting for parent objects
Our object nesting:

lib -> VG -> LV -> lvseg
          -> PV -> pvseg

Implement refcounting and checks to ensure parent objects are not
dealloced before their children. Also ensure calls to self or child's
methods are handled cleanly for objects that have been closed or removed.

Ensure all functions that are object methods have a first parameter named
'self', for consistency

Rename local vars that reference a Python object to '*obj', in order to
differentiate from liblvm handles

Fix a misspelled pv method name

Signed-off-by: Andy Grover <agrover@redhat.com>
2012-10-17 12:55:25 -07:00
Tony Asleson
10ba799ab0 python-lvm: Update example to work with lvm object removal.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
2012-10-15 14:11:10 -07:00
Andy Grover
12b631a676 python-lvm: whitespace and Yoda conditionals
Signed-off-by: Andy Grover <agrover@redhat.com>
2012-10-15 14:11:10 -07:00
Andy Grover
84a4d4b970 python-lvm: Remove liblvm object
Instead of requiring users to create a liblvm object, and then calling
methods on it, the module acquires a liblvm handle as part of
initialization. This makes it impossible to instantiate a liblvm object
with a different systemdir, but there is an alternate envvar method for
that obscure use case.

Signed-off-by: Andy Grover <agrover@redhat.com>
2012-10-15 14:11:10 -07:00
Alasdair G Kergon
ee3cfa4184 python: Add bindings for liblvm2app.
Use configure --enable-python_bindings to generate them.

Note that the Makefiles do not yet control the owner or permissions of
the two new files on installation.
2012-10-12 02:08:47 +01:00