master - lvm_init: don't use name mangling for LVM
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1c4fe47308e363...
Commit: 1c4fe47308e3638b95f042a1efc942c5ce8e4fdc
Parent: b2da0f0a5b5b99c10c2ea531b63a3d9466eb1832
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 22 09:56:44 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu May 22 10:00:19 2014 +0200
lvm_init: don't use name mangling for LVM
LVM has restricter character set that is allowed for VG-LV names
and the dm names constructed do not contain any blacklisted characters
that would require name mangling.
Also, when any other device-mapper device is scanned that could
possibly contain such blacklisted characters, we reference the
device by its major:minor instead of dm name (e.g. _device_is_usable fn).
---
WHATS_NEW | 1 +
liblvm/lvm_base.c | 7 +++++++
tools/lvmcmdline.c | 7 +++++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 61753d6..491dece 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ 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.
Use proper umask for systemd units generated by lvm2-activation-generator.
Check for failing mirror_remove_missing() function.
diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c
index 2a373ba..47ad241 100644
--- a/liblvm/lvm_base.c
+++ b/liblvm/lvm_base.c
@@ -35,6 +35,13 @@ static lvm_t _lvm_init(const char *system_dir)
if (!udev_init_library_context())
stack;
+ /*
+ * It's not necessary to use name mangling for LVM:
+ * - the character set used for VG-LV names is subset of udev character set
+ * - when we check other devices (e.g. _device_is_usable fn), we use major:minor, not dm names
+ */
+ dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
+
/* create context */
/* FIXME: split create_toolcontext */
/* FIXME: make all globals configurable */
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 96e478f..66f691e 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1527,6 +1527,13 @@ struct cmd_context *init_lvm(void)
if (!udev_init_library_context())
stack;
+ /*
+ * It's not necessary to use name mangling for LVM:
+ * - the character set used for LV names is subset of udev character set
+ * - when we check other devices (e.g. _device_is_usable fn), we use major:minor, not dm names
+ */
+ dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
+
if (!(cmd = create_toolcontext(0, NULL, 1, 0))) {
udev_fin_library_context();
return_NULL;
9 years, 11 months
master - tests: raid and dmeventd
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b2da0f0a5b5b99...
Commit: b2da0f0a5b5b99c10c2ea531b63a3d9466eb1832
Parent: 37b4dc777590ed0e6771833dce4c0727dfc72465
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 23:13:59 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 23:14:42 2014 +0200
tests: raid and dmeventd
---
test/shell/lvconvert-repair-raid-dmeventd.sh | 28 ++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-repair-raid-dmeventd.sh b/test/shell/lvconvert-repair-raid-dmeventd.sh
new file mode 100644
index 0000000..a825aa2
--- /dev/null
+++ b/test/shell/lvconvert-repair-raid-dmeventd.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright (C) 2014 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
+
+. lib/test
+
+which mkfs.ext3 || skip
+
+aux prepare_dmeventd
+aux prepare_vg 5
+
+lvcreate -aey --type raid1 -m 3 --ignoremonitoring -L 1 -n 4way $vg
+lvchange --monitor y $vg/4way
+lvs -a -o all,lv_modules $vg
+lvdisplay --maps $vg
+aux disable_dev "$dev2" "$dev4"
+mkfs.ext3 "$DM_DEV_DIR/$vg/4way"
+sleep 10 # FIXME: need a "poll" utility, akin to "check"
+aux enable_dev "$dev2" "$dev4"
+
+vgremove -ff $vg
9 years, 11 months
master - tests: more pvchange tests
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=37b4dc777590ed...
Commit: 37b4dc777590ed0e6771833dce4c0727dfc72465
Parent: 79f466524377f08ff4a736f159eac44f9923f4f1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 23:13:19 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 23:14:42 2014 +0200
tests: more pvchange tests
---
test/shell/pvchange-usage.sh | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/test/shell/pvchange-usage.sh b/test/shell/pvchange-usage.sh
index 00489bd..71388de 100644
--- a/test/shell/pvchange-usage.sh
+++ b/test/shell/pvchange-usage.sh
@@ -77,7 +77,11 @@ check pvlv_counts $vg1 2 0 0
# some args are needed
invalid pvchange
-
+# some PV needed
+invalid pvchange --addtag tag
+invalid pvchange --deltag tag
+# some --all & PV can go together
+invalid pvchange -a "$dev1" --addtag tag
# '-a' needs more params
invalid pvchange -a
# '-a' is searching for devs, so specifying device is invalid
@@ -91,6 +95,11 @@ not pvchange -u "$dev1"
vgremove -f $vg1
-# "pvchange reject --addtag to lvm1 pv"
+# cannot change PV tag to PV that is not in VG"
+fail pvchange "$dev1" --addtag test
+fail pvchange "$dev1" --deltag test
+
+# cannot add PV tag to lvm1 format
pvcreate -M1 "$dev1"
-not pvchange "$dev1" --addtag test
+vgcreate -M1 $vg1 "$dev1"
+fail pvchange "$dev1" --addtag test
9 years, 11 months
master - tests: more vgcfgrestore testing
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=79f466524377f0...
Commit: 79f466524377f08ff4a736f159eac44f9923f4f1
Parent: a4ac21aded0eec0e93ce0026cb77cd377d8713ef
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 23:12:00 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 23:14:41 2014 +0200
tests: more vgcfgrestore testing
Check '-l' and archiving.
---
test/shell/vgcfgbackup-usage.sh | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/test/shell/vgcfgbackup-usage.sh b/test/shell/vgcfgbackup-usage.sh
index 193bb9d..bc09b5b 100644
--- a/test/shell/vgcfgbackup-usage.sh
+++ b/test/shell/vgcfgbackup-usage.sh
@@ -31,12 +31,22 @@ vgcfgbackup
test -e etc/backup/$vg1
test -e etc/backup/$vg2
+aux lvmconf "backup/archive = 1"
+
vgcfgbackup -f "bak-%s" >out
grep "Volume group \"$vg1\" successfully backed up." out
grep "Volume group \"$vg2\" successfully backed up." out
# increase seqno
lvcreate -an -Zn -l1 $vg1
-vgcfgrestore -f "bak-$vg1" $vg1
+
+invalid vgcfgrestore -f "bak-$vg1" $vg1-inv@lid
+invalid vgcfgrestore -f "bak-$vg1" $vg1 $vg2
+
+vgcfgrestore -l $vg1 | tee out
+test $(grep Description out | wc -l) -eq 2
+
+vgcfgrestore -l -f "bak-$vg1" $vg1
+
vgremove -ff $vg1 $vg2
# vgcfgbackup correctly stores metadata with missing PVs
9 years, 11 months
master - cleanup: make error message more readable
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a4ac21aded0eec...
Commit: a4ac21aded0eec0e93ce0026cb77cd377d8713ef
Parent: aafd7c878c2a4bdcb72182bd31e52bae280898d1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 23:10:35 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 23:14:41 2014 +0200
cleanup: make error message more readable
---
tools/pvchange.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/pvchange.c b/tools/pvchange.c
index f87cd8c..afa6829 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -177,7 +177,7 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
}
if (arg_count(cmd, all_ARG) && argc) {
- log_error("Option a and PhysicalVolumePath are exclusive");
+ log_error("Option --all and PhysicalVolumePath are exclusive.");
return EINVALID_CMD_LINE;
}
9 years, 11 months
master - cleanup: indent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aafd7c878c2a4b...
Commit: aafd7c878c2a4bdcb72182bd31e52bae280898d1
Parent: 3ac7d2deb4270504dbae369b0b1bf14cb25a1b38
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 23:10:02 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 23:14:41 2014 +0200
cleanup: indent
---
lib/metadata/metadata.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 4791c10..fd81c1b 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -769,7 +769,7 @@ int vg_reduce(struct volume_group *vg, const char *pv_name)
}
log_error("Unable to remove physical volume '%s' from "
- "volume group '%s'.", pv_name, vg->name);
+ "volume group '%s'.", pv_name, vg->name);
return 0;
}
9 years, 11 months
master - vgcfgrestore: return invalid cmd line
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3ac7d2deb42705...
Commit: 3ac7d2deb4270504dbae369b0b1bf14cb25a1b38
Parent: 9c4953df1b5b2e2e509f6f89598a733d5d580f2b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 23:11:15 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 23:14:41 2014 +0200
vgcfgrestore: return invalid cmd line
When error is detected on command line options, return '3'.
---
tools/vgcfgrestore.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/vgcfgrestore.c b/tools/vgcfgrestore.c
index 36396c3..07c5c20 100644
--- a/tools/vgcfgrestore.c
+++ b/tools/vgcfgrestore.c
@@ -23,11 +23,11 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
vg_name = skip_dev_dir(cmd, argv[0], NULL);
if (!validate_name(vg_name)) {
log_error("Volume group name \"%s\" is invalid", vg_name);
- return ECMD_FAILED;
+ return EINVALID_CMD_LINE;
}
} else if (!(arg_count(cmd, list_ARG) && arg_count(cmd, file_ARG))) {
log_error("Please specify a *single* volume group to restore.");
- return ECMD_FAILED;
+ return EINVALID_CMD_LINE;
}
/*
9 years, 11 months
master - tests: restore disable_dev behavior
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9c4953df1b5b2e...
Commit: 9c4953df1b5b2e2e509f6f89598a733d5d580f2b
Parent: 8db67d2aff7757d022f7d339451aeb93b0374311
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 16:59:38 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 16:59:38 2014 +0200
tests: restore disable_dev behavior
Notify needs to go with major:minor before device disappears.
---
test/lib/aux.sh | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index e422fa0..01bc1ea 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -413,14 +413,9 @@ disable_dev() {
min=$(($(stat -L --printf=0x%T "$dev")))
echo "Disabling device $dev ($maj:$min)"
dmsetup remove -f "$dev" 2>/dev/null || true
- done
- finish_udev_transaction
-
- for dev in "$@"; do
- maj=$(($(stat -L --printf=0x%t "$dev")))
- min=$(($(stat -L --printf=0x%T "$dev")))
notify_lvmetad --major "$maj" --minor "$min"
done
+ finish_udev_transaction
}
enable_dev() {
9 years, 11 months
master - tests: skips on unsupported systems
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8db67d2aff7757...
Commit: 8db67d2aff7757d022f7d339451aeb93b0374311
Parent: 092659644a6da359272b852d6be058a5fc26bff4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 21 16:48:06 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 21 16:48:06 2014 +0200
tests: skips on unsupported systems
---
test/shell/profiles-thin.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/shell/profiles-thin.sh b/test/shell/profiles-thin.sh
index 1056528..25c12eb 100644
--- a/test/shell/profiles-thin.sh
+++ b/test/shell/profiles-thin.sh
@@ -17,10 +17,13 @@
DEV_SIZE=32
+# check we have thinp support compiled in
+aux have_thin 1 0 0 || skip
+
aux prepare_profiles "thin-performance"
# Create scsi debug dev with sector size of 4096B and 1MiB optimal_io_size
-aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256
+aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256 || skip
aux prepare_pvs 1 $DEV_SIZE
vgcreate $vg "$dev1"
9 years, 11 months
master - man: missing space between option name and value name
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=092659644a6da3...
Commit: 092659644a6da359272b852d6be058a5fc26bff4
Parent: e78092fa3a4cba95ccc8820fb2b2c617e2b0f618
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed May 21 15:51:28 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed May 21 15:51:28 2014 +0200
man: missing space between option name and value name
---
man/lvchange.8.in | 2 +-
man/lvcreate.8.in | 2 +-
man/lvm.8.in | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index 56a35af..09f54e6 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -125,7 +125,7 @@ and copied to the others, so this can take a considerable amount of
time - and during this time you are without a complete redundant copy
of your data.
.TP
-.B \-\-metadataprofile \fIProfileName
+.B \-\-metadataprofile " " \fIProfileName
Uses and attaches ProfileName configuration profile to the logical
volume metadata. Whenever the logical volume is processed next time,
the profile is automatically applied. If the volume group has another
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index 78cef80..ee50587 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -284,7 +284,7 @@ will create a persistent log that is itself mirrored.
When the legacy "mirror" segment type is used, the optional argument
\fB\-\-corelog\fP is equivalent to \fB\-\-mirrorlog\fP \fIcore\fP.
.TP
-.BR \-\-metadataprofile \fIProfileName
+.BR \-\-metadataprofile " " \fIProfileName
Uses and attaches the ProfileName configuration profile to the logical
volume metadata. Whenever the logical volume is processed next time,
the profile is automatically applied. If the volume group has another
diff --git a/man/lvm.8.in b/man/lvm.8.in
index c753561..9df3cde 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -281,12 +281,12 @@ an allocation request but \fInormal\fP doesn't use them,
\fIanywhere\fP will - even if that reduces performance by
placing two stripes on the same Physical Volume.
.TP
-.IR \fB\-\-commandprofile \fIProfileName
+.IR \fB\-\-commandprofile " " \fIProfileName
Selects the command configuration profile to use when processing an LVM command.
See also \fBlvm.conf\fP(5) for more information about \fBcommand profile config\fP and
the way it fits with other LVM configuration methods.
.TP
-.IR \fB\-\-metadataprofile \fIProfileName
+.IR \fB\-\-metadataprofile " " \fIProfileName
Selects the metadata configuration profile to use when processing an LVM command.
When using metadata profile during Volume Group or Logical Volume creation,
the metadata profile name is saved in metadata. When such Volume Group or Logical
@@ -295,7 +295,7 @@ and the use of \-\-metadataprofile option is not necessary. See also
\fBlvm.conf\fP(5) for more information about \fBmetadata profile config\fP and the
way it fits with other LVM configuration methods.
.TP
-.IR \fB\-\-profile \fIProfileName
+.IR \fB\-\-profile " " \fIProfileName
A short form of \fB\-\-metadataprofile\fP for \fBvgcreate\fP, \fBlvcreate\fP,
\fBvgchange\fP and \fBlvchange\fP command and a short form of \fB\-\-commandprofile\fP
for any other command (with the exception of \fBdumpconfig\fP command where the
9 years, 11 months