Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=10ba799ab08001d5…
Commit: 10ba799ab08001d5435425e65f039f20cadd306e
Parent: 12b631a6768e6f2a2005ef8ea91c0afbc2455c54
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Oct 15 13:54:19 2012 -0700
Committer: Andy Grover <agrover(a)redhat.com>
CommitterDate: Mon Oct 15 14:11:10 2012 -0700
python-lvm: Update example to work with lvm object removal.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
Signed-off-by: Andy Grover <agrover(a)redhat.com>
---
python/example.py | 35 +++++++++++++++--------------------
1 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/python/example.py b/python/example.py
index 67bb7e4..5c14ee1 100644
--- a/python/example.py
+++ b/python/example.py
@@ -31,9 +31,9 @@ def print_pv(pv):
#Dump some information about a specific volume group
-def print_vg(h, vg_name):
+def print_vg(vg_name):
#Open read only
- vg = h.vgOpen(vg_name, 'r')
+ vg = lvm.vgOpen(vg_name, 'r')
print 'Volume group:', vg_name, 'Size: ', vg.getSize()
@@ -55,13 +55,13 @@ def print_vg(h, vg_name):
vg.close()
#Returns the name of a vg with space available
-def find_vg_with_free_space(h):
+def find_vg_with_free_space():
free_space = 0
rc = None
- vg_names = l.listVgNames()
+ vg_names = lvm.listVgNames()
for v in vg_names:
- vg = h.vgOpen(v, 'r')
+ vg = lvm.vgOpen(v, 'r')
c_free = vg.getFreeSize()
if c_free > free_space:
free_space = c_free
@@ -72,13 +72,13 @@ def find_vg_with_free_space(h):
#Walk through the volume groups and fine one with space in which we can
#create a new logical volume
-def create_delete_logical_volume(h):
- vg_name = find_vg_with_free_space(h)
+def create_delete_logical_volume():
+ vg_name = find_vg_with_free_space()
print 'Using volume group ', vg_name, ' for example'
if vg_name:
- vg = h.vgOpen(vg_name, 'w')
+ vg = lvm.vgOpen(vg_name, 'w')
lv = vg.createLvLinear('python_lvm_ok_to_delete', vg.getFreeSize())
if lv:
@@ -93,11 +93,11 @@ def create_delete_logical_volume(h):
#Remove tag
lv.removeTag(t)
+ lv.deactivate()
+
#Try to rename
- lv.rename("python_lvm_ok_to_be_removed_shortly")
+ lv.rename("python_lvm_renamed")
print 'LV name= ', lv.getName()
-
- lv.deactivate()
lv.remove()
vg.close()
@@ -105,21 +105,16 @@ def create_delete_logical_volume(h):
print 'No free space available to create demo lv!'
if __name__ == '__main__':
- #Create a new LVM instance
- l = lvm.Liblvm()
-
#What version
- print 'lvm version=', l.getVersion()
+ print 'lvm version=', lvm.getVersion()
#Get a list of volume group names
- vg_names = l.listVgNames()
+ vg_names = lvm.listVgNames()
#For each volume group display some information about each of them
for vg_i in vg_names:
- print_vg(l, vg_i)
+ print_vg(vg_i)
#Demo creating a logical volume
- create_delete_logical_volume(l)
+ create_delete_logical_volume()
- #Close
- l.close()
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=831ce3cda941f025…
Commit: 831ce3cda941f02556dd8c4a407754397df17997
Parent: 67379a3ffdafa69a2830a1155fe9b4689bbf71cb
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Oct 15 15:43:15 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Oct 15 15:43:15 2012 -0500
TEST: Re-add testing of lvconvert-raid for kernels < 3.2
I'm not sure what 'BUG's were being encountered when the restriction
to limit lvconvert-raid.sh tests to kernels > 3.2 was added. I do know
that there were BUG's that could be triggered when testing snapshots and
some of the earliest DM RAID available in the kernel. I've taken out
the 3.2 kernel restriction and added a dm-raid >= 1.2 restriction instead.
This will allow the test to run on patched production kernels.
---
test/shell/lvconvert-raid.sh | 18 +++---------------
1 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 4fa766d..59c8bdb 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -22,8 +22,7 @@ get_image_pvs() {
########################################################
# MAIN
########################################################
-aux target_at_least dm-raid 1 1 0 || skip
-aux kernel_at_least 3 2 0 || skip
+aux target_at_least dm-raid 1 2 0 || skip
# 9 PVs needed for RAID10 testing (3-stripes/2-mirror - replacing 3 devs)
aux prepare_pvs 9 80
@@ -33,8 +32,8 @@ vgcreate -c n -s 256k $vg $(cat DEVICES)
# RAID1 convert tests
###########################################
for under_snap in false true; do
-for i in 1 2 3 4; do
- for j in 1 2 3 4; do
+for i in 1 2 3; do
+ for j in 1 2 3; do
if [ $i -eq 1 ]; then
from="linear"
else
@@ -121,17 +120,6 @@ check linear $vg $lv2
# FIXME: ensure no residual devices
lvremove -ff $vg
-# 3-way to linear/2-way
-lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg
-aux wait_for_sync $vg $lv1
-# FIXME: Can't split off a RAID1 from a RAID1 yet
-# 'should' results in "warnings"
-should lvconvert --splitmirrors 2 -n $lv2 $vg/$lv1
-#check linear $vg $lv1
-#check lv_exists $vg $lv2
-# FIXME: ensure no residual devices
-lvremove -ff $vg
-
###########################################
# RAID1 split + trackchanges / merge
###########################################
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=67379a3ffdafa69a…
Commit: 67379a3ffdafa69a2830a1155fe9b4689bbf71cb
Parent: 7519d881ef07c4a515716099a4bf9566b7f71b1a
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Oct 15 15:41:14 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Oct 15 15:41:14 2012 -0500
RAID: Add "raid10" to lvcreate man page.
In addition to reference to raid10 under the '--type' argument, an
example creating a RAID10 LV has been added.
---
man/lvcreate.8.in | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index fb54cc6..f374950 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -298,7 +298,7 @@ commandline switch alias that will enable their use
However, this argument must be used when no existing
commandline switch alias is available for the desired type,
as is the case with
-.IR error ", " zero ", " raid1 ", " raid4 ", " raid5 " or " raid6 .
+.IR error ", " zero ", " raid1 ", " raid10 ", " raid4 ", " raid5 " or " raid6 .
.TP
.BR \-V ", " \-\-virtualsize " " \fIVirtualSize [ \fIbBsSkKmMgGtTpPeE ]
Create a sparse device of the given size (in MB by default) using a snapshot
@@ -363,6 +363,14 @@ a parity drive for a total of 4 devices) and a stripesize of 64KiB:
.sp
.B lvcreate \-\-type raid5 \-L 5G \-i 3 \-I 64 \-n my_lv vg00
+Creates a 5GiB RAID10 logical volume "vg00/my_lv", with 2 stripes on
+2 2-way mirrors. Note that the '-i' and '-m' arguments behave differently.
+The '-i' specifies the number of stripes. The '-m' specifies the number of
+.B additional
+copies.
+.sp
+.B lvcreate \-\-type raid10 \-L 5G \-i 2 \-m 1 \-n my_lv vg00
+
Creates 100MiB pool logical volume for thin provisioning
build with 2 stripes 64KiB and chunk size 128KiB together with
1TiB thin provisioned logical volume "vg00/thin_lv":