master - tests: aux.sh fix pattern
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=006a9eaada2744ca39b...
Commit: 006a9eaada2744ca39b05aed7b7bf152524580be
Parent: 2ceb5a0abbbdc3753cfcaff76251d6477a9ea088
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 21:09:29 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 21:13:07 2017 +0200
tests: aux.sh fix pattern
Commit 72a58ce4b0f68f6e45ae30606fe5af21caa42b43 fixed 'translation' of
pattern by bash by using "" - so we need to drop '\' here to get
wanted behavior.
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index ed969e2..2eeb67f 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1542,7 +1542,7 @@ wait_pvmove_lv_ready() {
while : ; do
test "$retries" -le 0 && die "Waiting for lvmpolld timed out"
test -n "$lvid" || {
- lvid=$(get lv_field "${1//-/\/}" vg_uuid,lv_uuid -a 2>/dev/null)
+ lvid=$(get lv_field "${1//-//}" vg_uuid,lv_uuid -a 2>/dev/null)
lvid=${lvid//\ /}
lvid=${lvid//-/}
}
6 years, 5 months
master - coverity: just make impossible division by zero
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2ceb5a0abbbdc3753cf...
Commit: 2ceb5a0abbbdc3753cfcaff76251d6477a9ea088
Parent: 3d08b0971f5f2610459343d0ae2a524d272142d2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 19:44:06 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 20:39:23 2017 +0200
coverity: just make impossible division by zero
Visible for analyzer code will not try to use 0 for division.
---
lib/metadata/raid_manip.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index df7e062..a22b529 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -844,7 +844,7 @@ static int _reorder_raid10_near_seg_areas(struct lv_segment *seg, enum raid0_rai
if (!(idx = dm_pool_zalloc(seg_lv(seg, 0)->vg->vgmem, seg->area_count * sizeof(*idx)))) {
log_error("Memory allocation failed.");
- return_0;
+ return 0;
}
/* Set up positional index array */
@@ -874,6 +874,11 @@ static int _reorder_raid10_near_seg_areas(struct lv_segment *seg, enum raid0_rai
* _reorder_raid10_near_seg_areas 2137 idx[8]=8
*/
/* idx[from] = to */
+ if (!stripes) {
+ log_error(INTERNAL_ERROR "LV %s is missing stripes.",
+ display_lvname(seg->lv));
+ return 0;
+ }
for (s = ss = 0; s < seg->area_count; s++)
if (s < stripes)
idx[s] = s * data_copies;
6 years, 5 months
master - man_generator: release buffer after use
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3d08b0971f5f2610459...
Commit: 3d08b0971f5f2610459343d0ae2a524d272142d2
Parent: ad286a32275283f018adabbf96d569d5c1fd065a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 19:36:24 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 20:39:02 2017 +0200
man_generator: release buffer after use
Although ATM this code has no memory management at all,
it will not make any harm to release some memory,
when it's not needed anymore.
---
tools/command.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index afd8831..c094f12 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -2279,6 +2279,7 @@ static void print_val_man(struct command_name *cname, int opt_enum, int val_enum
else
printf("\\fB%s\\fP", line_argv[i]);
}
+ dm_free(line);
return;
}
6 years, 5 months
master - raid: ensure enum is defined
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ad286a32275283f018a...
Commit: ad286a32275283f018adabbf96d569d5c1fd065a
Parent: c31614eccc41746734e712143d0f86c96f95dd4c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 19:34:52 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 20:39:02 2017 +0200
raid: ensure enum is defined
Just making sure enum is always defined.
TODO: code path using this enum needs closer inspection.
---
lib/metadata/raid_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 110a7d3..df7e062 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2232,7 +2232,7 @@ static int _raid_reshape(struct logical_volume *lv,
int force_repair = 0, r, too_few = 0;
unsigned devs_health, devs_in_sync;
uint32_t new_image_count, old_image_count;
- enum alloc_where where_it_was;
+ enum alloc_where where_it_was = alloc_none;
struct lv_segment *seg = first_seg(lv);
struct dm_list removal_lvs;
6 years, 5 months
master - tests: aux.sh use subshell for simple redirection
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c31614eccc41746734e...
Commit: c31614eccc41746734e712143d0f86c96f95dd4c
Parent: 57779e39eccf456344fa4a51ddfc49cee41a40d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 14:35:42 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 17:08:47 2017 +0200
tests: aux.sh use subshell for simple redirection
---
test/lib/utils.sh | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 2b5b782..f4c52ad 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -131,9 +131,11 @@ STACKTRACE() {
# Get backtraces from coredumps
if which gdb &>/dev/null; then
- echo bt full > gdb_commands.txt
- echo l >> gdb_commands.txt
- echo quit >> gdb_commands.txt
+ {
+ echo bt full
+ echo l
+ echo quit
+ } > gdb_commands.txt
# TODO: use sysctl to get 'core' position in system
for i in core*; do
test -f "$i" || break # empty globbing
6 years, 5 months
master - tests: correcting globbing usage
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=57779e39eccf456344f...
Commit: 57779e39eccf456344fa4a51ddfc49cee41a40d7
Parent: 9348ad4f164a2d8806b08f28a937aaa1041b4f6b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 14:28:44 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 14:40:50 2017 +0200
tests: correcting globbing usage
Ensure globbing uses current dir.
Break loop when no match is found.
Let STACKTRACE finish its output when gdb fails.
---
test/lib/utils.sh | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 4f3e460..2b5b782 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -120,7 +120,7 @@ stacktrace() {
STACKTRACE() {
trap - ERR
- local i=0
+ local i
stacktrace
@@ -134,10 +134,12 @@ STACKTRACE() {
echo bt full > gdb_commands.txt
echo l >> gdb_commands.txt
echo quit >> gdb_commands.txt
- for core in $(echo core* 2>/dev/null); do
- bin=$(gdb -batch -c "$core" 2>&1 | grep "generated by" | \
- sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
- gdb -batch -c "$core" -x gdb_commands.txt "$(which "$bin")"
+ # TODO: use sysctl to get 'core' position in system
+ for i in core*; do
+ test -f "$i" || break # empty globbing
+ bin=$(gdb -batch -c "$i" 2>&1 | grep "generated by" | \
+ sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue
+ gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" || continue
done
fi
6 years, 5 months
master - tests: aux prepares lvmdbusd
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9348ad4f164a2d8806b...
Commit: 9348ad4f164a2d8806b08f28a937aaa1041b4f6b
Parent: 674a93ffe3db8a21534c9b10d6fcb407258e191a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 12:07:30 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 12:12:16 2017 +0200
tests: aux prepares lvmdbusd
Correctly skip the test when lvmdbusd is found already running.
For pgrep usage we need to add '-f -l' options to get python3 name
printed.
Remove no longer used 'pids' local var.
---
test/lib/aux.sh | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 99e8a6d..ed969e2 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -309,9 +309,8 @@ prepare_lvmdbusd() {
# FIXME: This is not correct! Daemon is auto started.
echo "checking lvmdbusd is NOT running..."
- if pgrep lvmdbusd | grep python3; then
- echo "Cannot run while existing lvmdbusd process exists"
- return 1
+ if pgrep -f -l lvmdbusd | grep python3 ; then
+ skip "Cannot run while existing lvmdbusd process exists"
fi
echo ok
@@ -320,7 +319,7 @@ prepare_lvmdbusd() {
# NOTE: this is always present - additional checks are needed:
daemon="$abs_top_builddir/daemons/lvmdbusd/lvmdbusd"
# Setup the python path so we can run
- export PYTHONPATH=$abs_top_builddir/daemons
+ export PYTHONPATH="$abs_top_builddir/daemons"
else
daemon=$(which lvmdbusd || :)
fi
@@ -343,7 +342,7 @@ prepare_lvmdbusd() {
sleep 1
echo "checking lvmdbusd IS running..."
- if ! pgrep lvmdbusd | grep python3; then
+ if ! pgrep -f -l lvmdbusd | grep python3; then
echo "Failed to start lvmdbusd daemon"
return 1
fi
@@ -496,7 +495,6 @@ count_processes_with_tag() {
kill_tagged_processes() {
local pid
- local pids
local wait
# read uses all vars within pipe subshell
6 years, 5 months
master - tests: aux do not specify bitmap for raid0
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=674a93ffe3db8a21534...
Commit: 674a93ffe3db8a21534c9b10d6fcb407258e191a
Parent: 596cf2c6fabefb67c4d42d8aad055272b7c452b6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 11:45:07 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 12:09:10 2017 +0200
tests: aux do not specify bitmap for raid0
---
test/lib/aux.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 4e2b246..99e8a6d 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -697,7 +697,8 @@ prepare_md_dev() {
local level=$1
local rchunk=$2
local rdevs=$3
-
+ local with_bitmap="--bitmap=internal"
+ local coption="--chunk"
local maj
local mddev
maj=$(mdadm --version 2>&1) || skip "mdadm tool is missing!"
@@ -706,8 +707,10 @@ prepare_md_dev() {
rm -f debug.log strace.log MD_DEV MD_DEV_PV MD_DEVICES
- coption="--chunk"
- test "$level" = "1" && coption="--bitmap-chunk"
+ case "$level" in
+ "1") coption="--bitmap-chunk" ;;
+ "0") unset with_bitmap ;;
+ esac
# Have MD use a non-standard name to avoid colliding with an existing MD device
# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
# - newer mdadm _completely_ defers to udev to create the associated device node
@@ -717,7 +720,7 @@ prepare_md_dev() {
mddev=/dev/md/md_lvm_test0 || \
mddev=/dev/md_lvm_test0
- mdadm --create --metadata=1.0 "$mddev" --auto=md --level "$level" --bitmap=internal "$coption"="$rchunk" --raid-devices="$rdevs" "${@:4}" || {
+ mdadm --create --metadata=1.0 "$mddev" --auto=md --level "$level" $with_bitmap "$coption"="$rchunk" --raid-devices="$rdevs" "${@:4}" || {
# Some older 'mdadm' version managed to open and close devices internaly
# and reporting non-exclusive access on such device
# let's just skip the test if this happens.
6 years, 5 months
master - tests: check LV in proper VG
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=596cf2c6fabefb67c4d...
Commit: 596cf2c6fabefb67c4d42d8aad055272b7c452b6
Parent: e84a145cf4f593a4560f109b486a1fa1d999fe2d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 11:30:57 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 12:09:10 2017 +0200
tests: check LV in proper VG
---
test/shell/lvmetad-pvscan-cache.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-cache.sh b/test/shell/lvmetad-pvscan-cache.sh
index 8b1e8c2..c0b7f43 100644
--- a/test/shell/lvmetad-pvscan-cache.sh
+++ b/test/shell/lvmetad-pvscan-cache.sh
@@ -32,7 +32,7 @@ fail lvs $vg1
fail lvchange -ay $vg1/$lv1
vgimport $vg1
check lv_exists $vg1
-check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg1/$lv1 lv_active ""
# Check that an LV cannot be activated by pvscan while VG is exported
vgexport $vg1
6 years, 5 months
master - tests: check.sh uses array for list
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e84a145cf4f593a4560...
Commit: e84a145cf4f593a4560f109b486a1fa1d999fe2d
Parent: c613fa48ffc0b4b89beedb93612270b29cc41fb9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 30 11:06:19 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 30 12:09:10 2017 +0200
tests: check.sh uses array for list
For properly quoted args, switch to use arrays for arg list.
---
test/lib/check.sh | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index a43aef7..c8efcca 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -261,14 +261,14 @@ inactive() {
# Check for list of LVs from given VG
lv_exists() {
local vg=$1
- local lv=
+ declare -a list=()
while [ $# -gt 1 ]; do
shift
- lv="$lv $vg/$1"
+ list+=( "$vg/$1" )
done
- test -n "$lv" || lv=$vg
- lvl "$lv" &>/dev/null || \
- die "$lv expected to exist but does not"
+ test "${#list[@]}" -gt 0 || list=( "$vg" )
+ lvl "${list[@]}" &>/dev/null || \
+ die "${list[@]}" "expected to exist, but does not!"
}
lv_not_exists() {
6 years, 5 months