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

21 Commits

Author SHA1 Message Date
Tony Asleson
40feaa7bbe python-lvm: Bug fixes from unit tests.
After the last rebase, existing unit test case was
run which uncovered a number of errors that required
attention.

Uninitialized variables and changes to type of numeric
return type were addressed.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
8882480083 python-lvm: Change snapshot call impl.
Using the new object parameter creation to create the snapshot.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
2a3472b2b3 python-lvm: Bindings for thin pool, thin lv creation V3
V2: Bug fix.
V3: Use updated property interface, add constants for discard.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
f576b32203 python-lvm: Added lv method getOrigin
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
9e0260c2e3 python-lvm: Add method to retrieve lv attr.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
588a16cadb python-lvm: Add pvCreate python method
Added to base namespace.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
45a0f9e45b python-lvm: Add bindings for lvm_pv_remove
Method off of base lvm namespace "pvRemove".

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:34 -05:00
Tony Asleson
ef3ab801e8 lvm2app: Add function to retrieve list of PVs V3
As locks are held, you need to call the included function
to release the memory and locks when done transversing the
list of physical volumes.

V2: Rebase fix
V3: Prevent VGs from getting cached and then write protected.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:33 -05:00
Andy Grover
86e528c667 lvm2app: No special behavior for 0 for max_snap_size in lvm_lv_snapshot()
It isn't possible to choose a sane default for snapshot size, so just
play it straight and use the passed size instead of adding special
behavior for 0.

Also revert change to Python lib, size parameter must be supplied.

Signed-off-by: Andy Grover <agrover@redhat.com>
2012-12-17 14:14:38 -08:00
Andy Grover
0958905b1b python-lvm: Make second lv.snapshot() argument optional
If no size is given, size defaults to 0, which in lvm_lv_snapshot will
allocate extents equal to the original LV be allocated for the new
snapshot.

Signed-off-by: Andy Grover <agrover@redhat.com>
2012-12-14 14:10:41 -08:00
Andy Grover
0e3093979e python-lvm: whitespace in python/liblvm.c.
Sorry, it bugged me. Should be perfect now.

Signed-off-by: Andy Grover <agrover@redhat.com>
2012-12-14 10:32:35 -08:00
Andy Grover
58b61c252a python-lvm: Small fixups to new create_lv_snapshot
Tabify

Remove use of asize, unneeded.

Don't initialize lvobj->parent_vgobj to NULL, the object ctor already
zeroed everything on alloc.

Redo call to lvm_lv_snapshot to use the liblvm snapshot implementation
we went with.

Add {}s to silence warning in lv_dealloc.

Rename snapshot function for consistency.

Update WHATS_NEW.

Signed-off-by: Andy Grover <agrover@redhat.com>
2012-12-14 10:30:26 -08:00
James Antill
0db733f18a python-lvm: Add snapshot support
Signed-off-by: Andy Grover <agrover@redhat.com>
2012-12-14 10:30:13 -08:00
James Antill
1ec6a59dcf Fix Py_BuildValue for i386
see https://bugzilla.redhat.com/show_bug.cgi?id=881989

Signed-off-by: James Antill <james.antill@redhat.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
2012-12-05 16:31:50 -08:00
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