master - test: Fix the vgck test after vg_write change.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=60443d6a5d17c9...
Commit: 60443d6a5d17c9f3ba935263a5e14a8548aab509
Parent: f58a7f305bae83e678e0e46ba99c18d9ec580f81
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sun Jun 8 20:16:13 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Sun Jun 8 21:10:47 2014 +0200
test: Fix the vgck test after vg_write change.
---
test/shell/vgck.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/vgck.sh b/test/shell/vgck.sh
index 40af20a..b6858cb 100644
--- a/test/shell/vgck.sh
+++ b/test/shell/vgck.sh
@@ -18,11 +18,11 @@ dd if=/dev/urandom bs=512 seek=2 count=32 of="$dev2"
# TODO: aux lvmconf "global/locking_type = 4"
+vgscan 2>&1 | tee vgscan.out
+
if test -e LOCAL_LVMETAD; then
- vgscan 2>&1 | tee vgscan.out
not grep "Inconsistent metadata found for VG $vg" vgscan.out
else
- not vgscan 2>&1 | tee vgscan.out
grep "Inconsistent metadata found for VG $vg" vgscan.out
fi
9 years, 11 months
master - test: Fail devices silently in lvconvert-repair-transient.sh.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f58a7f305bae83...
Commit: f58a7f305bae83e678e0e46ba99c18d9ec580f81
Parent: eda4c3a41d7ca1642ee779af69cb862ba8332e66
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 26 14:38:46 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Sun Jun 8 21:10:47 2014 +0200
test: Fail devices silently in lvconvert-repair-transient.sh.
---
test/shell/lvconvert-repair-transient.sh | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-repair-transient.sh b/test/shell/lvconvert-repair-transient.sh
index 3614a69..21df1ef 100644
--- a/test/shell/lvconvert-repair-transient.sh
+++ b/test/shell/lvconvert-repair-transient.sh
@@ -14,12 +14,16 @@
aux mirror_recovery_works || skip
aux prepare_vg 5
+# ordinary mirrors
+
lvcreate -aey --type mirror -m 3 --ignoremonitoring -L 1 -n 4way $vg
-aux disable_dev "$dev2" "$dev4"
+aux disable_dev --error --silent "$dev2" "$dev4"
mkfs.ext3 "$DM_DEV_DIR/$vg/4way" &
sleep 1
-aux enable_dev "$dev2" "$dev4"
+dmsetup status
echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out
+aux enable_dev --silent "$dev2" "$dev4"
+
lvs -a -o +devices | tee out
not grep unknown out
vgreduce --removemissing $vg
9 years, 11 months
master - test: Make it possible to enable/disable devices silently.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eda4c3a41d7ca1...
Commit: eda4c3a41d7ca1642ee779af69cb862ba8332e66
Parent: dba6dec661c6a0193d9d713c6fd0b9b008c0f26a
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 26 14:37:45 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Sun Jun 8 21:10:47 2014 +0200
test: Make it possible to enable/disable devices silently.
---
test/lib/aux.sh | 40 ++++++++++++++++++++++++++++++++++++----
1 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 445bf26..3ececaf 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -406,19 +406,50 @@ delay_dev() {
disable_dev() {
local dev
+ local silent
+ local error
+ local notify
+
+ while test -n "$1"; do
+ if test "$1" = "--silent"; then
+ silent=1
+ shift
+ elif test "$1" = "--error"; then
+ error=1
+ shift
+ else
+ break
+ fi
+ done
udev_wait
for dev in "$@"; do
maj=$(($(stat -L --printf=0x%t "$dev")))
min=$(($(stat -L --printf=0x%T "$dev")))
echo "Disabling device $dev ($maj:$min)"
- dmsetup remove -f "$dev" 2>/dev/null || true
- notify_lvmetad --major "$maj" --minor "$min"
+ notify="$notify $maj:$min"
+ if test -n "$error"; then
+ echo 0 10000000 error | dmsetup load $dev
+ dmsetup resume $dev
+ else
+ dmsetup remove -f "$dev" 2>/dev/null || true
+ fi
+ done
+
+ test -n "$silent" || for num in $notify; do
+ notify_lvmetad --major $(echo $num | sed -e "s,:.*,,") \
+ --minor $(echo $num | sed -e "s,.*:,,")
done
}
enable_dev() {
local dev
+ local silent
+
+ if test "$1" = "--silent"; then
+ silent=1
+ shift
+ fi
rm -f debug.log
init_udev_transaction
@@ -431,7 +462,7 @@ enable_dev() {
done
finish_udev_transaction
- for dev in "$@"; do
+ test -n "$silent" || for dev in "$@"; do
notify_lvmetad "$dev"
done
}
@@ -450,6 +481,7 @@ error_dev() {
local type
local pvdev
local offset
+ local silent
read pos size type pvdev offset < $name.table
@@ -480,7 +512,7 @@ error_dev() {
# using device name (since device path does not exists yet with udev)
dmsetup resume "$name"
finish_udev_transaction
- notify_lvmetad "$dev"
+ test -n "$silent" || notify_lvmetad "$dev"
}
backup_dev() {
9 years, 11 months
master - metadata: Make it possible to write partial VGs obtained from lvmetad.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dba6dec661c6a0...
Commit: dba6dec661c6a0193d9d713c6fd0b9b008c0f26a
Parent: 943f3aec3d20169045ec2d2f4a07d87827cb95d8
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 26 14:23:33 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Sun Jun 8 17:41:11 2014 +0200
metadata: Make it possible to write partial VGs obtained from lvmetad.
---
lib/metadata/metadata.c | 47 ++++++++++++++++++++++++++++-------------------
lib/metadata/metadata.h | 1 +
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index fd81c1b..15f9249 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2613,6 +2613,7 @@ int vg_write(struct volume_group *vg)
struct dm_list *mdah;
struct pv_to_create *pv_to_create;
struct metadata_area *mda;
+ int revert = 0, wrote = 0;
if (!vg_validate(vg))
return_0;
@@ -2665,39 +2666,45 @@ int vg_write(struct volume_group *vg)
if (!mda->ops->vg_write) {
log_error("Format does not support writing volume"
"group metadata areas");
- /* Revert */
- dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
- mda = dm_list_item(mdah, struct metadata_area);
-
- if (mda->ops->vg_revert &&
- !mda->ops->vg_revert(vg->fid, vg, mda)) {
- stack;
- }
- }
- return 0;
+ revert = 1;
+ break;
}
if (!mda->ops->vg_write(vg->fid, vg, mda)) {
- stack;
- /* Revert */
- dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
- mda = dm_list_item(mdah, struct metadata_area);
+ if (vg->cmd->handles_missing_pvs) {
+ log_warn("WARNING: Failed to write an MDA of VG %s.", vg->name);
+ mda->status |= MDA_FAILED;
+ } else {
+ stack;
+ revert = 1;
+ break;
+ }
+ } else
+ ++ wrote;
+ }
- if (mda->ops->vg_revert &&
- !mda->ops->vg_revert(vg->fid, vg, mda)) {
- stack;
- }
+ if (revert || !wrote) {
+ dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
+ mda = dm_list_item(mdah, struct metadata_area);
+
+ if (mda->ops->vg_revert &&
+ !mda->ops->vg_revert(vg->fid, vg, mda)) {
+ stack;
}
- return 0;
}
+ return 0;
}
/* Now pre-commit each copy of the new metadata */
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
+ if (mda->status & MDA_FAILED)
+ continue;
if (mda->ops->vg_precommit &&
!mda->ops->vg_precommit(vg->fid, vg, mda)) {
stack;
/* Revert */
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
+ if (mda->status & MDA_FAILED)
+ continue;
if (mda->ops->vg_revert &&
!mda->ops->vg_revert(vg->fid, vg, mda)) {
stack;
@@ -2738,6 +2745,8 @@ static int _vg_commit_mdas(struct volume_group *vg)
/* Commit to each copy of the metadata area */
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
+ if (mda->status & MDA_FAILED)
+ continue;
failed = 0;
if (mda->ops->vg_commit &&
!mda->ops->vg_commit(vg->fid, vg, mda)) {
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index ed78cb6..4c5ad33 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -154,6 +154,7 @@ struct metadata_area_ops {
#define MDA_IGNORED 0x00000001
#define MDA_INCONSISTENT 0x00000002
+#define MDA_FAILED 0x00000004
struct metadata_area {
struct dm_list list;
9 years, 11 months
master - cleanup: move the "daemon is running" checks to lvm-wrappers
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=943f3aec3d2016...
Commit: 943f3aec3d20169045ec2d2f4a07d87827cb95d8
Parent: f115a4a53fe6c3a3121e200c7f8796fb086c0c6e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 6 14:21:09 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jun 6 14:21:09 2014 +0200
cleanup: move the "daemon is running" checks to lvm-wrappers
And use ifdefs there, not exposing it in the tool code itself.
Later in the future, we should probably make the PIDFILE and
daemon checking code available also in case the daemon itself
is not built.
---
lib/mirror/mirrored.c | 2 +-
lib/misc/lvm-wrappers.c | 24 ++++++++++++++++++++++++
lib/misc/lvm-wrappers.h | 4 ++++
tools/vgchange.c | 6 +-----
4 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index e3f768f..5040011 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -497,7 +497,7 @@ static int _mirrored_target_present(struct cmd_context *cmd,
* otherwise, the kernel module will fail to make
* contact.
*/
- if (dm_daemon_is_running(CMIRRORD_PIDFILE)) {
+ if (cmirrord_is_running()) {
struct utsname uts;
unsigned kmaj, kmin, krel;
/*
diff --git a/lib/misc/lvm-wrappers.c b/lib/misc/lvm-wrappers.c
index 5604ce7..4e3ff33 100644
--- a/lib/misc/lvm-wrappers.c
+++ b/lib/misc/lvm-wrappers.c
@@ -139,3 +139,27 @@ unsigned lvm_even_rand(unsigned *seed, unsigned max)
return ret;
}
+
+#ifdef CLVMD_PIDFILE
+inline int clvmd_is_running(void)
+{
+ return dm_daemon_is_running(CLVMD_PIDFILE);
+}
+#else
+inline int clvmd_is_running(void)
+{
+ return 0;
+}
+#endif
+
+#ifdef CMIRRORD_PIDFILE
+inline int cmirrord_is_running(void)
+{
+ return dm_daemon_is_running(CMIRRORD_PIDFILE);
+}
+#else
+inline int cmirrord_is_running(void)
+{
+ return 0;
+}
+#endif
diff --git a/lib/misc/lvm-wrappers.h b/lib/misc/lvm-wrappers.h
index 137cbdb..fbf28b8 100644
--- a/lib/misc/lvm-wrappers.h
+++ b/lib/misc/lvm-wrappers.h
@@ -37,4 +37,8 @@ int read_urandom(void *buf, size_t len);
*/
unsigned lvm_even_rand(unsigned *seed, unsigned max);
+inline int clvmd_is_running(void);
+inline int cmirrord_is_running(void);
+
+
#endif
diff --git a/tools/vgchange.c b/tools/vgchange.c
index fef1301..2556af2 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -304,7 +304,6 @@ static int _vgchange_clustered(struct cmd_context *cmd,
struct volume_group *vg)
{
int clustered = !strcmp(arg_str_value(cmd, clustered_ARG, "n"), "y");
- int clvmd_daemon_running = 0;
if (clustered && (vg_is_clustered(vg))) {
log_error("Volume group \"%s\" is already clustered",
@@ -319,10 +318,7 @@ static int _vgchange_clustered(struct cmd_context *cmd,
}
if (clustered && !arg_count(cmd, yes_ARG)) {
-#ifdef CLVMD_PIDFILE
- clvmd_daemon_running = dm_daemon_is_running(CLVMD_PIDFILE);
-#endif
- if (!clvmd_daemon_running) {
+ if (!clvmd_is_running()) {
if (yes_no_prompt("LVM cluster daemon (clvmd) is not"
" running.\n"
"Make volume group \"%s\" clustered"
9 years, 11 months
master - configure: update libcpg test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f115a4a53fe6c3...
Commit: f115a4a53fe6c3a3121e200c7f8796fb086c0c6e
Parent: 14f482077dadd33e35a33cbd57bc80a884992794
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 6 10:29:47 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 6 10:31:45 2014 +0200
configure: update libcpg test
PKG_CHECK_MODULES needs old-way if;then;fi.
---
configure | 4 +++-
configure.in | 8 +++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 034ee12..dec82de 100755
--- a/configure
+++ b/configure
@@ -9149,7 +9149,8 @@ $as_echo "yes" >&6; }
HAVE_SACKPT=yes
fi
- test "$HAVE_CPG" != yes &&
+ if test "$HAVE_CPG" != yes; then
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CPG" >&5
$as_echo_n "checking for CPG... " >&6; }
@@ -9240,6 +9241,7 @@ else
$as_echo "yes" >&6; }
fi
+ fi
fi
################################################################################
diff --git a/configure.in b/configure.in
index 12404ba..d92e03e 100644
--- a/configure.in
+++ b/configure.in
@@ -847,7 +847,9 @@ if [[ "$BUILD_CMIRRORD" = yes ]]; then
[AC_MSG_RESULT([no libSaCkpt, compiling without it])
AC_DEFINE([CMIRROR_HAS_CHECKPOINT], 0, [Define to 0 to exclude libSaCkpt.])])
- test "$HAVE_CPG" != yes && PKG_CHECK_MODULES(CPG, libcpg)
+ if test "$HAVE_CPG" != yes; then
+ PKG_CHECK_MODULES(CPG, libcpg)
+ fi
fi
################################################################################
@@ -911,7 +913,7 @@ fi
dnl -- Enable testing
AC_MSG_CHECKING(whether to enable unit testing)
AC_ARG_ENABLE(testing,
- AC_HELP_STRING([--enable-testing],
+ AC_HELP_STRING([--enable-testing],
[enable testing targets in the makefile]),
TESTING=$enableval, TESTING=no)
AC_MSG_RESULT($TESTING)
@@ -925,7 +927,7 @@ fi
dnl -- Enable valgrind awareness of memory pools
AC_MSG_CHECKING(whether to enable valgrind awareness of pools)
AC_ARG_ENABLE(valgrind_pool,
- AC_HELP_STRING([--enable-valgrind-pool],
+ AC_HELP_STRING([--enable-valgrind-pool],
[enable valgrind awareness of pools]),
VALGRIND_POOL=$enableval, VALGRIND_POOL=no)
AC_MSG_RESULT($VALGRIND_POOL)
9 years, 11 months
master - cleanup: default.profile is not used (and it was split in two and renamed anyway)
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=14f482077dadd3...
Commit: 14f482077dadd33e35a33cbd57bc80a884992794
Parent: 291e55557ee4061a042d6d59b04aa09e6f503386
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 6 10:24:50 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jun 6 10:24:50 2014 +0200
cleanup: default.profile is not used (and it was split in two and renamed anyway)
---
test/Makefile.in | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 370d9bd..5ac045f 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -181,7 +181,6 @@ CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
ln -fs $(abs_top_builddir)/daemons/lvmetad/lvmetad lib/lvmetad
ln -fs $(abs_top_srcdir)/scripts/vgimportclone.sh lib/vgimportclone
ln -fs $(abs_top_srcdir)/scripts/fsadm.sh lib/fsadm
- ln -fs $(abs_top_builddir)/conf/default.profile lib/default.profile
ln -fs $(abs_top_srcdir)/conf/thin-performance.profile lib/thin-performance.profile
touch $@
9 years, 11 months
master - cleanup: commit c0f9c79 to work also with for non-clustered configuration
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=291e55557ee406...
Commit: 291e55557ee4061a042d6d59b04aa09e6f503386
Parent: c0f9c79ae8e1df16d23f3eb608fb4bf5455ec841
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 6 10:17:26 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jun 6 10:17:26 2014 +0200
cleanup: commit c0f9c79 to work also with for non-clustered configuration
---
tools/vgchange.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 958919c..fef1301 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -304,6 +304,7 @@ static int _vgchange_clustered(struct cmd_context *cmd,
struct volume_group *vg)
{
int clustered = !strcmp(arg_str_value(cmd, clustered_ARG, "n"), "y");
+ int clvmd_daemon_running = 0;
if (clustered && (vg_is_clustered(vg))) {
log_error("Volume group \"%s\" is already clustered",
@@ -318,7 +319,10 @@ static int _vgchange_clustered(struct cmd_context *cmd,
}
if (clustered && !arg_count(cmd, yes_ARG)) {
- if (!dm_daemon_is_running(CLVMD_PIDFILE)) {
+#ifdef CLVMD_PIDFILE
+ clvmd_daemon_running = dm_daemon_is_running(CLVMD_PIDFILE);
+#endif
+ if (!clvmd_daemon_running) {
if (yes_no_prompt("LVM cluster daemon (clvmd) is not"
" running.\n"
"Make volume group \"%s\" clustered"
9 years, 11 months
master - vgchange: With '--yes', don't prompt the user
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c0f9c79ae8e1df...
Commit: c0f9c79ae8e1df16d23f3eb608fb4bf5455ec841
Parent: 1f2aedb1903d1422b7093f6afbdd81d912c969b6
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Jun 5 22:45:19 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Jun 5 22:45:19 2014 -0500
vgchange: With '--yes', don't prompt the user
If the user supplies a '--yes' argument, then don't bother them with
a question to confirm whether to change the cluster attribute (even
if clvmd isn't running).
---
tools/vgchange.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 478a8ca..958919c 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -317,7 +317,7 @@ static int _vgchange_clustered(struct cmd_context *cmd,
return 0;
}
- if (clustered) {
+ if (clustered && !arg_count(cmd, yes_ARG)) {
if (!dm_daemon_is_running(CLVMD_PIDFILE)) {
if (yes_no_prompt("LVM cluster daemon (clvmd) is not"
" running.\n"
9 years, 11 months
master - WHATS_NEW: For commit 9399b743 (prompt for VG cluster attr change)
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f2aedb1903d14...
Commit: 1f2aedb1903d1422b7093f6afbdd81d912c969b6
Parent: 9399b74356f9d0c2fbbac824908b15d63c3935cd
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Jun 5 22:29:16 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Jun 5 22:30:50 2014 -0500
WHATS_NEW: For commit 9399b743 (prompt for VG cluster attr change)
Minor change, but put a comment in WHATS_NEW anyway.
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a2b8af7..65cac33 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ Prompt when setting the VG cluster attr if the cluster is not setup.
Allow --yes to skip prompt in vgextend (worked only with -f).
Don't use name mangling for LVM - it never uses dm names with wrong char set.
Remove default.profile and add {command,metadata}_profile_template.profile.
9 years, 11 months