master - tests: add helper funcionality for using gdb
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=21aa850b43535a...
Commit: 21aa850b43535ab251eebabe2a2773a62439bf61
Parent: 9acbb0695f96a400f2be6c1c5bf76b914653c200
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 01:16:57 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
tests: add helper funcionality for using gdb
When there is need for using gdb within test suite
just prefix command with LVM_DBG and run test in
standard shell (for stdin).
---
test/lib/lvm-wrapper.sh | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/test/lib/lvm-wrapper.sh b/test/lib/lvm-wrapper.sh
index c69e29a..082c640 100644
--- a/test/lib/lvm-wrapper.sh
+++ b/test/lib/lvm-wrapper.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2011-2012 Red Hat, Inc.
+# Copyright (C) 2011-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -14,6 +14,13 @@
CMD=${0##*/}
test "$CMD" != lvm || unset CMD
+# When needed to trace command from test suite use env var before program
+# and run program directly via shell in test dir i.e.:
+# sh shell/activate-mirror.sh
+# 'LVM_GDB=1 lvcreate -l1 $vg'
+# > run
+test -z "$LVM_GDB" || exec gdb --readnow --args "$abs_top_builddir/tools/lvm" $CMD "$@"
+
# Multiple level of LVM_VALGRIND support
# the higher level the more commands are traced
if test -n "$LVM_VALGRIND"; then
9 years, 6 months
master - tests: drop * from dmsetup
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9acbb0695f96a4...
Commit: 9acbb0695f96a400f2be6c1c5bf76b914653c200
Parent: bc5031c28383d492aa0c349fe2e058c2c26b2934
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 01:11:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
tests: drop * from dmsetup
We cannot use shell expansion for dmsetup here.
---
test/shell/pvmove-restart.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh
index dde7308..effa43d 100644
--- a/test/shell/pvmove-restart.sh
+++ b/test/shell/pvmove-restart.sh
@@ -41,7 +41,7 @@ wait
# Simulate reboot - forcibly remove related devices
dmsetup table
dmsetup remove $vg-$lv1
-dmsetup remove "$DM_DEV_DIR/mapper/$vg-pvmove0*"
+dmsetup remove "$DM_DEV_DIR/mapper/$vg-pvmove0"
# Check we really have pvmove volume
check lv_attr_bit type $vg/pvmove0 "p"
9 years, 6 months
master - debug: add debug message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc5031c28383d4...
Commit: bc5031c28383d492aa0c349fe2e058c2c26b2934
Parent: edb3902c25801117557852f4a37802144da63841
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 24 10:03:55 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
debug: add debug message
Since we leave error printing on the called of deactivation,
at least put in debug log for this case.
---
lib/activate/activate.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 3e4b04b..58e847e 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2160,8 +2160,12 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logi
r = _lv_deactivate(lv);
critical_section_dec(cmd, "deactivated");
- if (!lv_info(cmd, lv, 0, &info, 0, 0) || info.exists)
+ if (!lv_info(cmd, lv, 0, &info, 0, 0) || info.exists) {
+ /* Turn into log_error, but we do not log error */
+ log_debug_activation("Deactivated volume is still %s present.",
+ display_lvname(lv));
r = 0;
+ }
out:
if (lv_to_free) {
lv_release_replicator_vgs(lv_to_free);
9 years, 6 months
master - debug: show stacktrace on error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=edb3902c258011...
Commit: edb3902c25801117557852f4a37802144da63841
Parent: 2bfd986ea343244d33181c6b78dc39c8725014cd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 15:59:50 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
debug: show stacktrace on error path
---
tools/lvconvert.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index cc874c5..1d60c21 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3307,7 +3307,8 @@ static int _lvconvert_merge_single(struct cmd_context *cmd, struct logical_volum
}
lp->lv_to_poll = refreshed_lv;
- ret = _lvconvert_single(cmd, refreshed_lv, lp);
+ if ((ret = _lvconvert_single(cmd, refreshed_lv, lp)) != ECMD_PROCESSED)
+ stack;
if (ret == ECMD_PROCESSED && lp->need_polling) {
/*
@@ -3316,8 +3317,9 @@ static int _lvconvert_merge_single(struct cmd_context *cmd, struct logical_volum
*/
unlock_vg(cmd, vg_name);
- ret = _poll_logical_volume(cmd, lp->lv_to_poll,
- lp->wait_completion);
+ if (!(ret = _poll_logical_volume(cmd, lp->lv_to_poll,
+ lp->wait_completion)) != ECMD_PROCESSED)
+ stack;
/* use LCK_VG_WRITE to match lvconvert()'s READ_FOR_UPDATE */
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL)) {
9 years, 6 months
master - debug: drop printing debug trace without labeler
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2bfd986ea34324...
Commit: 2bfd986ea343244d33181c6b78dc39c8725014cd
Parent: 4319e06a0fe0b27471ea47687e344b836577f465
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 13:34:12 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
debug: drop printing debug trace without labeler
Not having labeller on device is not reason eo generate backtrace in log.
---
lib/label/label.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index 703fef7..ce59da8 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -278,15 +278,12 @@ int label_read(struct device *dev, struct label **result,
return r;
}
- if (!(l = _find_labeller(dev, buf, §or, scan_sector)))
- goto_out;
-
- if ((r = (l->ops->read)(l, dev, buf, result)) && result && *result) {
- (*result)->dev = dev;
- (*result)->sector = sector;
- }
+ if ((l = _find_labeller(dev, buf, §or, scan_sector)))
+ if ((r = (l->ops->read)(l, dev, buf, result)) && result && *result) {
+ (*result)->dev = dev;
+ (*result)->sector = sector;
+ }
- out:
if (!dev_close(dev))
stack;
9 years, 6 months
master - debug: add missing stack trace
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4319e06a0fe0b2...
Commit: 4319e06a0fe0b27471ea47687e344b836577f465
Parent: 7531a9169e9b9fdb740dbd7c805ade55fb3a440c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 11:48:09 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
debug: add missing stack trace
---
tools/vgchange.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index ba66b0f..dfb1251 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -234,8 +234,10 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
}
}
- if (!_activate_lvs_in_vg(cmd, vg, activate))
+ if (!_activate_lvs_in_vg(cmd, vg, activate)) {
+ stack;
r = 0;
+ }
/* Print message only if there was not found a missing VG */
if (!vg->cmd_missing_vgs)
9 years, 6 months
master - debug: monitor_dev_for_events stack trace
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7531a9169e9b9f...
Commit: 7531a9169e9b9fdb740dbd7c805ade55fb3a440c
Parent: 03aeb867621ee5facbc01b95629af29b28c559a5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 24 09:58:04 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
debug: monitor_dev_for_events stack trace
---
lib/activate/activate.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index c5ff84d..3e4b04b 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1657,8 +1657,11 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
* In case of a snapshot device, we monitor lv->snapshot->lv,
* not the actual LV itself.
*/
- if (lv_is_cow(lv) && (laopts->no_merging || !lv_is_merging_cow(lv)))
- return monitor_dev_for_events(cmd, lv->snapshot->lv, NULL, monitor);
+ if (lv_is_cow(lv) && (laopts->no_merging || !lv_is_merging_cow(lv))) {
+ if (!(r = monitor_dev_for_events(cmd, lv->snapshot->lv, NULL, monitor)))
+ stack;
+ return r;
+ }
/*
* In case this LV is a snapshot origin, we instead monitor
@@ -1668,8 +1671,10 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (!laopts->origin_only && lv_is_origin(lv))
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
if (!monitor_dev_for_events(cmd, dm_list_struct_base(snh,
- struct lv_segment, origin_list)->cow, NULL, monitor))
+ struct lv_segment, origin_list)->cow, NULL, monitor)) {
+ stack;
r = 0;
+ }
/*
* If the volume is mirrored and its log is also mirrored, monitor
@@ -1678,8 +1683,10 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if ((seg = first_seg(lv)) != NULL && seg->log_lv != NULL &&
(log_seg = first_seg(seg->log_lv)) != NULL &&
seg_is_mirrored(log_seg))
- if (!monitor_dev_for_events(cmd, seg->log_lv, NULL, monitor))
+ if (!monitor_dev_for_events(cmd, seg->log_lv, NULL, monitor)) {
+ stack;
r = 0;
+ }
dm_list_iterate_items(seg, &lv->segments) {
/* Recurse for AREA_LV */
@@ -1702,12 +1709,16 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
*/
if (seg->pool_lv &&
!monitor_dev_for_events(cmd, seg->pool_lv,
- (!monitor) ? laopts : NULL, monitor))
+ (!monitor) ? laopts : NULL, monitor)) {
+ stack;
r = 0;
+ }
if (seg->metadata_lv &&
- !monitor_dev_for_events(cmd, seg->metadata_lv, NULL, monitor))
+ !monitor_dev_for_events(cmd, seg->metadata_lv, NULL, monitor)) {
+ stack;
r = 0;
+ }
if (!seg_monitored(seg) ||
(seg->status & PVMOVE) ||
9 years, 6 months
master - cleanup: reindent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=03aeb867621ee5...
Commit: 03aeb867621ee5facbc01b95629af29b28c559a5
Parent: 3cef6dd721ad79bf73bbf5fa0d381ad7b71e1555
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 23 16:47:27 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
cleanup: reindent
Save some code lines.
---
lib/activate/activate.c | 6 +-----
tools/vgchange.c | 5 +++--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 8843ec9..c5ff84d 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -583,7 +583,7 @@ int module_present(struct cmd_context *cmd, const char *target_name)
int ret = 0;
#ifdef MODPROBE_CMD
char module[128];
- const char *argv[3];
+ const char *argv[] = { MODPROBE_CMD, module, NULL };
if (dm_snprintf(module, sizeof(module), "dm-%s", target_name) < 0) {
log_error("module_present module name too long: %s",
@@ -591,10 +591,6 @@ int module_present(struct cmd_context *cmd, const char *target_name)
return 0;
}
- argv[0] = MODPROBE_CMD;
- argv[1] = module;
- argv[2] = NULL;
-
ret = exec_cmd(cmd, argv, NULL, 0);
#endif
return ret;
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 1a597a6..ba66b0f 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -40,8 +40,9 @@ static int _monitor_lvs_in_vg(struct cmd_context *cmd,
if (!monitor_dev_for_events(cmd, lv, 0, reg)) {
r = 0;
continue;
- } else
- (*count)++;
+ }
+
+ (*count)++;
}
return r;
9 years, 6 months
master - cleanup: drop duplicate const usage
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3cef6dd721ad79...
Commit: 3cef6dd721ad79bf73bbf5fa0d381ad7b71e1555
Parent: f809fa5a7865bb59d9a2616629523429dd7ec629
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 15:51:49 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
cleanup: drop duplicate const usage
const char == const char const.
---
lib/device/dev-type.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 6fcfa08..001248d 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -460,9 +460,9 @@ static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
uint32_t types_to_exclude, uint32_t types_no_prompt,
int yes, force_t force)
{
- static const char const _msg_failed_offset[] = "Failed to get offset of the %s signature on %s.";
- static const char const _msg_failed_length[] = "Failed to get length of the %s signature on %s.";
- static const char const _msg_wiping[] = "Wiping %s signature on %s.";
+ static const char _msg_failed_offset[] = "Failed to get offset of the %s signature on %s.";
+ static const char _msg_failed_length[] = "Failed to get length of the %s signature on %s.";
+ static const char _msg_wiping[] = "Wiping %s signature on %s.";
const char *offset = NULL, *type = NULL, *magic = NULL,
*usage = NULL, *label = NULL, *uuid = NULL;
loff_t offset_value;
9 years, 6 months
master - cleanup: drop uneeded backup call
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f809fa5a7865bb...
Commit: f809fa5a7865bb59d9a2616629523429dd7ec629
Parent: ec4ffeb51ca15d5bd79acf77dfe38630328f1db0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 14:11:12 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:48 2014 +0200
cleanup: drop uneeded backup call
lv_update_and_reload already handle backup.
---
tools/lvconvert.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 9681f3a..cc874c5 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2572,8 +2572,6 @@ static int _lvconvert_thin(struct cmd_context *cmd,
display_lvname(torigin_lv),
display_lvname(lv));
- backup(vg);
-
return 1;
deactivate_and_revert_new_lv:
9 years, 6 months