linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andy Grover <agrover@redhat.com>
To: linux-lvm@redhat.com
Subject: [linux-lvm] [PATCH 2/6] python-lvm: A start at a python-lvm test framework
Date: Fri, 14 Sep 2012 10:54:40 -0700	[thread overview]
Message-ID: <1347645284-13738-3-git-send-email-agrover@redhat.com> (raw)
In-Reply-To: <1347645284-13738-1-git-send-email-agrover@redhat.com>

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

  parent reply	other threads:[~2012-09-14 17:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 17:54 [linux-lvm] [PATCH 0/6] Integrate python-lvm into lvm2 Andy Grover
2012-09-14 17:54 ` [linux-lvm] [PATCH 1/6] python-lvm: initial checkin Andy Grover
2012-09-14 17:54 ` Andy Grover [this message]
2012-09-14 17:54 ` [linux-lvm] [PATCH 3/6] python-lvm: setup.py Andy Grover
2012-09-14 17:54 ` [linux-lvm] [PATCH 4/6] python-lvm: liblvm/python/Makefile.in Andy Grover
2012-09-14 17:54 ` [linux-lvm] [PATCH 5/6] python-lvm: configure.in changes Andy Grover
2012-09-14 17:54 ` [linux-lvm] [PATCH 6/6] python-lvm: Other Makefile.in changes Andy Grover

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347645284-13738-3-git-send-email-agrover@redhat.com \
    --to=agrover@redhat.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).