master - liblvm: internal API change
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2e96ea4a899a0d...
Commit: 2e96ea4a899a0d0a5adb5e3d8fa09e04fd7a4173
Parent: cf5242a670010a7c0137090a330b78b3bf43a55b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 13 10:49:32 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 14:37:30 2012 +0100
liblvm: internal API change
Return LV/NULL instead of 1/0 which saves lookup for created LV.
---
lib/metadata/lv_manip.c | 6 +++---
lib/metadata/metadata-exported.h | 4 ++--
liblvm/lvm_lv.c | 8 +++-----
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9f87854..dc315ac 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4714,8 +4714,8 @@ revert_new_lv:
return NULL;
}
-int lv_create_single(struct volume_group *vg,
- struct lvcreate_params *lp)
+struct logical_volume *lv_create_single(struct volume_group *vg,
+ struct lvcreate_params *lp)
{
struct logical_volume *lv;
@@ -4743,5 +4743,5 @@ int lv_create_single(struct volume_group *vg,
out:
log_print_unless_silent("Logical volume \"%s\" created", lv->name);
- return 1;
+ return lv;
}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index b586936..ffec129 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -626,8 +626,8 @@ struct lvcreate_params {
struct dm_list tags; /* all */
};
-int lv_create_single(struct volume_group *vg,
- struct lvcreate_params *lp);
+struct logical_volume *lv_create_single(struct volume_group *vg,
+ struct lvcreate_params *lp);
/*
* Functions for layer manipulation
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index d47a857..77bdebf 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -146,7 +146,7 @@ lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
{
struct lvcreate_params lp = { 0 };
uint64_t extents;
- struct lv_list *lvl;
+ struct logival_volume *lv;
if (vg_read_error(vg))
return NULL;
@@ -162,11 +162,9 @@ lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
_lv_set_default_params(&lp, vg, name, extents);
if (!_lv_set_default_linear_params(vg->cmd, &lp))
return_NULL;
- if (!lv_create_single(vg, &lp))
+ if (!(lv = lv_create_single(vg, &lp)))
return_NULL;
- if (!(lvl = find_lv_in_vg(vg, name)))
- return NULL;
- return (lv_t) lvl->lv;
+ return (lv_t) lv;
}
/*
11 years
master - lvconvert: store target attributes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cf5242a670010a...
Commit: cf5242a670010a7c0137090a330b78b3bf43a55b
Parent: 2c3bbf0a6cf33de8f1b2a08fcb79da3f881d3472
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 15 10:32:13 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 14:17:10 2012 +0100
lvconvert: store target attributes
Target tells us its version, and we may allow different set of options
to be supported with different version of driver.
Idea is to provide individual feature flags and later be
able to query for them.
---
lib/metadata/metadata-exported.h | 1 +
tools/lvconvert.c | 3 ++-
tools/lvcreate.c | 3 +--
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 00be606..b586936 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -609,6 +609,7 @@ struct lvcreate_params {
uint32_t mirrors; /* mirror */
const struct segment_type *segtype; /* all */
+ unsigned target_attr; /* all */
/* size */
uint32_t extents; /* all */
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 27d8181..7d03a5f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -41,6 +41,7 @@ struct lvconvert_params {
uint32_t stripe_size;
const struct segment_type *segtype;
+ unsigned target_attr;
alloc_policy_t alloc;
@@ -460,7 +461,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
}
if (activation() && lp->segtype && lp->segtype->ops->target_present &&
- !lp->segtype->ops->target_present(cmd, NULL, NULL)) {
+ !lp->segtype->ops->target_present(cmd, NULL, &lp->target_attr)) {
log_error("%s: Required device-mapper target(s) not "
"detected in your kernel", lp->segtype->name);
return 0;
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 5d687ac..dad0ba7 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -679,7 +679,6 @@ static int _lvcreate_params(struct lvcreate_params *lp,
struct arg_value_group_list *current_group;
const char *segtype_str;
const char *tag;
- unsigned attr = 0;
memset(lp, 0, sizeof(*lp));
memset(lcp, 0, sizeof(*lcp));
@@ -796,7 +795,7 @@ static int _lvcreate_params(struct lvcreate_params *lp,
}
if (activation() && lp->segtype->ops->target_present &&
- !lp->segtype->ops->target_present(cmd, NULL, &attr)) {
+ !lp->segtype->ops->target_present(cmd, NULL, &lp->target_attr)) {
log_error("%s: Required device-mapper target(s) not "
"detected in your kernel", lp->segtype->name);
return 0;
11 years
master - cleanup: move setting of parameter zero
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2c3bbf0a6cf33d...
Commit: 2c3bbf0a6cf33de8f1b2a08fcb79da3f881d3472
Parent: 54c73b7723713f43413584d59ca0bdd42c1d8241
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 15 14:47:37 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 14:15:43 2012 +0100
cleanup: move setting of parameter zero
Since we may need to use different default value,
move read of zero_ARG prior processing of parameters.
---
tools/lvcreate.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 3ea8f46..5d687ac 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -812,6 +812,12 @@ static int _lvcreate_params(struct lvcreate_params *lp,
}
}
+ /*
+ * Should we zero the lv.
+ */
+ lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
+ (lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
+
if (!_lvcreate_name_params(lp, cmd, &argc, &argv) ||
!_read_size_params(lp, lcp, cmd) ||
!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size) ||
@@ -877,12 +883,6 @@ static int _lvcreate_params(struct lvcreate_params *lp,
return 0;
}
- /*
- * Should we zero the lv.
- */
- lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
- (lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
-
if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) {
log_error("Only up to %d images in mirror supported currently.",
DEFAULT_MIRROR_MAX_IMAGES);
11 years
master - mirror: Mirrored log should be fixed before mirror when double fault occurs
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=54c73b7723713f...
Commit: 54c73b7723713f43413584d59ca0bdd42c1d8241
Parent: 7a34db0cfdeab53e56182c7499214016a93706b2
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Nov 14 14:58:47 2012 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Nov 14 14:58:47 2012 -0600
mirror: Mirrored log should be fixed before mirror when double fault occurs
This patch is intended to fix bug 825323 - FS turns read-only during a double
fault of a mirror leg and mirrored log's leg at the same time. It only
affects a 2-way mirror with a mirrored log. 3+-way mirrors and mirrors
without a mirrored log are not affected.
The problem resulted from the fact that the top level mirror was not
using 'noflush' when suspending before its "down-convert". When a
mirror image fails, the bios are queue until a suspend is recieved. If
it is a 'noflush' suspend, the bios can be safely requeued in the DM
core. If 'noflush' is not used, the bios must be pushed through the
target and if a device is failed for a mirror, that means issuing an
error. When an error is received by a file system, it results in it
turning read-only (depending on the FS).
Part of the problem was is due to the nature of the stacking involved in
using a mirror as a mirror's log. When an image in each fail, the top
level mirror stalls because it is waiting for a log flush. The other
stalls waiting for corrective action. When the repair command is issued,
the entire stacked arrangement is collapsed to a linear LV. The log
flush then fails (somewhat uncleanly) and the top-level mirror is suspended
without 'noflush' because it is a linear device.
This patch allows the log to be repaired first, which in turn allows the
top-level mirror's log flush to complete cleanly. The top-level mirror
is then secondarily reduced to a linear device - at which time this mirror
is suspended properly with 'noflush'.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 8 ++------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 972d87b..8117165 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Mirrored log is now fixed before its mirror when double-fault occurs.
Add python-lvm unit test case
Exit pvscan --cache immediately if cluster locking used or lvmetad not used.
Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f23fc4b..27d8181 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1341,10 +1341,6 @@ int mirror_remove_missing(struct cmd_context *cmd,
if (!(failed_pvs = _failed_pv_list(lv->vg)))
return_0;
- /* No point in keeping a log if the result is not a mirror */
- if (_failed_mirrors_count(lv) + 1 >= lv_mirror_count(lv))
- log_count = 0;
-
if (force && _failed_mirrors_count(lv) == lv_mirror_count(lv)) {
log_error("No usable images left in %s.", lv->name);
return lv_remove_with_dependencies(cmd, lv, DONT_PROMPT, 0);
@@ -1363,8 +1359,8 @@ int mirror_remove_missing(struct cmd_context *cmd,
_is_partial_lv, NULL, 0))
return 0;
- if (!_lv_update_log_type(cmd, NULL, lv, failed_pvs,
- log_count))
+ if (lv_is_mirrored(lv) &&
+ !_lv_update_log_type(cmd, NULL, lv, failed_pvs, log_count))
return 0;
if (!_reload_lv(cmd, lv->vg, lv))
11 years
master - python-lvm: Initial check-in of python-lvm unit test case.
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7a34db0cfdeab5...
Commit: 7a34db0cfdeab53e56182c7499214016a93706b2
Parent: fefb2f03c3fe49e855f21f7d4952b6a2318113cc
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 26 15:35:17 2012 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Nov 14 13:18:37 2012 -0600
python-lvm: Initial check-in of python-lvm unit test case.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
WHATS_NEW | 1 +
test/api/pytest.sh | 27 +++
test/api/python_lvm_unit.py | 375 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 403 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index fd38a34..972d87b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add python-lvm unit test case
Exit pvscan --cache immediately if cluster locking used or lvmetad not used.
Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue.
Remove dependency on fedora-storage-init.service in lvm2 systemd units.
diff --git a/test/api/pytest.sh b/test/api/pytest.sh
new file mode 100644
index 0000000..ad99624
--- /dev/null
+++ b/test/api/pytest.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_vg 1
+lvcreate -n test -l 5 $vg
+
+#Locate the python binding library to use.
+python_lib=`find $abs_top_builddir -name lvm.so`
+if [ "$python_lib" != "" ]
+then
+ export PYTHONPATH=`dirname $python_lib`:$PYTHONPATH
+ python_lvm_unit.py
+else
+ echo "Unable to test python bindings as library not available"
+fi
diff --git a/test/api/python_lvm_unit.py b/test/api/python_lvm_unit.py
new file mode 100755
index 0000000..fdeca75
--- /dev/null
+++ b/test/api/python_lvm_unit.py
@@ -0,0 +1,375 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import unittest
+import random
+import string
+import lvm
+
+# Set of basic unit tests for the python bindings.
+
+def rs(l=10):
+ """
+ Generate a random string
+ """
+ return ''.join(random.choice(string.ascii_uppercase) for x in range(l))
+
+
+class TestLvm(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testOpenClose(self):
+ pass
+
+ def testVersion(self):
+ version = lvm.getVersion()
+ self.assertNotEquals(version, None)
+ self.assertEquals(type(version), str)
+ self.assertTrue(len(version) > 0)
+
+ def testVgOpen(self):
+ vg_names = lvm.listVgNames()
+
+ for i in vg_names:
+ vg = lvm.vgOpen(i)
+ vg.close()
+
+ def _get_lv_test(self, mode='r'):
+ vg_name_list = lvm.listVgNames()
+ for vgname in vg_name_list:
+ vg = lvm.vgOpen(vgname, mode)
+ lvs = vg.listLVs()
+ if len(lvs):
+ return lvs[0]
+ return None
+
+ def _get_pv_test(self, mode='r'):
+ vg_name_list = lvm.listVgNames()
+ for vgname in vg_name_list:
+ vg = lvm.vgOpen(vgname, mode)
+ pvs = vg.listPVs()
+ if len(pvs):
+ return pvs[0]
+ return None
+
+ def testPvGetters(self):
+ pv = self._get_pv_test()
+
+ self.assertEqual(type(pv.getName()), str)
+ self.assertTrue(len(pv.getName()) > 0)
+
+ self.assertEqual(type(pv.getUuid()), str)
+ self.assertTrue(len(pv.getUuid()) > 0)
+
+ self.assertEqual(type(pv.getMdaCount()), int)
+ self.assertEqual(type(pv.getMdaCount()), int)
+
+ self.assertEqual(type(pv.getSize()), int)
+
+ self.assertEqual(type(pv.getDevSize()), int)
+
+ self.assertEqual(type(pv.getFree()), int)
+
+ def _test_prop(self, prop_obj, prop, var_type, settable):
+ result = prop_obj.getProperty(prop)
+
+ self.assertEqual(type(result[0]), var_type)
+ self.assertEqual(type(result[1]), bool)
+ self.assertTrue(result[1] == settable)
+
+ def testPvSegs(self):
+ pv = self._get_pv_test("r")
+ pv_segs = pv.listPVsegs()
+
+ #LVsegs returns a tuple, (value, bool settable)
+
+ #TODO: Test other properties of pv_seg
+ for i in pv_segs:
+ self._test_prop(i, 'pvseg_start', long, False)
+
+ def testPvProperty(self):
+ pv = self._get_pv_test("r")
+ self._test_prop(pv, 'pv_mda_count', long, False)
+
+ def testLvProperty(self):
+ lv = self._get_lv_test("r")
+ self._test_prop(lv, 'seg_count', long, False)
+
+ def testLvTags(self):
+ lv = self._get_lv_test("w")
+ self._testTags(lv)
+
+ def testLvActiveInactive(self):
+ lv = self._get_lv_test("w")
+ lv.deactivate()
+ self.assertTrue(lv.isActive() == False)
+ lv.activate()
+ self.assertTrue(lv.isActive() == True)
+
+ def testLvRename(self):
+ lv = self._get_lv_test("w")
+
+ current_name = lv.getName()
+ new_name = rs()
+ lv.rename(new_name)
+ self.assertEqual(lv.getName(), new_name)
+ lv.rename(current_name)
+
+ def testLvSuspend(self):
+ lv = self._get_lv_test("r")
+
+ result = lv.isSuspended()
+ self.assertTrue(type(result), bool)
+
+ def testLvSize(self):
+ lv = self._get_lv_test("r")
+ result = lv.getSize()
+ self.assertTrue(type(result), bool)
+
+ def testLvResize(self):
+ pass #Not implemented!
+
+ def testPvResize(self):
+ pass #Patch available, not committed
+
+ def testLvSeg(self):
+ lv = self._get_lv_test("r")
+
+ lv_segs = lv.listLVsegs()
+
+ #LVsegs returns a tuple, (value, bool settable)
+
+ #TODO: Test other properties of lv_seg
+ for i in lv_segs:
+ self._test_prop(i, 'seg_start_pe', long, False)
+
+ def testLvMisc(self):
+ #Need to look at lack of vg_write in vg create
+
+ #For this to work cleanly we will remove an existing lv & vg and then
+ #put it back so that the test framework can clean it up.
+ vg_name_list = lvm.listVgNames()
+
+ if len(vg_name_list):
+ vg_name = vg_name_list[0]
+
+ vg = lvm.vgOpen(vg_name, "w")
+
+ vg_mda_copies = vg.getProperty('vg_mda_copies')
+ vg.setProperty('vg_mda_copies', vg_mda_copies[0])
+
+ pvs = vg.listPVs()
+ lvs = vg.listLVs()
+
+ pe_devices = []
+ for p in pvs:
+ pe_devices.append(p.getName())
+
+ self.assertEquals(len(lvs), 1)
+
+ lv = lvs[0]
+
+ lv_name = lv.getName()
+ lv_size = lv.getSize()
+
+ lv.remove()
+ lv = None
+
+ vg.reduce(pe_devices[0])
+
+ vg.remove()
+ vg.close()
+
+ nvg = lvm.vgCreate(vg_name)
+ for p in pe_devices:
+ nvg.extend(p)
+
+ #2MiB extent size
+ new_extent = 1024 * 1024 * 2
+
+ nvg.setExtentSize(new_extent)
+ self.assertEqual(nvg.getExtentSize(), new_extent)
+
+ v = nvg.createLvLinear(lv_name, lv_size)
+
+ lv_find_name = nvg.lvFromName(lv_name)
+ lv_find_uuid = nvg.lvFromUuid(v.getUuid())
+
+ self.assertTrue(lv_find_name.getName() == v.getName())
+ self.assertTrue(lv_find_uuid.getUuid() == v.getUuid())
+
+ nvg.close()
+
+ def testVgNames(self):
+ vg = lvm.listVgNames()
+ self.assertTrue(isinstance(vg, tuple))
+
+ def testDupeLvCreate(self):
+ """
+ Try to create a lv with the same name expecting a failure
+ Note: This was causing a seg. fault previously
+ """
+ vgs = lvm.listVgNames()
+
+ if len(vgs):
+ vg_name = vgs[0]
+ vg = lvm.vgOpen(vg_name, "w")
+
+ lvs = vg.listLVs()
+
+ if len(lvs):
+ lv = lvs[0]
+ lv_name = lv.getName()
+ self.assertRaises(lvm.LibLVMError, vg.createLvLinear, lv_name,
+ lv.getSize())
+
+ def testVgUuids(self):
+ vgs_uuids = lvm.listVgUuids()
+
+ self.assertTrue(isinstance(vgs_uuids, tuple))
+
+ vgs_uuids = list(vgs_uuids)
+
+ vgs_names = lvm.listVgNames()
+
+ for vg_name in vgs_names:
+ vg = lvm.vgOpen(vg_name, "r")
+
+ #TODO Write/fix BUG, vg uuid don't match between lvm.listVgUuids
+ # and vg.getUuid()
+ vg_uuid_search = vg.getUuid().replace('-', '')
+
+ self.assertTrue(vg_uuid_search in vgs_uuids)
+ vgs_uuids.remove(vg_uuid_search)
+
+ self.assertTrue(len(vgs_uuids) == 0)
+
+ def testPercentToFloat(self):
+ self.assertEqual(lvm.percentToFloat(0), 0.0)
+ self.assertEqual(lvm.percentToFloat(1000000), 1.0)
+ self.assertEqual(lvm.percentToFloat(1000000 / 2), 0.5)
+
+ def testScan(self):
+ self.assertEqual(lvm.scan(), None)
+
+ def testConfigReload(self):
+ self.assertEqual(lvm.configReload(), None)
+
+ def testConfig_override(self):
+ self.assertEquals(lvm.configOverride("global.test = 1"), None)
+
+ def testConfigFindBool(self):
+ self.assertTrue(lvm.configFindBool("global/locking_type"))
+ self.assertFalse(lvm.configFindBool("global/fallback_to_local_locking"))
+
+ def testVgFromPVLookups(self):
+ vgname_list = lvm.listVgNames()
+ for vg_name in vgname_list:
+ vg = lvm.vgOpen(vg_name, 'r')
+
+ vg_name = vg.getName()
+
+ pv_list = vg.listPVs()
+ for pv in pv_list:
+ vg_name_from_pv = lvm.vgNameFromPvid(pv.getUuid())
+ self.assertEquals(vg_name, vg_name_from_pv)
+ self.assertEqual(vg_name, lvm.vgNameFromDevice(pv.getName()))
+ vg.close()
+
+ def testVgGetName(self):
+ vgname_list = lvm.listVgNames()
+
+ for vg_name in vgname_list:
+ vg = lvm.vgOpen(vg_name, 'r')
+ self.assertEqual(vg.getName(), vg_name)
+ vg.close()
+
+ def testVgGetUuid(self):
+ vgname_list = lvm.listVgNames()
+
+ for vg_name in vgname_list:
+ vg = lvm.vgOpen(vg_name, 'r')
+ uuid = vg.getUuid()
+ self.assertNotEqual(uuid, None)
+ self.assertTrue(len(uuid) > 0)
+ vg.close()
+
+
+ RETURN_NUMERIC = ["getSeqno", "getSize", "getFreeSize", "getFreeSize",
+ "getExtentSize", "getExtentCount", "getFreeExtentCount",
+ "getPvCount", "getMaxPv", "getMaxLv"]
+
+ def testVgGetters(self):
+ vg_name_list = lvm.listVgNames()
+
+ for vg_name in vg_name_list:
+ vg = lvm.vgOpen(vg_name, 'r')
+ self.assertTrue(type(vg.isClustered()) == bool)
+ self.assertTrue(type(vg.isExported()) == bool)
+ self.assertTrue(type(vg.isPartial()) == bool)
+
+ #Loop through the list invoking the method
+ for method_name in TestLvm.RETURN_NUMERIC:
+ method = getattr(vg, method_name)
+ result = method()
+ self.assertTrue(type(result) == int)
+
+ vg.close()
+
+ def _testTags(self, tag_obj):
+ existing_tags = tag_obj.getTags()
+ self.assertTrue(type(existing_tags) == tuple)
+
+ num_tags = random.randint(2, 40)
+ created_tags = []
+
+ for i in range(num_tags):
+ tag_name = rs(random.randint(1, 128))
+ tag_obj.addTag(tag_name)
+ created_tags.append(tag_name)
+
+ tags = tag_obj.getTags()
+ self.assertTrue(len(existing_tags) + len(created_tags) == len(tags))
+
+ num_remove = len(created_tags)
+
+ for i in range(num_remove):
+ tag_to_remove = created_tags[random.randint(0, len(created_tags) - 1)]
+
+ created_tags.remove(tag_to_remove)
+
+ tag_obj.removeTag(tag_to_remove)
+
+ current_tags = tag_obj.getTags()
+ self.assertFalse(tag_to_remove in current_tags)
+
+ current_tags = tag_obj.getTags()
+ self.assertTrue(len(current_tags) == len(existing_tags))
+ for e in existing_tags:
+ self.assertTrue(e in current_tags)
+
+ def testVgTags(self):
+ vg_name_list = lvm.listVgNames()
+
+ for vg_name in vg_name_list:
+ vg = lvm.vgOpen(vg_name, 'w')
+ self._testTags(vg)
+ vg.close()
+
+if __name__ == "__main__":
+ unittest.main()
\ No newline at end of file
11 years
master - test: set LD_LIBRARY_PATH to all dirs with *.so
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fefb2f03c3fe49...
Commit: fefb2f03c3fe49e855f21f7d4952b6a2318113cc
Parent: fc2644ae71a87ea81979f66022b98ec49c692a66
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Oct 26 15:30:21 2012 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Nov 14 13:05:55 2012 -0600
test: set LD_LIBRARY_PATH to all dirs with *.so
Instead of manually editing entries, add all the
directories which contain shared objects.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
test/lib/utils.sh | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 70d9f66..ab5abc1 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -204,11 +204,11 @@ test -n "${abs_top_builddir+varset}" || . lib/paths || die "you must run make fi
case "$PATH" in
*"$abs_top_builddir/test/lib"*) ;;
*)
- PATH="$abs_top_builddir/test/lib":$PATH
- for d in daemons/dmeventd/plugins/mirror daemons/dmeventd/plugins/snapshot \
- daemons/dmeventd/plugins/lvm2 daemons/dmeventd liblvm tools libdm; do
- LD_LIBRARY_PATH="$abs_top_builddir/$d":$LD_LIBRARY_PATH
- done
+ PATH="$abs_top_builddir/test/lib":"$abs_top_builddir/test/api":$PATH
+ for i in `find $abs_top_builddir -name \*.so`; do
+ p=`dirname $i`
+ LD_LIBRARY_PATH="$p":$LD_LIBRARY_PATH
+ done
export PATH LD_LIBRARY_PATH ;;
esac
11 years
master - pvscan: exit --cache immediately if locking_type=3 || use_lvmetad=0
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc2644ae71a87e...
Commit: fc2644ae71a87ea81979f66022b98ec49c692a66
Parent: 7c7672b3c0916b3cee8aec90f90275a1320acc70
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Nov 9 15:56:57 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Nov 9 15:56:57 2012 +0100
pvscan: exit --cache immediately if locking_type=3 || use_lvmetad=0
---
WHATS_NEW | 1 +
tools/pvscan.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a3f8142..fd38a34 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Exit pvscan --cache immediately if cluster locking used or lvmetad not used.
Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue.
Remove dependency on fedora-storage-init.service in lvm2 systemd units.
Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 3d5ddef..34ab792 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -119,6 +119,21 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
char *buf;
activation_handler handler = NULL;
+ /*
+ * Return here immediately if lvmetad is not used.
+ * Also return if locking_type=3 (clustered) as we
+ * dont't support cluster + lvmetad yet.
+ *
+ * This is to avoid taking the global lock uselessly
+ * and to prevent hangs in clustered environment.
+ */
+ /* TODO: Remove this once lvmetad + cluster supported! */
+ if (find_config_tree_int(cmd, "global/locking_type", 1) == 3 ||
+ !find_config_tree_int(cmd, "global/use_lvmetad", 0)) {
+ log_debug("_pvscan_lvmetad: immediate return");
+ return ret;
+ }
+
if (arg_count(cmd, activate_ARG)) {
if (arg_uint_value(cmd, activate_ARG, CHANGE_AAY) != CHANGE_AAY) {
log_error("Only --activate ay allowed with pvscan.");
11 years, 1 month
master - systemd: remove quotes in lvm2-monitor.service ExecStop
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c7672b3c0916b...
Commit: 7c7672b3c0916b3cee8aec90f90275a1320acc70
Parent: aa07de5a50175a2cee3f8662a23544d43feaf128
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Nov 2 20:32:28 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Nov 2 20:32:28 2012 +0100
systemd: remove quotes in lvm2-monitor.service ExecStop
---
scripts/lvm2_monitoring_systemd_red_hat.service.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 3cb998b..670d0c4 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -12,7 +12,7 @@ Type=oneshot
Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
ExecStart=@sbindir@/lvm vgchange --monitor y
# The lvmetad must be disabled here, it needs https://bugzilla.redhat.com/show_bug.cgi?id=843587 to be resolved first.
-ExecStop="@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'"
+ExecStop=@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'
RemainAfterExit=yes
[Install]
11 years, 1 month
master - systemd: do not remove lvm2-activation.service
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aa07de5a50175a...
Commit: aa07de5a50175a2cee3f8662a23544d43feaf128
Parent: 360c569ce8f0bfe936d59ca91de2716958550524
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Nov 1 13:33:49 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Nov 1 13:33:49 2012 +0100
systemd: do not remove lvm2-activation.service
Fix previous commit 360c569ce8f0bfe936d59ca91de2716958550524.
Remove only fedora-storage-init/fedora-storage-init-late.service, but
not lvm2-activation.service.
fedora-storage-init.service fedora-storage-init-late.service
---
scripts/lvm2_monitoring_systemd_red_hat.service.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index e6b4814..3cb998b 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -2,7 +2,7 @@
Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket lvm2-lvmetad.socket
-After=dm-event.socket lvm2-lvmetad.socket lvm2-lvmetad.service
+After=dm-event.socket lvm2-lvmetad.socket lvm2-activation.service lvm2-lvmetad.service
Before=local-fs.target
DefaultDependencies=no
Conflicts=shutdown.target
11 years, 1 month