Needs a lot of work, but it's a start. Signed-off-by: Andy Grover <agrover@redhat.com> --- liblvm/python/test.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) create mode 100644 liblvm/python/test.py diff --git a/liblvm/python/test.py b/liblvm/python/test.py new file mode 100644 index 0000000..62ab74e --- /dev/null +++ b/liblvm/python/test.py @@ -0,0 +1,42 @@ +#----------------------------- +#Python example code: +#----------------------------- + +import liblvm + +# create a new LVM instance +lvm = liblvm.Liblvm() + +# open a VG handle in write mode for 'myvg' +vg = lvm.vgOpen('myvg','w') + +# remove a new LV (lv_foobar) +lv = vg.createLvLinear('lv_foobar',100000) + +# print the uuid for the newly created LV +print lv.getUuid() + +#print the size. +print lv.getSize() + +# Add a tag to it. +lv.addTag("my_fance_tag") + +# Print all tags. +print lv.getTags() + +# Try to deactivate +try: + lv.deactivate() +except liblvm.LibLVMError: + print "lets retry.." + lv.deactivate() + +# remove +lv.remove() + +# close VG handle +vg.close() + +# close LVM handle +lvm.close() -- 1.7.1 _______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/