All of lore.kernel.org
 help / color / mirror / Atom feed
* liblvm Python/C extension (Python Liblvm)
@ 2012-03-22  7:17 Killian De Volder
  0 siblings, 0 replies; 7+ messages in thread
From: Killian De Volder @ 2012-03-22  7:17 UTC (permalink / raw)
  To: lvm-devel

@Lars,
I'm rather interested in this, have there been any updates ?

@The community,
Are there any plans for allowing python binding in the lvm-sources, or should this be a separate package ?
I also detect no way in lvm2app to create for example a snapshot. So I'm going to assume there is also need for work here.
Or is C binding of LVM generally a bad idea, and should we instead parse the lvm-tool output and communicate with LVM trough those means ?

Feedback is welcome of course.

Kind regards,
Killian De Volder

>  Hello,
>
>  I was missing a proper LVM2 interface to Python so I decided to write
>  one my self! I have wrapped all the liblvm C APIs (excluding the new
>  APIs committed in Dec). Doc strings are still missing, as well as proper
>  setup.py build env, so consider it as work in progress.
>
>  This might also be interesting to other projects like Anaconda for
>  example.
>
>  I would love to get your feedback on it!
>
>  Best regards,
>  Lars



^ permalink raw reply	[flat|nested] 7+ messages in thread
* liblvm Python/C extension (Python Liblvm)
@ 2011-01-20 12:49 Lars Sjöström
  2011-01-20 15:24 ` Zdenek Kabelac
  2011-01-24  0:11 ` Petr Rockai
  0 siblings, 2 replies; 7+ messages in thread
From: Lars Sjöström @ 2011-01-20 12:49 UTC (permalink / raw)
  To: lvm-devel

Hello,

I was missing a proper LVM2 interface to Python so I decided to write
one my self! I have wrapped all the liblvm C APIs (excluding the new
APIs committed in Dec). Doc strings are still missing, as well as proper
setup.py build env, so consider it as work in progress.

This might also be interesting to other projects like Anaconda for
example.

I would love to get your feedback on it!

Best regards,
Lars 

-----------------------------
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()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: liblvm.c
Type: text/x-csrc
Size: 28425 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20110120/e7f5ebc1/attachment.bin>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-22  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22  7:17 liblvm Python/C extension (Python Liblvm) Killian De Volder
  -- strict thread matches above, loose matches on Subject: below --
2011-01-20 12:49 Lars Sjöström
2011-01-20 15:24 ` Zdenek Kabelac
2011-01-24  0:11 ` Petr Rockai
2011-01-24  9:58   ` Lars Sjöström
2011-01-24 10:10     ` Zdenek Kabelac
2011-01-24 10:08   ` Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.