master - tests: add clvm case to system_id.sh
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bf2d831e7e9ceb...
Commit: bf2d831e7e9ceb7fe0528dba8587a4157b4ac789
Parent: 20c6192fbb9901468fad8fe41c7a6366aa3ab6fd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 31 14:45:14 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 31 14:45:14 2015 -0500
tests: add clvm case to system_id.sh
---
test/shell/system_id.sh | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index ad8871a..e1d8967 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -13,11 +13,28 @@ test_description='Test system_id'
. lib/inittest
-# Should 'system_id' be usable in cluster ??
-test -e LOCAL_CLVMD && skip
-
aux prepare_devs 1
+# with clvm enabled, vgcreate with no -c option creates a clustered vg,
+# which should have no system id
+
+if [ -e LOCAL_CLVMD ]; then
+SID1=sidfoolocal
+SID2=""
+LVMLOCAL=etc/lvmlocal.conf
+rm -f $LVMLOCAL
+echo "local {" > $LVMLOCAL
+echo " system_id = $SID1" >> $LVMLOCAL
+echo "}" >> $LVMLOCAL
+aux lvmconf "global/system_id_source = lvmlocal"
+vgcreate $vg1 "$dev1"
+vgs -o+systemid $vg1
+check vg_field $vg1 systemid $SID2
+vgremove $vg1
+rm -f $LVMLOCAL
+exit 0
+fi
+
# create vg with system_id using each source
## none
8 years, 8 months
master - systemd: stop lvm2-monitor.service before dm-event.service
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=20c6192fbb9901...
Commit: 20c6192fbb9901468fad8fe41c7a6366aa3ab6fd
Parent: 666738d57a6e6b4005030995a9641933c1a54e9d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 31 15:50:16 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 31 15:50:16 2015 +0200
systemd: stop lvm2-monitor.service before dm-event.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 bb52f0d..6aacdc2 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-activation.service lvm2-lvmetad.service
+After=dm-event.socket dm-event.service lvm2-lvmetad.socket lvm2-activation.service lvm2-lvmetad.service
Before=local-fs.target
DefaultDependencies=no
Conflicts=shutdown.target
8 years, 8 months
master - systemd: stop lvm2-pvscan@.service before lvm2-lvmetad.service
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=666738d57a6e6b...
Commit: 666738d57a6e6b4005030995a9641933c1a54e9d
Parent: 139df7c4a310486d49fdd95039891b91f793ff44
Author: Michael Lass <bevan(a)bi-co.net>
AuthorDate: Tue Mar 31 15:47:01 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 31 15:47:01 2015 +0200
systemd: stop lvm2-pvscan@.service before lvm2-lvmetad.service
When lvm2-pvscan@.service and lvm2-lvmetad.service are scheduled to be
stopped lvm2-pvscan@.service should be stopped first since pvscan uses
lvmetad.
This is especially important if lvm2-lvmetad.socket is also scheduled to
be stopped as in this case connection requests are suppressed causing
pvscan to fail.
---
scripts/lvm2_pvscan_systemd_red_hat@.service.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
index 7d3b291..03651d5 100644
--- a/scripts/lvm2_pvscan_systemd_red_hat@.service.in
+++ b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
@@ -4,7 +4,7 @@ Documentation=man:pvscan(8)
DefaultDependencies=no
BindsTo=dev-block-%i.device
Requires=lvm2-lvmetad.socket
-After=lvm2-lvmetad.socket
+After=lvm2-lvmetad.socket lvm2-lvmetad.service
Before=shutdown.target
Conflicts=shutdown.target
8 years, 8 months
master - lvm.conf: fix typo as -> is in read_only_volume_list comments
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=974a029a8a181b...
Commit: 974a029a8a181b3bc8ee5f10b202408b175d1b4b
Parent: 04826db7c415028cb4a16bdde5553859779380ac
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 31 15:38:29 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 31 15:38:29 2015 +0200
lvm.conf: fix typo as -> is in read_only_volume_list comments
---
conf/example.conf.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 51e8e85..1863a89 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -997,7 +997,7 @@ activation {
# auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
# If read_only_volume_list is defined, each LV that is to be activated
- # is checked against the list, and if it matches, it as activated
+ # is checked against the list, and if it matches, it is activated
# in read-only mode. (This overrides '--permission rw' stored in the
# metadata.)
#
8 years, 8 months
master - polldaemon: fix indentation in _poll_vg fn
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=04826db7c41502...
Commit: 04826db7c415028cb4a16bdde5553859779380ac
Parent: 663254d7a5d84ef5803875806c461513f581f4e2
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Tue Mar 31 13:16:01 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Tue Mar 31 13:16:01 2015 +0200
polldaemon: fix indentation in _poll_vg fn
---
tools/polldaemon.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 20a18fa..6b06506 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -230,8 +230,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
continue;
}
- if (!str_list_add(cmd->mem, sls, dm_pool_strdup(cmd->mem, name)))
- {
+ if (!str_list_add(cmd->mem, sls, dm_pool_strdup(cmd->mem, name))) {
log_error("Failed to clone pvname");
goto err;
}
8 years, 8 months
master - polldaemon: proper error check in _poll_vg fn
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=663254d7a5d84e...
Commit: 663254d7a5d84ef5803875806c461513f581f4e2
Parent: b9e6e66de15ca638ca504a07d6476e571a6197d3
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Tue Mar 31 11:26:53 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Tue Mar 31 11:26:53 2015 +0200
polldaemon: proper error check in _poll_vg fn
could theoretically cause NULL pointer dereference
---
tools/polldaemon.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 5383812..20a18fa 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -191,7 +191,7 @@ static int _wait_for_single_lv(struct cmd_context *cmd, const char *name, const
static int _poll_vg(struct cmd_context *cmd, const char *vgname,
struct volume_group *vg, struct processing_handle *handle)
{
- struct daemon_parms *parms = (struct daemon_parms *) handle->custom_handle;
+ struct daemon_parms *parms;
struct lv_list *lvl;
struct dm_list *sls;
struct dm_str_list *sl;
@@ -199,7 +199,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
const char *name;
int finished;
- if (!parms) {
+ if (!handle || !(parms = (struct daemon_parms *) handle->custom_handle)) {
log_error(INTERNAL_ERROR "Handle is undefined.");
return ECMD_FAILED;
}
8 years, 8 months
master - tests: add pvmove --abort for all moves in progress
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b9e6e66de15ca6...
Commit: b9e6e66de15ca638ca504a07d6476e571a6197d3
Parent: 5f7428e4d54254943da721f7ce11ae90aaa3f5a4
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Mar 30 16:59:51 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Mar 30 18:39:30 2015 +0200
tests: add pvmove --abort for all moves in progress
test for bug described in c282a66132063d702d1df1e342961f75a5ffcdd2
---
test/shell/pvmove-abort-all.sh | 68 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
new file mode 100644
index 0000000..85ee457
--- /dev/null
+++ b/test/shell/pvmove-abort-all.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+#
+# 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
+
+# Check pvmove --abort behaviour for all VGs and PVs
+
+. lib/inittest
+
+aux prepare_pvs 6 60
+
+vgcreate -s 128k $vg "$dev1" "$dev2"
+pvcreate --metadatacopies 0 "$dev3"
+vgextend $vg "$dev3"
+vgcreate -s 128k $vg1 "$dev4" "$dev5"
+pvcreate --metadatacopies 0 "$dev6"
+vgextend $vg1 "$dev6"
+
+for mode in "--atomic" "" ;
+do
+for backgroundarg in "-b" "" ;
+do
+
+# Create multisegment LV
+lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
+lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
+lvcreate -an -Zn -l30 -n $lv1 $vg1 "$dev4"
+lvextend -l+30 -n $vg1/$lv1 "$dev5"
+
+# Slowdown writes
+aux delay_dev "$dev3" 0 300
+aux delay_dev "$dev6" 0 300
+
+pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove1" 300
+pvmove -i1 $backgroundarg -n $vg1/$lv1 "$dev4" "$dev6" $mode &
+aux wait_pvmove_lv_ready "$vg1-pvmove0" 300
+
+# test removal of all pvmove LVs
+pvmove --abort
+
+# check if proper pvmove was canceled
+get lv_field $vg name -a | tee out
+not grep "^\[pvmove" out
+get lv_field $vg1 name -a | tee out
+not grep "^\[pvmove" out
+
+# Restore delayed device back
+aux enable_dev "$dev3"
+aux enable_dev "$dev6"
+
+lvremove -ff $vg
+lvremove -ff $vg1
+
+wait
+done
+done
+
+vgremove -ff $vg
+vgremove -ff $vg1
8 years, 8 months
master - tests: add pvmove --abort test
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5f7428e4d54254...
Commit: 5f7428e4d54254943da721f7ce11ae90aaa3f5a4
Parent: c282a66132063d702d1df1e342961f75a5ffcdd2
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Mar 30 16:59:06 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Mar 30 18:39:24 2015 +0200
tests: add pvmove --abort test
test for bug described in c282a66132063d702d1df1e342961f75a5ffcdd2
---
test/shell/pvmove-abort.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
new file mode 100644
index 0000000..6798b59
--- /dev/null
+++ b/test/shell/pvmove-abort.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+#
+# 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
+
+# Check pvmove --abort behaviour when specific device is requested
+
+. lib/inittest
+
+aux prepare_pvs 3 60
+
+vgcreate -s 128k $vg "$dev1" "$dev2"
+pvcreate --metadatacopies 0 "$dev3"
+vgextend $vg "$dev3"
+
+for mode in "--atomic" "" ;
+do
+for backgroundarg in "-b" "" ;
+do
+
+# Create multisegment LV
+lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
+lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
+
+# Slowdown writes
+aux delay_dev "$dev3" 0 200
+
+pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove1" 300
+
+# remove specific device
+pvmove --abort "$dev1"
+
+# check if proper pvmove was canceled
+get lv_field $vg name -a | tee out
+not grep "^\[pvmove0\]" out
+grep "^\[pvmove1\]" out
+
+# Restore delayed device back
+aux enable_dev "$dev3"
+
+# remove any remaining pvmoves in progress
+pvmove --abort
+
+lvremove -ff $vg
+
+wait
+done
+done
+
+vgremove -ff $vg
8 years, 8 months
master - pvmove: fix pvmove --abort or pvmove w/o parameters
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c282a66132063d...
Commit: c282a66132063d702d1df1e342961f75a5ffcdd2
Parent: 7c66850ce506d9a8bdae74f999a658507943d57c
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Mar 30 16:25:04 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Mar 30 18:38:50 2015 +0200
pvmove: fix pvmove --abort or pvmove w/o parameters
_check_lv_status was called from within dm_list_iterate_items cycle.
This was utterly wrong! _check_lv_status may remove more than one LV from
vg->lvs list we iterated in the same time.
In some scenarios this could lead to deadlock iterationg over same LV
indefinitely or segfault depending on the circumstances.
Fixed by moving the _check_lv_status outside iterating the vg->lvs
list.
Note that commit 6e7b24d34ff3da1c56718bb7def8a8ecd4258c43 was not enough
as _check_lv_status may result in removal of more than one LV from the list.
---
tools/polldaemon.c | 42 ++++++++++++++++++++++++++++++++++++------
1 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 53dab96..5383812 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -192,7 +192,9 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
struct volume_group *vg, struct processing_handle *handle)
{
struct daemon_parms *parms = (struct daemon_parms *) handle->custom_handle;
- struct lv_list *lvl, *tmp_lvl;
+ struct lv_list *lvl;
+ struct dm_list *sls;
+ struct dm_str_list *sl;
struct logical_volume *lv;
const char *name;
int finished;
@@ -202,7 +204,18 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
return ECMD_FAILED;
}
- dm_list_iterate_items_safe(lvl, tmp_lvl, &vg->lvs) {
+ if (!(sls = str_list_create(cmd->mem)))
+ return ECMD_FAILED;
+
+ log_verbose("Looking for pvmove LVs in VG: %s.", vg->name);
+
+ /*
+ * _check_lv_status must not be called from within any
+ * dm_list_iterate_ routine with vg->lvs as list head.
+ * It may remove more than one LV in the process thus
+ * even "*_safe" variant won't help.
+ */
+ dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (!(lv->status & parms->lv_type))
continue;
@@ -217,13 +230,30 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
continue;
}
- if (_check_lv_status(cmd, vg, lv, name, parms, &finished) &&
- !finished)
- parms->outstanding_count++;
+ if (!str_list_add(cmd->mem, sls, dm_pool_strdup(cmd->mem, name)))
+ {
+ log_error("Failed to clone pvname");
+ goto err;
+ }
+
+ log_verbose("Found LV: %s/%s. It belongs to pvmove task on PV %s.", lv->vg->name, lv->name, name);
}
- return ECMD_PROCESSED;
+ dm_list_iterate_items(sl, sls) {
+ lv = parms->poll_fns->get_copy_lv(cmd, vg, sl->str, NULL, parms->lv_type);
+ if (lv) {
+ log_verbose("About to call _check_lv_status on LV: %s/%s, name: %s",
+ lv->vg->name, lv->name, sl->str);
+ if (_check_lv_status(cmd, vg, lv, sl->str, parms, &finished) &&
+ !finished)
+ parms->outstanding_count++;
+ }
+ }
+
+err:
+ dm_pool_free(cmd->mem, sls);
+ return ECMD_PROCESSED;
}
static void _poll_for_all_vgs(struct cmd_context *cmd,
8 years, 8 months