master - cleanup: shorter raid initialization
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cf857ecabdb3ef...
Commit: cf857ecabdb3ef54e42a326d08c33b0518a5b3e4
Parent: 9f0e27a18c60193feae83e458f821efc6ac64683
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 6 16:38:11 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 11:16:51 2013 +0100
cleanup: shorter raid initialization
Avoid multiple queries for raid library for each initialized raid
seg type and use shorter code.
---
WHATS_NEW | 1 +
lib/raid/raid.c | 152 ++++++++++++++-----------------------------------------
2 files changed, 39 insertions(+), 114 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2596509..44b545a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Shortened code for initialization of raid segment types.
Cache global library dir in command context.
Return success when inserting dirs and links into device cache.
Test for remote exclusive activation after activation fails.
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index c963fd2..956472e 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2013 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -393,115 +393,47 @@ static struct segtype_handler _raid_ops = {
.destroy = _raid_destroy,
};
+static const struct raid_type {
+ const char name[12];
+ unsigned parity;
+ int extra_flags;
+} _raid_types[] = {
+ { "raid1", 0, SEG_AREAS_MIRRORED },
+ { "raid10", 0, SEG_AREAS_MIRRORED },
+ { "raid4", 1 },
+ { "raid5", 1 },
+ { "raid5_la", 1 },
+ { "raid5_ls", 1 },
+ { "raid5_ra", 1 },
+ { "raid5_rs", 1 },
+ { "raid6", 2 },
+ { "raid6_nc", 2 },
+ { "raid6_nr", 2 },
+ { "raid6_zr", 2 }
+};
+
static struct segment_type *_init_raid_segtype(struct cmd_context *cmd,
- const char *raid_type)
+ const struct raid_type *rt,
+ int monitored)
{
struct segment_type *segtype = dm_zalloc(sizeof(*segtype));
if (!segtype) {
log_error("Failed to allocate memory for %s segtype",
- raid_type);
+ rt->name);
return NULL;
}
segtype->cmd = cmd;
-
- segtype->flags = SEG_RAID;
-#ifdef DEVMAPPER_SUPPORT
-#ifdef DMEVENTD
- if (_get_raid_dso_path(cmd))
- segtype->flags |= SEG_MONITORED;
-#endif
-#endif
- segtype->parity_devs = strstr(raid_type, "raid6") ? 2 : 1;
-
segtype->ops = &_raid_ops;
- segtype->name = raid_type;
-
- segtype->private = NULL;
+ segtype->name = rt->name;
+ segtype->flags = SEG_RAID | rt->extra_flags | monitored;
+ segtype->parity_devs = rt->parity;
log_very_verbose("Initialised segtype: %s", segtype->name);
return segtype;
}
-static struct segment_type *_init_raid1_segtype(struct cmd_context *cmd)
-{
- struct segment_type *segtype;
-
- segtype = _init_raid_segtype(cmd, "raid1");
- if (!segtype)
- return NULL;
-
- segtype->flags |= SEG_AREAS_MIRRORED;
- segtype->parity_devs = 0;
-
- return segtype;
-}
-
-static struct segment_type *_init_raid10_segtype(struct cmd_context *cmd)
-{
- struct segment_type *segtype;
-
- segtype = _init_raid_segtype(cmd, "raid10");
- if (!segtype)
- return NULL;
-
- segtype->flags |= SEG_AREAS_MIRRORED;
- segtype->parity_devs = 0;
-
- return segtype;
-}
-
-static struct segment_type *_init_raid4_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid4");
-}
-
-static struct segment_type *_init_raid5_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid5");
-}
-
-static struct segment_type *_init_raid5_la_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid5_la");
-}
-
-static struct segment_type *_init_raid5_ra_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid5_ra");
-}
-
-static struct segment_type *_init_raid5_ls_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid5_ls");
-}
-
-static struct segment_type *_init_raid5_rs_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid5_rs");
-}
-
-static struct segment_type *_init_raid6_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid6");
-}
-
-static struct segment_type *_init_raid6_zr_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid6_zr");
-}
-
-static struct segment_type *_init_raid6_nr_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid6_nr");
-}
-
-static struct segment_type *_init_raid6_nc_segtype(struct cmd_context *cmd)
-{
- return _init_raid_segtype(cmd, "raid6_nc");
-}
-
#ifdef RAID_INTERNAL /* Shared */
int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib)
#else
@@ -511,29 +443,21 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
#endif
{
struct segment_type *segtype;
- unsigned i = 0;
- struct segment_type *(*raid_segtype_fn[])(struct cmd_context *) = {
- _init_raid1_segtype,
- _init_raid10_segtype,
- _init_raid4_segtype,
- _init_raid5_segtype,
- _init_raid5_la_segtype,
- _init_raid5_ra_segtype,
- _init_raid5_ls_segtype,
- _init_raid5_rs_segtype,
- _init_raid6_segtype,
- _init_raid6_zr_segtype,
- _init_raid6_nr_segtype,
- _init_raid6_nc_segtype,
- NULL,
- };
-
- do {
- if ((segtype = raid_segtype_fn[i](cmd)) &&
+ unsigned i;
+ int monitored = 0;
+
+#ifdef DEVMAPPER_SUPPORT
+#ifdef DMEVENTD
+ if (_get_raid_dso_path(cmd))
+ monitored = SEG_MONITORED;
+#endif
+#endif
+
+ for (i = 0; i < DM_ARRAY_SIZE(_raid_types); ++i)
+ if ((segtype = _init_raid_segtype(cmd, &_raid_types[i], monitored)) &&
!lvm_register_segtype(seglib, segtype))
/* segtype is already destroyed */
return_0;
- } while (raid_segtype_fn[++i]);
return 1;
}
10 years, 4 months
master - cleanup: tiny speedup of lib_dir checking
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9f0e27a18c6019...
Commit: 9f0e27a18c60193feae83e458f821efc6ac64683
Parent: 0fcdc8a020afcafa182da93922c171604cf3035e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 6 16:35:54 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 11:15:48 2013 +0100
cleanup: tiny speedup of lib_dir checking
Instead of repeated lookup of global/library_dir - remember first
search in command context - saves couple lines in debug output...
---
WHATS_NEW | 1 +
lib/commands/toolcontext.c | 2 ++
lib/commands/toolcontext.h | 1 +
lib/misc/sharedlib.c | 7 ++++---
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 633f4d8..2596509 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Cache global library dir in command context.
Return success when inserting dirs and links into device cache.
Test for remote exclusive activation after activation fails.
Support lvconvert --merge for thin snapshots.
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index d13d8d5..9d6ef5e 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1654,6 +1654,8 @@ int refresh_toolcontext(struct cmd_context *cmd)
cmd->hosttags = 0;
+ cmd->lib_dir = NULL;
+
if (!_init_lvm_conf(cmd))
return 0;
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 74b1177..7a50e1e 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -121,6 +121,7 @@ struct cmd_context {
struct dm_list tags;
int hosttags;
+ const char *lib_dir; /* Cache value global/library_dir */
char system_dir[PATH_MAX];
char dev_dir[PATH_MAX];
char proc_dir[PATH_MAX];
diff --git a/lib/misc/sharedlib.c b/lib/misc/sharedlib.c
index fca079b..db98da1 100644
--- a/lib/misc/sharedlib.c
+++ b/lib/misc/sharedlib.c
@@ -16,6 +16,7 @@
#include "lib.h"
#include "config.h"
#include "sharedlib.h"
+#include "toolcontext.h"
#include <limits.h>
#include <sys/stat.h>
@@ -25,13 +26,13 @@ void get_shared_library_path(struct cmd_context *cmd, const char *libname,
char *path, size_t path_len)
{
struct stat info;
- const char *lib_dir;
/* If libname doesn't begin with '/' then use lib_dir/libname,
* if present */
if (libname[0] == '/' ||
- !(lib_dir = find_config_tree_str(cmd, global_library_dir_CFG, NULL)) ||
- (dm_snprintf(path, path_len, "%s/%s", lib_dir,
+ (!cmd->lib_dir &&
+ !(cmd->lib_dir = find_config_tree_str(cmd, global_library_dir_CFG, NULL))) ||
+ (dm_snprintf(path, path_len, "%s/%s", cmd->lib_dir,
libname) == -1) || stat(path, &info) == -1) {
strncpy(path, libname, path_len - 1);
path[path_len - 1] = '\0';
10 years, 4 months
master - conf: clarify wipe_signatures_when_zeroing_new_lvs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0fcdc8a020afca...
Commit: 0fcdc8a020afcafa182da93922c171604cf3035e
Parent: 16eab3ec08e72bb3fb58dd2af4bfec786315919a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Dec 10 10:16:37 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Dec 10 10:16:37 2013 +0100
conf: clarify wipe_signatures_when_zeroing_new_lvs
---
conf/example.conf.in | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index dcbc0b3..0c2fc0a 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -287,10 +287,10 @@ allocation {
# to be recognized, it can take more time to complete the signature scan.
use_blkid_wiping = 1
- # Set to 1 when use_blkid_wiping is enabled to wipe any signatures found on
- # newly-created Logical Volumes automatically in addition to zeroing of the
- # first KB on the LV (controlled by the -Z/--zero y option).
- # The command line option -W/--wipesignatures n takes precedence over this
+ # Set to 1 to wipe any signatures found on newly-created Logical Volumes
+ # automatically in addition to zeroing of the first KB on the LV
+ # (controlled by the -Z/--zero y option).
+ # The command line option -W/--wipesignatures takes precedence over this
# setting.
# The default is to wipe signatures when zeroing.
#
10 years, 4 months
master - config: shorten new sig wiping option string
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=16eab3ec08e72b...
Commit: 16eab3ec08e72bb3fb58dd2af4bfec786315919a
Parent: 2b3adf4eea7cba080ff907012715aac66bf807a3
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Dec 9 09:35:47 2013 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Dec 9 09:35:47 2013 +0000
config: shorten new sig wiping option string
Rename wipe_signatures_on_new_logical_volumes_when_zeroing to
wipe_signatures_when_zeroing_new_lvs.
---
WHATS_NEW | 2 +-
conf/example.conf.in | 14 +++++++-------
lib/config/config_settings.h | 2 +-
man/lvcreate.8.in | 2 +-
test/lib/aux.sh | 2 +-
test/shell/lvcreate-signature-wiping.sh | 4 ++--
tools/lvcreate.c | 4 ++--
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 72a61e3..633f4d8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -23,7 +23,7 @@ Version 2.02.105 -
Enable blkid_wiping by default if the blkid library is present.
Add configure --disable-blkid_wiping to disable libblkid signature detection.
Add -W/--wipesignatures lvcreate option to support wiping on new LVs.
- Add allocation/wipe_signatures_on_new_logical_volumes_when_zeroing to lvm.conf.
+ Add allocation/wipe_signatures_when_zeroing_new_lvs to lvm.conf.
Do not fail the whole autoactivation if the VG refresh done before fails.
Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
Use lv_check_not_in_use() when testing device in use before merging.
diff --git a/conf/example.conf.in b/conf/example.conf.in
index b7ad3d1..dcbc0b3 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -287,14 +287,14 @@ allocation {
# to be recognized, it can take more time to complete the signature scan.
use_blkid_wiping = 1
- # Whether do wipe any signatures found on newly created Logical Volumes
- # automatically in addition to zeroing of the first KB on the LV
- # (-Z/--zero y option) when running the LVM command without specifying
- # the -W/--wipesignatures option. If -W/--wipesignatures command line
- # option is specified, it always takes precedence over this setting.
- # Default is to wipe signatures when zeroing.
+ # Set to 1 when use_blkid_wiping is enabled to wipe any signatures found on
+ # newly-created Logical Volumes automatically in addition to zeroing of the
+ # first KB on the LV (controlled by the -Z/--zero y option).
+ # The command line option -W/--wipesignatures n takes precedence over this
+ # setting.
+ # The default is to wipe signatures when zeroing.
#
- wipe_signatures_on_new_logical_volumes_when_zeroing = 1
+ wipe_signatures_when_zeroing_new_lvs = 1
# Set to 1 to guarantee that mirror logs will always be placed on
# different PVs from the mirror images. This was the default
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 929e907..0e0e469 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -105,7 +105,7 @@ cfg(devices_issue_discards_CFG, "issue_discards", devices_CFG_SECTION, 0, CFG_TY
cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL)
cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MAXIMISE_CLING, vsn(2, 2, 85), NULL)
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
-cfg(allocation_wipe_signatures_on_new_logical_volumes_when_zeroing_CFG, "wipe_signatures_on_new_logical_volumes_when_zeroing", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
+cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index a34c4ae..08cc15c 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -405,7 +405,7 @@ device sizes (GiB), thin provisioning should be used for this case.
Controls wiping of detected signatures on newly created Logical Volume.
If this option is not specified, then by default signature wiping is done
each time the zeroing (\fB\-Z\fP/\fB\-\-zero\fP) is done. This default behaviour
-can be controlled by \fBallocation/wipe_signatures_on_new_logical_volumes_when_zeroing\fP
+can be controlled by \fBallocation/wipe_signatures_when_zeroing_new_lvs\fP
setting found in \fBlvm.conf\fP(5).
.br
If blkid wiping is used (\fBallocation/use_blkid_wiping setting\fP in \fBlvm.conf\fP(5))
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index d1ae524..2256fce 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -563,7 +563,7 @@ activation/polling_interval = 0
activation/snapshot_autoextend_percent = 50
activation/snapshot_autoextend_threshold = 50
activation/monitoring = 0
-allocation/wipe_signatures_on_new_logical_volumes_when_zeroing = 0
+allocation/wipe_signatures_when_zeroing_new_lvs = 0
EOF
}
diff --git a/test/shell/lvcreate-signature-wiping.sh b/test/shell/lvcreate-signature-wiping.sh
index 617fed1..5618780 100644
--- a/test/shell/lvcreate-signature-wiping.sh
+++ b/test/shell/lvcreate-signature-wiping.sh
@@ -27,7 +27,7 @@ lvremove -f $vg/$lv1
wiping_msg="Wiping swap signature"
-aux lvmconf "allocation/wipe_signatures_on_new_logical_volumes_when_zeroing = 0"
+aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 0"
lvcreate -y -Zn -l1 -n $lv1 $vg | not grep "$wiping_msg"
blkid -c /dev/null "$DM_DEV_DIR/$vg/$lv1" | grep "swap"
@@ -59,7 +59,7 @@ blkid -c /dev/null "$DM_DEV_DIR/$vg/$lv1" | grep "swap"
lvremove -f $vg/$lv1
-aux lvmconf "allocation/wipe_signatures_on_new_logical_volumes_when_zeroing = 1"
+aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 1"
lvcreate -y -Zn -l1 -n $lv1 $vg | not grep "$wiping_msg"
blkid -c /dev/null "$DM_DEV_DIR/$vg/$lv1" | grep "swap"
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 1fe5130..d0ca7bc 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -883,10 +883,10 @@ static int _lvcreate_params(struct lvcreate_params *lp,
} else {
/*
* If -W/--wipesignatures is not given on command line,
- * look at the allocation/wipe_signatures_on_new_logical_volumes_when_zeroing
+ * look at the allocation/wipe_signatures_when_zeroing_new_lvs
* to decide what should be done exactly.
*/
- if (find_config_tree_bool(cmd, allocation_wipe_signatures_on_new_logical_volumes_when_zeroing_CFG, NULL))
+ if (find_config_tree_bool(cmd, allocation_wipe_signatures_when_zeroing_new_lvs_CFG, NULL))
lp->wipe_signatures = lp->zero;
else
lp->wipe_signatures = 0;
10 years, 4 months
master - tests: more limits for python test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2b3adf4eea7cba...
Commit: 2b3adf4eea7cba080ff907012715aac66bf807a3
Parent: f460d6d9b5dcf0e13b70d4c1630a0f667849b8b9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 6 10:37:49 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 6 10:37:49 2013 +0100
tests: more limits for python test
It will be most probably more problem with
incomplete initialization of lvm.conf settings
when lvm2app is in use.
Skip cluster & lvmetad test for now.
---
test/api/pytest.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/api/pytest.sh b/test/api/pytest.sh
index 55df9e8..a0f9a2f 100644
--- a/test/api/pytest.sh
+++ b/test/api/pytest.sh
@@ -21,6 +21,8 @@
# thus it needs dmeventd
#
aux prepare_dmeventd
+test ! -e LOCAL_CLVMD || skip
+test ! -e LOCAL_LVMETAD || skip
#If you change this change the unit test case too.
aux prepare_pvs 6
@@ -29,7 +31,7 @@ aux prepare_pvs 6
python_lib=$(find $abs_top_builddir -name lvm.so)
# Unable to test python bindings if library not available
-test -z "$python_lib" && skip
+test -n "$python_lib" || skip
export PYTHONPATH=$(dirname $python_lib):$PYTHONPATH
10 years, 4 months
master - tests: python test needs dmeventd
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f460d6d9b5dcf0...
Commit: f460d6d9b5dcf0e13b70d4c1630a0f667849b8b9
Parent: 73a109d434ffb894cda9c7fc6720d1166a9d5bca
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 6 10:07:22 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 6 10:08:34 2013 +0100
tests: python test needs dmeventd
Until lvm2app respects all lvm.conf setting,
this test require dmeventd.
---
test/api/pytest.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/test/api/pytest.sh b/test/api/pytest.sh
index 67e224c..55df9e8 100644
--- a/test/api/pytest.sh
+++ b/test/api/pytest.sh
@@ -13,18 +13,69 @@
. lib/test
+#
+# TODO:
+# lvm2app is not yet capable to respect many lvm.conf options
+# since a lot of them is set in /tools/liblvmline
+# Until fixed - testing always runs with enabled monitoring
+# thus it needs dmeventd
+#
+aux prepare_dmeventd
+
#If you change this change the unit test case too.
aux prepare_pvs 6
#Locate the python binding library to use.
-python_lib=`find $abs_top_builddir -name lvm.so`
+python_lib=$(find $abs_top_builddir -name lvm.so)
# Unable to test python bindings if library not available
test -z "$python_lib" && skip
-export PYTHONPATH=`dirname $python_lib`:$PYTHONPATH
+export PYTHONPATH=$(dirname $python_lib):$PYTHONPATH
#Setup which devices the unit test can use.
export PY_UNIT_PVS=$(cat DEVICES)
-python_lvm_unit.py -v -f
+#python_lvm_unit.py -v -f
+
+# Run individual tests for shorter error trace
+python_lvm_unit.py -v TestLvm.test_config_find_bool
+python_lvm_unit.py -v TestLvm.test_config_override
+python_lvm_unit.py -v TestLvm.test_config_reload
+python_lvm_unit.py -v TestLvm.test_dupe_lv_create
+python_lvm_unit.py -v TestLvm.test_get_set_extend_size
+python_lvm_unit.py -v TestLvm.test_lv_active_inactive
+python_lvm_unit.py -v TestLvm.test_lv_property
+python_lvm_unit.py -v TestLvm.test_lv_rename
+python_lvm_unit.py -v TestLvm.test_lv_resize
+python_lvm_unit.py -v TestLvm.test_lv_seg
+python_lvm_unit.py -v TestLvm.test_lv_size
+python_lvm_unit.py -v TestLvm.test_lv_snapshot
+python_lvm_unit.py -v TestLvm.test_lv_suspend
+python_lvm_unit.py -v TestLvm.test_lv_tags
+python_lvm_unit.py -v TestLvm.test_percent_to_float
+python_lvm_unit.py -v TestLvm.test_pv_create
+python_lvm_unit.py -v TestLvm.test_pv_empty_listing
+python_lvm_unit.py -v TestLvm.test_pv_getters
+python_lvm_unit.py -v TestLvm.test_pv_life_cycle
+python_lvm_unit.py -v TestLvm.test_pv_lookup_from_vg
+python_lvm_unit.py -v TestLvm.test_pv_property
+python_lvm_unit.py -v TestLvm.test_pv_resize
+python_lvm_unit.py -v TestLvm.test_pv_segs
+python_lvm_unit.py -v TestLvm.test_scan
+python_lvm_unit.py -v TestLvm.test_version
+python_lvm_unit.py -v TestLvm.test_vg_from_pv_lookups
+python_lvm_unit.py -v TestLvm.test_vg_getters
+python_lvm_unit.py -v TestLvm.test_vg_get_name
+python_lvm_unit.py -v TestLvm.test_vg_get_set_prop
+python_lvm_unit.py -v TestLvm.test_vg_get_uuid
+python_lvm_unit.py -v TestLvm.test_vg_lv_name_validate
+python_lvm_unit.py -v TestLvm.test_vg_names
+python_lvm_unit.py -v TestLvm.test_vg_reduce
+python_lvm_unit.py -v TestLvm.test_vg_remove_restore
+python_lvm_unit.py -v TestLvm.test_vg_tags
+python_lvm_unit.py -v TestLvm.test_vg_uuids
+
+# CHECKME: not for testing?
+#python_lvm_unit.py -v TestLvm.test_listing
+#python_lvm_unit.py -v TestLvm.test_pv_methods
10 years, 4 months
master - lvmdump: follow symbolic links in /etc/lvm
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=73a109d434ffb8...
Commit: 73a109d434ffb894cda9c7fc6720d1166a9d5bca
Parent: a344466e26cf7611c84c2548999dc67080e28347
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Dec 5 16:36:45 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Dec 5 16:36:45 2013 +0100
lvmdump: follow symbolic links in /etc/lvm
---
scripts/lvmdump.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh
index 641d109..6d9fe6d 100755
--- a/scripts/lvmdump.sh
+++ b/scripts/lvmdump.sh
@@ -204,7 +204,8 @@ myecho "Gathering console messages..."
log "$TAIL -n 75 /var/log/messages >> \"$dir/messages\" 2>> \"$log\""
myecho "Gathering /etc/lvm info..."
-log "$CP -a /etc/lvm \"$dir/lvm\" 2>> \"$log\""
+log "$LS -laR /etc/lvm >> \"$dir/etc_lvm_listing\" 2>> \"$log\""
+log "$CP -RL --preserve=all /etc/lvm \"$dir/lvm\" 2>> \"$log\""
myecho "Gathering /dev listing..."
log "$LS -laR /dev >> \"$dir/dev_listing\" 2>> \"$log\""
@@ -241,8 +242,8 @@ if (( $udev )); then
log "$UDEVADM info --export-db >> \"$udev_dir/db\" 2>> \"$log\""
log "$CP -a /etc/udev/udev.conf \"$udev_dir/conf\" 2>> \"$log\""
log "$LS -la /lib/udev >> \"$udev_dir/lib_dir\" 2>> \"$log\""
- log "$CP -aR /etc/udev/rules.d \"$udev_dir/rules_etc\" 2>> \"$log\""
- log "$CP -aR /lib/udev/rules.d \"$udev_dir/rules_lib\" 2>> \"$log\""
+ log "$CP -RL --preserve=all /etc/udev/rules.d \"$udev_dir/rules_etc\" 2>> \"$log\""
+ log "$CP -RL --preserve=all /lib/udev/rules.d \"$udev_dir/rules_lib\" 2>> \"$log\""
fi
if (( $lvmetad )); then
10 years, 4 months
master - compile/link: EXTRA_EXEC_CFLAGS must be applied for *.o
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a344466e26cf76...
Commit: a344466e26cf7611c84c2548999dc67080e28347
Parent: 481edce41f54a392b663991c4e29c9eed05f90b5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Dec 5 14:19:10 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Dec 5 14:19:10 2013 +0100
compile/link: EXTRA_EXEC_CFLAGS must be applied for *.o
---
tools/Makefile.in | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 34df48b..f18d3ea 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -121,8 +121,10 @@ LIBS += $(UDEV_LIBS) $(BLKID_LIBS)
device-mapper: $(TARGETS_DM)
+CFLAGS_dmsetup.o += $(EXTRA_EXEC_CFLAGS)
+
dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
- $(CC) $(CFLAGS) $(EXTRA_EXEC_CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) -L$(top_builddir)/libdm \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) -L$(top_builddir)/libdm \
-o $@ dmsetup.o -ldevmapper $(LIBS)
dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
@@ -131,8 +133,10 @@ dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
all: device-mapper
+CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
+
lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
- $(CC) $(CFLAGS) $(EXTRA_EXEC_CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
$(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic
ifeq ("@BUILD_LVMETAD@", "yes")
10 years, 4 months
master - compile/link: use RELRO/PIE compiler/linker options for executables
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=481edce41f54a3...
Commit: 481edce41f54a392b663991c4e29c9eed05f90b5
Parent: b494881e685da3ada4a42a17a33d4fe67f3ca784
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Dec 5 14:03:10 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Dec 5 14:03:10 2013 +0100
compile/link: use RELRO/PIE compiler/linker options for executables
---
WHATS_NEW | 2 +-
daemons/clvmd/Makefile.in | 4 ++--
daemons/cmirrord/Makefile.in | 4 ++--
daemons/dmeventd/Makefile.in | 4 ++--
daemons/lvmetad/Makefile.in | 4 ++--
make.tmpl.in | 4 ++--
scripts/Makefile.in | 4 +++-
tools/Makefile.in | 4 ++--
8 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2e1f59a..72a61e3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -8,7 +8,7 @@ Version 2.02.105 -
Extend lv_remove_single() to not print info about removed LV.
Replace open_count check with lv_check_not_in_use() for snapshot open test.
Add error messages with LV names for failing lv refresh.
- Compile/link daemons with RELRO and PIE options to harden daemon security.
+ Compile/link executables with new RELRO and PIE options (non-static builds).
Support per-object compilation cflags via CFLAGS_object.o.
Automatically detect support for compiler/linker options to use RELRO and PIE.
Add --splitsnapshot to lvconvert to separate out cow LV.
diff --git a/daemons/clvmd/Makefile.in b/daemons/clvmd/Makefile.in
index 4677048..0da95a7 100644
--- a/daemons/clvmd/Makefile.in
+++ b/daemons/clvmd/Makefile.in
@@ -88,8 +88,8 @@ LVMLIBS += -ldevmapper
LIBS += $(PTHREAD_LIBS)
DEFS += -D_REENTRANT
-CFLAGS += -fno-strict-aliasing $(DAEMON_CFLAGS)
-LDFLAGS += $(DAEMON_LDFLAGS)
+CFLAGS += -fno-strict-aliasing $(EXTRA_EXEC_CFLAGS)
+LDFLAGS += $(EXTRA_EXEC_LDFLAGS)
INSTALL_TARGETS = \
install_clvmd
diff --git a/daemons/cmirrord/Makefile.in b/daemons/cmirrord/Makefile.in
index df7c2a8..d368793 100644
--- a/daemons/cmirrord/Makefile.in
+++ b/daemons/cmirrord/Makefile.in
@@ -28,8 +28,8 @@ include $(top_builddir)/make.tmpl
LIBS += -ldevmapper
LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS)
-CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) $(DAEMON_CFLAGS)
-LDFLAGS += $(DAEMON_LDFLAGS)
+CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) $(EXTRA_EXEC_CFLAGS)
+LDFLAGS += $(EXTRA_EXEC_LDFLAGS)
cmirrord: $(OBJECTS) $(top_builddir)/lib/liblvm-internal.a
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) \
diff --git a/daemons/dmeventd/Makefile.in b/daemons/dmeventd/Makefile.in
index fcc5c9e..47bfb67 100644
--- a/daemons/dmeventd/Makefile.in
+++ b/daemons/dmeventd/Makefile.in
@@ -59,10 +59,10 @@ device-mapper: $(TARGETS)
LIBS += -ldevmapper
LVMLIBS += -ldevmapper-event $(PTHREAD_LIBS)
-CFLAGS_dmeventd.o += $(DAEMON_CFLAGS)
+CFLAGS_dmeventd.o += $(EXTRA_EXEC_CFLAGS)
dmeventd: $(LIB_SHARED) dmeventd.o
- $(CC) $(CFLAGS) $(LDFLAGS) $(DAEMON_LDFLAGS) $(ELDFLAGS) -L. -o $@ dmeventd.o \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -L. -o $@ dmeventd.o \
$(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
diff --git a/daemons/lvmetad/Makefile.in b/daemons/lvmetad/Makefile.in
index 67a557f..0a174bb 100644
--- a/daemons/lvmetad/Makefile.in
+++ b/daemons/lvmetad/Makefile.in
@@ -33,9 +33,9 @@ LVMLIBS = -ldaemonserver $(LVMINTERNAL_LIBS) -ldevmapper
LIBS += $(PTHREAD_LIBS)
-LDFLAGS += -L$(top_builddir)/libdaemon/server $(DAEMON_LDFLAGS)
+LDFLAGS += -L$(top_builddir)/libdaemon/server $(EXTRA_EXEC_LDFLAGS)
CLDFLAGS += -L$(top_builddir)/libdaemon/server
-CFLAGS += $(DAEMON_CFLAGS)
+CFLAGS += $(EXTRA_EXEC_CFLAGS)
lvmetad: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
$(top_builddir)/libdaemon/server/libdaemonserver.a
diff --git a/make.tmpl.in b/make.tmpl.in
index 5f72182..65b1da0 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -153,8 +153,8 @@ endif
ifneq ("@STATIC_LINK@", "yes")
ifeq ("@HAVE_PIE@", "yes")
ifeq ("@HAVE_FULL_RELRO@", "yes")
- DAEMON_CFLAGS += -fPIE -DPIE
- DAEMON_LDFLAGS += -Wl,-z,relro,-z,now -pie
+ EXTRA_EXEC_CFLAGS += -fPIE -DPIE
+ EXTRA_EXEC_LDFLAGS += -Wl,-z,relro,-z,now -pie
endif
endif
endif
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 3616afa..ed587ca 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -82,8 +82,10 @@ ifeq ("@BLKDEACTIVATE@", "yes")
$(INSTALL_SCRIPT) blk_availability_init_red_hat $(initdir)/blk-availability
endif
+CFLAGS_lvm2_activation_generator_systemd_red_hat.o += $(EXTRA_EXEC_CFLAGS)
+
lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(DEPLIBS)
- $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LVMLIBS)
+ $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(LVMLIBS)
install_systemd_generators:
$(INSTALL_DIR) $(systemd_generator_dir)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f8e4934..34df48b 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -122,7 +122,7 @@ LIBS += $(UDEV_LIBS) $(BLKID_LIBS)
device-mapper: $(TARGETS_DM)
dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
- $(CC) $(CFLAGS) $(LDFLAGS) -L$(top_builddir)/libdm \
+ $(CC) $(CFLAGS) $(EXTRA_EXEC_CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) -L$(top_builddir)/libdm \
-o $@ dmsetup.o -ldevmapper $(LIBS)
dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
@@ -132,7 +132,7 @@ dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
all: device-mapper
lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
- $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
+ $(CC) $(CFLAGS) $(EXTRA_EXEC_CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
$(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic
ifeq ("@BUILD_LVMETAD@", "yes")
10 years, 4 months
master - tests: sysrq only when stuck with no output.
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b494881e685da3...
Commit: b494881e685da3ada4a42a17a33d4fe67f3ca784
Parent: c7b733cd6cbc69e4a681b17ca4e89eb9fcd6d31f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Dec 5 12:32:27 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Dec 5 12:40:47 2013 +0100
tests: sysrq only when stuck with no output.
If we are stuck in user for too long without output,
grab kernel stack traces.
If we just produce too many lines of output, it's
not probably kernel related bug.
---
test/lib/harness.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/test/lib/harness.c b/test/lib/harness.c
index 5591f77..c4dd3da 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -406,11 +406,18 @@ static void run(int i, char *f) {
if ((fullbuffer && fullbuffer++ == 8000) ||
(no_write > 180 * 2)) /* a 3 minute timeout */
{
- system("echo t > /proc/sysrq-trigger");
timeout:
kill(pid, SIGINT);
sleep(5); /* wait a bit for a reaction */
if ((w = waitpid(pid, &st, WNOHANG)) == 0) {
+ if (no_write > 180 * 2)
+ /*
+ * Kernel traces needed, when stuck for
+ * too long in userspace without producing
+ * any output, in other case it should be
+ * user space problem
+ */
+ system("echo t > /proc/sysrq-trigger");
collect_debug = 1;
kill(-pid, SIGKILL);
w = pid; // waitpid(pid, &st, NULL);
10 years, 4 months