Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8c9ab2a4dd827b57…
Commit: 8c9ab2a4dd827b575a7a8b501c5ca3474508f964
Parent: 3f0434057b8b77efd63fe0c502a962bc9dd13223
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Apr 27 10:33:45 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Tue Apr 28 22:31:40 2015 +0200
tests: simplify removal of dangling bg procs
some tests left dangling bg processes originating in
lvm2 commands being able to spawn any bg polling process
(lvchange, vgchange, pvmove, lvconvert...)
Initial fn 'add_to_kill_list' should collect processes with
specific parameters (proc's command line and parent processes ID).
After testing finishes the fn kill_listed_processes should remove these
listed by 'add_to_kill_list'.
Unfortunately it proved to be prone to an error especially in scenarios
where cmd line of initiating command contained characters required to
be espaced before passing to shell script to make it work correctly.
(Or if cmd spawned more than one bg process with same cmd line. i.e.:
vgchange or lvchange).
The new implementation is much simpler. It uses env. variable (LVM_TEST_TAG)
for marking a process desired to be killed later or during test env. teardown.
(i.e.: LVM_TEST_TAG=kill_me_$PREFIX to kill only processes related to
current test environment)
---
test/lib/aux.sh | 26 +++++++++-----------------
test/shell/pvmove-abort-all.sh | 9 +++------
test/shell/pvmove-abort.sh | 6 ++----
test/shell/pvmove-basic.sh | 4 +---
test/shell/pvmove-restart.sh | 3 ++-
5 files changed, 17 insertions(+), 31 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 0e59d6e..24be323 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -233,26 +233,18 @@ kill_sleep_kill_() {
fi
}
-# $1 cmd line
-# $2 optional parms for pgrep
-add_to_kill_list() {
- local p=$(pgrep ${@:2} -f "$1" 2>/dev/null)
- test -z "$p" || echo "$p:$1" >> kill_list
+print_procs_by_tag_() {
+ ps -o pid=,args= ehax 2>/dev/null | grep -weLVM_TEST_TAG=${1:-kill_me_$PREFIX} 2>/dev/null || true
+}
+
+count_processes_with_tag() {
+ print_procs_by_tag_ | wc -l
}
kill_listed_processes() {
- local tmp
- local pid
- local cmd
- test -f kill_list || return 0
- while read tmp; do
- pid=${tmp%%:*}
- cmd=${tmp##*:}
- for tmp in $(pgrep -f "$cmd" -d ' '); do
- test "$tmp" = "$pid" && kill -9 "$tmp"
- done
- done < kill_list
- rm -f kill_list
+ while read pid b; do
+ test -z "$pid" || kill -9 $pid
+ done <<< $(print_procs_by_tag_ $@)
}
teardown() {
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
index de6d8c9..5bca8a2 100644
--- a/test/shell/pvmove-abort-all.sh
+++ b/test/shell/pvmove-abort-all.sh
@@ -50,12 +50,9 @@ if test -z "$backgroundarg" ; then
aux wait_pvmove_lv_ready "$vg1-pvmove0"
lvs -a $vg $vg1
else
- "${cmd1[@]}"
- aux add_to_kill_list "${cmd1[*]}" -P 1
- "${cmd2[@]}"
- aux add_to_kill_list "${cmd2[*]}" -P 1
- "${cmd3[@]}"
- aux add_to_kill_list "${cmd3[*]}" -P 1
+ LVM_TEST_TAG="kill_me_$PREFIX" "${cmd1[@]}"
+ LVM_TEST_TAG="kill_me_$PREFIX" "${cmd2[@]}"
+ LVM_TEST_TAG="kill_me_$PREFIX" "${cmd3[@]}"
fi
# test removal of all pvmove LVs
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
index 3165c6f..2332521 100644
--- a/test/shell/pvmove-abort.sh
+++ b/test/shell/pvmove-abort.sh
@@ -40,10 +40,8 @@ if test -z "$backgroundarg" ; then
"${cmd2[@]}" &
aux wait_pvmove_lv_ready "$vg-pvmove1"
else
- "${cmd1[@]}"
- aux add_to_kill_list "${cmd1[*]}" -P 1
- "${cmd2[@]}"
- aux add_to_kill_list "${cmd2[*]}" -P 1
+ LVM_TEST_TAG="kill_me_$PREFIX" "${cmd1[@]}"
+ LVM_TEST_TAG="kill_me_$PREFIX" "${cmd2[@]}"
fi
# remove specific device
diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh
index d5b7845..f7830da 100644
--- a/test/shell/pvmove-basic.sh
+++ b/test/shell/pvmove-basic.sh
@@ -334,9 +334,7 @@ check_and_cleanup_lvs_
#COMM "pvmove abort"
restore_lvs_
-cmd=(pvmove $mode -i100 -b "$dev1" "$dev3")
-"${cmd[@]}"
-aux add_to_kill_list "${cmd[*]}" -P 1
+LVM_TEST_TAG="kill_me_$PREFIX" pvmove $mode -i100 -b "$dev1" "$dev3"
pvmove --abort
check_and_cleanup_lvs_
diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh
index 88dfebe..b91f624 100644
--- a/test/shell/pvmove-restart.sh
+++ b/test/shell/pvmove-restart.sh
@@ -79,7 +79,7 @@ dmsetup table
# Restart pvmove
# use exclusive activation to have usable pvmove without cmirrord
-vgchange -aey $vg
+LVM_TEST_TAG="kill_me_$PREFIX" vgchange --config 'activation{polling_interval=10}' -aey $vg
aux wait_pvmove_lv_ready "$vg-pvmove0"
dmsetup table
@@ -90,6 +90,7 @@ pvmove --abort
lvs -a -o+devices $vg
lvremove -ff $vg
+aux kill_listed_processes
done
# Restore delayed device back
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3f0434057b8b77ef…
Commit: 3f0434057b8b77efd63fe0c502a962bc9dd13223
Parent: beb229e1e8e8b95de09920195c2bc4171e89dc19
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Apr 28 17:00:37 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Apr 28 17:00:37 2015 +0100
config: Introduce lvmconfig.
'lvm dumpconfig' now does a lot more than just dumping configuration
information and is no longer only a support tool. Users now need
to run it to find out about configuration information that has been
removed from the lvm.conf man page so we need to promote this to full
command line status as 'lvmconfig'. Also accept 'lvm config' and mention
it in the usage information of lvmconf (which should also get merged in
eventually).
---
WHATS_NEW | 1 +
man/Makefile.in | 6 +-
man/clvmd.8.in | 2 +-
man/lvm-config.8.in | 1 +
man/lvm-dumpconfig.8.in | 163 +---------------------------------------------
man/lvm.8.in | 14 +++--
man/lvm.conf.5.in | 22 +++---
man/lvmconfig.8.in | 166 +++++++++++++++++++++++++++++++++++++++++++++++
man/lvmetad.8.in | 2 +-
scripts/lvmconf.sh | 3 +-
tools/Makefile.in | 2 +-
tools/commands.h | 52 ++++++++++++++-
tools/dumpconfig.c | 10 +++
tools/lvmcmdline.c | 4 +-
14 files changed, 261 insertions(+), 187 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ca5ee0f..f0c248c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.119 -
==================================
+ Introduce lvmconfig as the preferred form of 'lvm dumpconfig'.
Add lv_ancestors and lv_descendants reporting fields.
Add --ignorelocal option to dumpconfig to ignore the local section.
Close connection to lvmetad after fork.
diff --git a/man/Makefile.in b/man/Makefile.in
index a2e19fc..b93c5cb 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -42,9 +42,9 @@ endif
MAN5=lvm.conf.5
MAN7=lvmsystemid.7
-MAN8=lvm-dumpconfig.8 \
- lvchange.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 lvm.8 \
- lvmchange.8 lvmconf.8 lvmdiskscan.8 lvmdump.8 lvmsadc.8 lvmsar.8 \
+MAN8=lvm-config.8 lvm-dumpconfig.8 \
+ lvchange.8 lvmconfig.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 \
+ lvm.8 lvmchange.8 lvmconf.8 lvmdiskscan.8 lvmdump.8 lvmsadc.8 lvmsar.8 \
lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \
lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \
pvresize.8 pvs.8 pvscan.8 vgcfgbackup.8 vgcfgrestore.8 vgchange.8 \
diff --git a/man/clvmd.8.in b/man/clvmd.8.in
index 9b2bd4e..2c7330b 100644
--- a/man/clvmd.8.in
+++ b/man/clvmd.8.in
@@ -118,7 +118,7 @@ Display the version of the cluster LVM daemon.
.SH ENVIRONMENT VARIABLES
.TP
.B LVM_CLVMD_BINARY
-The CLVMD binary to use when \fBclmvd\fP restart is requested.
+The CLVMD binary to use when \fBclvmd\fP restart is requested.
Defaults to #CLVMD_PATH#.
.TP
.B LVM_BINARY
diff --git a/man/lvm-config.8.in b/man/lvm-config.8.in
new file mode 100644
index 0000000..3d1bec9
--- /dev/null
+++ b/man/lvm-config.8.in
@@ -0,0 +1 @@
+.so man8/lvm-config.8
diff --git a/man/lvm-dumpconfig.8.in b/man/lvm-dumpconfig.8.in
index b16afb4..5050d77 100644
--- a/man/lvm-dumpconfig.8.in
+++ b/man/lvm-dumpconfig.8.in
@@ -1,162 +1 @@
-.TH "LVM-DUMPCONFIG" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\""
-.SH "NAME"
-lvm-dumpconfig \(em dump LVM configuration
-.SH SYNOPSIS
-.B lvm dumpconfig
-.RB [ \-f | \-\-file
-.IR filename ]
-.RB [ \-\-type
-.RI { current | default | diff | missing | new | profilable | profilable-command | profilable-metadata }
-.RB [ \-\-atversion
-.IR version ]
-.RB [ \-\-ignoreadvanced ]
-.RB [ \-\-ignoreunsupported ]
-.RB [ \-\-ignorelocal ]
-.RB [ \-\-config
-.IR ConfigurationString ]
-.RB [ \-\-commandprofile
-.IR ProfileName ]
-.RB [ \-\-profile
-.IR ProfileName ]
-.RB [ \-\-metadataprofile
-.IR ProfileName ]
-.RB [ \-\-mergedconfig ]
-.RB [ \-\-validate ]
-.RB [ \-\-withcomments ]
-.RB [ \-\-withfullcomments ]
-.RB [ \-\-withversions ]
-.RB [ ConfigurationNode... ]
-
-.SH DESCRIPTION
-lvm dumpconfig produces formatted output with LVM configuration tree.
-
-.SH OPTIONS
-.TP
-.BR \-f ", " \-\-file " \fIfilename"
-Dump configuration to a file named 'filename'.
-
-.TP
-.IR \fB\-\-type " {" current | default | diff | missing | new | profilable }
-Select the type of configuration to dump. The configuration settings dumped
-have either default values or currently used values assigned based on the
-type selected (if no type is selected, \fB\-\-type current\fP is used
-by default). Whenever a configuration setting with a default value is
-commented out, it means the setting does not have any concrete default
-value defined. All output can be saved and reused as proper \fBlvm.conf\fP(5)
-file.
-.RS
-.IP current 3
-Dump current \fBlvm.conf\fP configuration merged with any \fBtag config\fP
-if used. See also \fBlvm.conf\fP(5) for more info about LVM configuration methods.
-.IP default 3
-Dump all possible configuration settings with default values assigned.
-.IP diff 3
-Dump all configuration settings for which the values used differ from defaults.
-The value assigned for each configuration setting is the value currently used.
-This is actually minimal LVM configuration which can be used without
-a change to current configured behaviour.
-.IP missing 3
-Dump all configuration settings with default values assigned which are
-missing in the configuration currently used and for which LVM automatically
-fallbacks to using these default values.
-.IP new 3
-Dump all new configuration settings introduced in current LVM version
-or specific version as defined by \fB\-\-atversion\fP option.
-.IP profilable 3
-Dump all profilable configuration settings with default values assigned.
-See \fBlvm.conf\fP(5) for more info about \fBprofile config\fP method.
-.IP profilable-command 3
-Dump all profilable configuration settings with default values assigned
-that can be used in command profile. This is a subset of settings dumped
-by \fB\-\-type \-\-profilable\fP.
-.IP profilable-metadata 3
-Dump all profilable configuration settings with default values assigned
-that can be used in metadata profile. This is a subset of settings dumped
-by \fB\-\-type \-\-profilable\fP.
-.RE
-
-.TP
-.BI \-\-atversion " version"
-Specify an LVM version in x.y.z format where x is the major version,
-the y is the minor version and z is the patchlevel (e.g. 2.2.106).
-When configuration is dumped, the configuration settings recognized
-at this LVM version will be considered only. This can be used
-to dump a configuration that certain LVM version understands and
-which does not contain any newer settings for which LVM would
-issue a warning message when checking the configuration.
-
-.TP
-.B \-\-ignoreadvanced
-Ignore advanced configuration settings on dump.
-
-.TP
-.B \-\-ignoreunsupported
-Ignore unsupported configuration settings on dump. These settings are
-either used for debugging purposes only or their support is not yet
-complete and they are not meant to be used in production.
-
-.TP
-.B \-\-ignorelocal
-Ignore local section.
-
-.TP
-.BI \-\-config " ConfigurationString"
-Use \fBConfigurationString\fP to override existing configuration.
-This configuration is then applied for dumpconfig command itself.
-See also \fBlvm.conf\fP(5) for more info about \fBconfig cascade\fP.
-
-.TP
-.BI \-\-commandprofile " ProfileName"
-Use \fBProfileName\fP to override existing configuration.
-This configuration is then applied for dumpconfig command itself.
-See also \fB\-\-mergedconfig\fP option and \fBlvm.conf\fP(5) for
-more info about \fBconfig cascade\fP.
-
-.TP
-.BI \-\-profile " ProfileName"
-The same as using \fB\-\-commandprofile\fP but the configuration is not
-applied for dumpconfig command itself.
-
-.TP
-.BI \-\-metadataprofile " ProfileName"
-Use \fBProfileName\fP to override existing configuration.
-The configuration defined in metadata profile has no effect for
-dumpconfig command itself, the dumpconfig dumps the configuration only.
-See also \fB\-\-mergedconfig\fP option and \fBlvm.conf\fP(5) for more
-info about \fBconfig cascade\fP.
-
-.TP
-.B \-\-mergedconfig
-When the dumpconfig command is run with the \fB\-\-config\fP option
-and/or \fB\-\-commandprofile\fP (or using \fBLVM_COMMAND_PROFILE\fP
-environment variable), \fB\-\-profile\fP, \fB\-\-metadataprofile\fP
-option, merge all the contents of the \fBconfig cascade\fP before dumping it.
-Without the \fB\-\-mergeconfig\fP option used, only the configuration at
-the front of the cascade is dumped. See also \fBlvm.conf\fP(5) for more
-info about \fBconfig cascade\fP.
-
-.TP
-.B \-\-validate
-Validate current configuration used and exit with appropriate
-return code. The validation is done only for the configuration
-at the front of the \fBconfig cascade\fP. To validate the whole
-merged configuration tree, use also the \fB\-\-mergedconfig\fP option.
-The validation is done even if \fBconfig/checks\fP \fBlvm.conf\fP(5)
-option is disabled.
-
-.TP
-.B \-\-withcomments
-Dump a one line comment for each configuration node.
-
-.TP
-.B \-\-withfullcomments
-Dump a full comment for each configuration node.
-
-.TP
-.B \-\-withversions
-Also dump a comment containing the version of introduction for
-each configuration node.
-
-.SH SEE ALSO
-.BR lvm (8)
-.BR lvm.conf (5)
+.so man8/lvmconfig.8
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 26d94ee..3d408fb 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -43,11 +43,12 @@ path of \fBlvm\fP.
The following commands are built into lvm without links normally
being created in the filesystem for them.
.TP
-\fBdumpconfig\fP \(em Display the configuration information after
-loading \fBlvm.conf\fP(5) and any other configuration files.
+\fBconfig\fP \(em The same as \fBlvmconfig\fP(8) below.
.TP
\fBdevtypes\fP \(em Display the recognised built-in block device types.
.TP
+\fBdumpconfig\fP \(em The same as \fBlvmconfig\fP(8) below.
+.TP
\fBformats\fP \(em Display recognised metadata formats.
.TP
\fBhelp\fP \(em Display the help text.
@@ -136,6 +137,9 @@ Volumes.
.TP
\fBlvmchange\fP \(em Change attributes of the Logical Volume Manager.
.TP
+\fBlvmconfig\fP \(em Display the configuration information after
+loading \fBlvm.conf\fP(5) and any other configuration files.
+.TP
\fBlvmdiskscan\fP \(em Scan for all devices visible to LVM2.
.TP
\fBlvmdump\fP \(em Create lvm2 information dumps for diagnostic purposes.
@@ -316,8 +320,8 @@ way it fits with other LVM configuration methods.
.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
-\-\-profile has special meaning, see \fBlvm dumpconfig\fP(8) for more information).
+for any other command (with the exception of \fBlvmconfig\fP command where the
+\-\-profile has special meaning, see \fBlvm lvmconfig\fP(8) for more information).
.TP
.IR \fB\-\-config " " \fIConfigurationString
Uses the ConfigurationString as direct string representation of the configuration
@@ -529,7 +533,6 @@ Path for the lvmetad socket file.
.BR lvm.conf (5),
.BR lvmcache (7),
.BR lvmthin (7),
-.BR lvm\ dumpconfig (8),
.BR clvmd (8),
.BR dmsetup (8),
.BR lvchange (8),
@@ -537,6 +540,7 @@ Path for the lvmetad socket file.
.BR lvdisplay (8),
.BR lvextend (8),
.BR lvmchange (8),
+.BR lvmconfig (8),
.BR lvmdiskscan (8),
.BR lvreduce (8),
.BR lvremove (8),
diff --git a/man/lvm.conf.5.in b/man/lvm.conf.5.in
index 074e2e9..2c4effc 100644
--- a/man/lvm.conf.5.in
+++ b/man/lvm.conf.5.in
@@ -65,8 +65,8 @@ For this purpose, there's the \fBcommand_profile_template.profile\fP
(for metadata profiles) which contain all settings that are customizable
by profiles of certain type. Users are encouraged to copy these template
profiles and edit them as needed. Alternatively, the
-\fBlvm dumpconfig \-\-file <ProfileName.profile> \-\-type profilable-command <section>\fP
-or \fBlvm dumpconfig \-\-file <ProfileName.profile> \-\-type profilable-metadata <section>\fP
+\fBlvm lvmconfig \-\-file <ProfileName.profile> \-\-type profilable-command <section>\fP
+or \fBlvm lvmconfig \-\-file <ProfileName.profile> \-\-type profilable-metadata <section>\fP
can be used to generate a configuration with profilable settings in either
of the type for given section and save it to new ProfileName.profile
(if the section is not specified, all profilable settings are reported).
@@ -91,7 +91,7 @@ this \fBconfig cascade\fP from left to right:
No part of this cascade is compulsory. If there's no setting value found at
the end of the cascade, a default value is used for that setting.
-Use \fBlvm dumpconfig\fP to check what settings are in use and what
+Use \fBlvmconfig\fP to check what settings are in use and what
the default values are.
.SH SYNTAX
.LP
@@ -158,38 +158,38 @@ with a letter can be left unquoted.
.SH SETTINGS
The
-.B lvm dumpconfig
+.B lvmconfig
command prints the LVM configuration settings in various ways.
See the man page
-.BR lvm-dumpconfig (8).
+.BR lvmconfig (8).
Command to print a list of all possible config settings, with their
default values:
.br
-.B lvm dumpconfig \-\-type default
+.B lvmconfig \-\-type default
Command to print a list of all possible config settings, with their
default values, and a full description of each as a comment:
.br
-.B lvm dumpconfig \-\-type default --withfullcomments
+.B lvmconfig \-\-type default --withfullcomments
Command to print a list of all possible config settings, with their
current values (configured, non-default values are shown):
.br
-.B lvm dumpconfig \-\-type current
+.B lvmconfig \-\-type current
Command to print all config settings that have been configured with a
different value than the default (configured, non-default values are
shown):
.br
-.B lvm dumpconfig \-\-type diff
+.B lvmconfig \-\-type diff
Command to print a single config setting, with its default value,
and a full description, where "Section" refers to the config section,
e.g. global, and "Setting" refers to the name of the specific setting,
e.g. umask:
.br
-.B lvm dumpconfig \-\-type default --withfullcomments Section/Setting
+.B lvmconfig \-\-type default --withfullcomments Section/Setting
.SH FILES
@@ -209,5 +209,5 @@ e.g. umask:
.SH SEE ALSO
.BR lvm (8)
-.BR lvm-dumpconfig (8)
+.BR lvmconfig (8)
diff --git a/man/lvmconfig.8.in b/man/lvmconfig.8.in
new file mode 100644
index 0000000..76f8ffe
--- /dev/null
+++ b/man/lvmconfig.8.in
@@ -0,0 +1,166 @@
+.TH "LVMCONFIG" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\""
+.SH "NAME"
+lvmconfig, lvm dumpconfig, lvm config \(em Display LVM configuration
+.SH SYNOPSIS
+.B lvmconfig
+.RB [ \-f | \-\-file
+.IR filename ]
+.RB [ \-\-type
+.RI { current | default | diff | missing | new | profilable | profilable-command | profilable-metadata }
+.RB [ \-\-atversion
+.IR version ]
+.RB [ \-\-ignoreadvanced ]
+.RB [ \-\-ignoreunsupported ]
+.RB [ \-\-ignorelocal ]
+.RB [ \-\-config
+.IR ConfigurationString ]
+.RB [ \-\-commandprofile
+.IR ProfileName ]
+.RB [ \-\-profile
+.IR ProfileName ]
+.RB [ \-\-metadataprofile
+.IR ProfileName ]
+.RB [ \-\-mergedconfig ]
+.RB [ \-\-validate ]
+.RB [ \-\-withcomments ]
+.RB [ \-\-withfullcomments ]
+.RB [ \-\-withversions ]
+.RB [ ConfigurationNode... ]
+
+.SH DESCRIPTION
+lvmconfig produces formatted output from the LVM configuration tree.
+The command was added in release 2.02.119 and has an identical longer form
+\fBlvm dumpconfig\fP.
+
+.SH OPTIONS
+.TP
+.BR \-f ", " \-\-file " \fIfilename"
+Send output to a file named 'filename'.
+
+.TP
+.IR \fB\-\-type " {" current | default | diff | missing | new | profilable }
+Select the type of configuration to display. The configuration settings
+displayed have either default values or currently-used values assigned based on
+the type selected. If no type is selected, \fB\-\-type current\fP is used
+by default. Whenever a configuration setting with a default value is
+commented out, it means the setting does not have any concrete default
+value defined. Output can be saved and used as a proper \fBlvm.conf\fP(5)
+file.
+.RS
+.IP current 3
+Display the current \fBlvm.conf\fP configuration merged with any \fBtag
+config\fP if used. See also \fBlvm.conf\fP(5) for more info about LVM
+configuration methods.
+.IP default 3
+Display all possible configuration settings with default values assigned.
+.IP diff 3
+Display all configuration settings for which the values used differ from defaults.
+The value assigned for each configuration setting is the value currently used.
+This is actually minimal LVM configuration which can be used without
+a change to current configured behaviour.
+.IP missing 3
+Display all configuration settings with default values assigned which are
+missing in the configuration currently used and for which LVM automatically
+fallbacks to using these default values.
+.IP new 3
+Display all new configuration settings introduced in current LVM version
+or specific version as defined by \fB\-\-atversion\fP option.
+.IP profilable 3
+Display all profilable configuration settings with default values assigned.
+See \fBlvm.conf\fP(5) for more info about \fBprofile config\fP method.
+.IP profilable-command 3
+Display all profilable configuration settings with default values assigned
+that can be used in command profile. This is a subset of settings displayed
+by \fB\-\-type \-\-profilable\fP.
+.IP profilable-metadata 3
+Display all profilable configuration settings with default values assigned
+that can be used in metadata profile. This is a subset of settings displayed
+by \fB\-\-type \-\-profilable\fP.
+.RE
+
+.TP
+.BI \-\-atversion " version"
+Specify an LVM version in x.y.z format where x is the major version,
+the y is the minor version and z is the patchlevel (e.g. 2.2.106).
+When configuration is displayed, the configuration settings recognized
+at this LVM version will be considered only. This can be used
+to display a configuration that a certain LVM version understands and
+which does not contain any newer settings for which LVM would
+issue a warning message when checking the configuration.
+
+.TP
+.B \-\-ignoreadvanced
+Exclude advanced configuration settings from the output.
+
+.TP
+.B \-\-ignoreunsupported
+Exclude unsupported configuration settings from the output. These settings are
+either used for debugging purposes only or their support is not yet
+complete and they are not meant to be used in production.
+
+.TP
+.B \-\-ignorelocal
+Ignore local section.
+
+.TP
+.BI \-\-config " ConfigurationString"
+Use \fBConfigurationString\fP to override existing configuration.
+This configuration is then applied for the lvmconfig command itself.
+See also \fBlvm.conf\fP(5) for more info about \fBconfig cascade\fP.
+
+.TP
+.BI \-\-commandprofile " ProfileName"
+Use \fBProfileName\fP to override existing configuration.
+This configuration is then applied for the lvmconfig command itself.
+See also \fB\-\-mergedconfig\fP option and \fBlvm.conf\fP(5) for
+more info about \fBconfig cascade\fP.
+
+.TP
+.BI \-\-profile " ProfileName"
+The same as using \fB\-\-commandprofile\fP but the configuration is not
+applied for the lvmconfig command itself.
+
+.TP
+.BI \-\-metadataprofile " ProfileName"
+Use \fBProfileName\fP to override existing configuration.
+The configuration defined in metadata profile has no effect for
+the lvmconfig command itself. lvmconfig displays the configuration only.
+See also \fB\-\-mergedconfig\fP option and \fBlvm.conf\fP(5) for more
+info about \fBconfig cascade\fP.
+
+.TP
+.B \-\-mergedconfig
+When the lvmconfig command is run with the \fB\-\-config\fP option
+and/or \fB\-\-commandprofile\fP (or using \fBLVM_COMMAND_PROFILE\fP
+environment variable), \fB\-\-profile\fP, \fB\-\-metadataprofile\fP
+option, merge all the contents of the \fBconfig cascade\fP before displaying it.
+Without the \fB\-\-mergeconfig\fP option used, only the configuration at
+the front of the cascade is displayed. See also \fBlvm.conf\fP(5) for more
+info about \fBconfig cascade\fP.
+
+.TP
+.B \-\-validate
+Validate current configuration used and exit with appropriate
+return code. The validation is done only for the configuration
+at the front of the \fBconfig cascade\fP. To validate the whole
+merged configuration tree, use also the \fB\-\-mergedconfig\fP option.
+The validation is done even if \fBconfig/checks\fP \fBlvm.conf\fP(5)
+option is disabled.
+
+.TP
+.B \-\-withcomments
+Display a one line comment for each configuration node.
+
+.TP
+.B \-\-withfullcomments
+Display a full comment for each configuration node.
+
+.TP
+.B \-\-withversions
+Also display a comment containing the version of introduction for
+each configuration node.
+
+.SH SEE ALSO
+.BR lvm (8)
+.BR lvmconf (8)
+.BR lvm.conf (5)
diff --git a/man/lvmetad.8.in b/man/lvmetad.8.in
index 4f60249..3ea80c9 100644
--- a/man/lvmetad.8.in
+++ b/man/lvmetad.8.in
@@ -22,7 +22,7 @@ consistent image of the volume groups available in the system.
lvmetad is used by LVM only if it is enabled in \fBlvm.conf\fP(5) by specifying the
\fBglobal/use_lvmetad\fP setting. If this is not defined in the LVM configuration
explicitly then default setting is used instead (see the output of
-\fBlvm dumpconfig \-\-type default global/use_lvmetad\fP command).
+\fBlvmconfig \-\-type default global/use_lvmetad\fP command).
.SH OPTIONS
To run the daemon in a test environment both the pidfile_path and the
diff --git a/scripts/lvmconf.sh b/scripts/lvmconf.sh
index 6c2a167..396f7a1 100644
--- a/scripts/lvmconf.sh
+++ b/scripts/lvmconf.sh
@@ -33,7 +33,7 @@ START_STOP_SERVICES=0
function usage
{
- echo "usage: $0 <command>"
+ echo "Usage: $0 <command>"
echo ""
echo "Commands:"
echo "Enable clvm: --enable-cluster [--lockinglibdir <dir>] [--lockinglib <lib>]"
@@ -46,6 +46,7 @@ function usage
echo "Config file location: --file <configfile>"
echo "Set services: --services [--mirrorservice] [--startstopservices]"
echo ""
+ echo "Use the separate command 'lvmconfig' to display configuration information"
}
function set_default_use_lvmetad_var
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 1d294dd..861ae82 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -168,7 +168,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
.commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile
$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
- egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|systemid|tags|version) *$$' > .commands
+ egrep -v '^ *(|#.*|config|devtypes|dumpconfig|formats|help|pvdata|segtypes|systemid|tags|version) *$$' > .commands
ifneq ("$(CFLOW_CMD)", "")
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
diff --git a/tools/commands.h b/tools/commands.h
index 64c8bf2..df69c2a 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -28,6 +28,31 @@ xx(e2fsadm,
extents_ARG, size_ARG, nofsck_ARG, test_ARG)
*********/
+xx(config,
+ "Display and manipulate configuration information",
+ PERMITTED_READ_ONLY,
+ "config\n"
+ "\t[-f|--file filename]\n"
+ "\t[--type {current|default|diff|missing|new|profilable|profilable-command|profilable-metadata}\n"
+ "\t[--atversion version]]\n"
+ "\t[--ignoreadvanced]\n"
+ "\t[--ignoreunsupported]\n"
+ "\t[--ignorelocal]\n"
+ "\t[--config ConfigurationString]\n"
+ "\t[--commandprofile ProfileName]\n"
+ "\t[--profile ProfileName]\n"
+ "\t[--metadataprofile ProfileName]\n"
+ "\t[--mergedconfig]\n"
+ "\t[--validate]\n"
+ "\t[--withcomments]\n"
+ "\t[--withfullcomments]\n"
+ "\t[--unconfigured]\n"
+ "\t[--withversions]\n"
+ "\t[ConfigurationNode...]\n",
+ atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
+ ignoreunsupported_ARG, ignorelocal_ARG, mergedconfig_ARG, metadataprofile_ARG,
+ validate_ARG, withcomments_ARG, withfullcomments_ARG, unconfigured_ARG, withversions_ARG)
+
xx(devtypes,
"Display recognised built-in block device types",
PERMITTED_READ_ONLY,
@@ -55,7 +80,7 @@ xx(devtypes,
unbuffered_ARG, unquoted_ARG)
xx(dumpconfig,
- "Dump configuration",
+ "Display and manipulate configuration information",
PERMITTED_READ_ONLY,
"dumpconfig\n"
"\t[-f|--file filename]\n"
@@ -454,6 +479,31 @@ xx(lvmchange,
reset_ARG)
+xx(lvmconfig,
+ "Display and manipulate configuration information",
+ PERMITTED_READ_ONLY,
+ "lvmconfig\n"
+ "\t[-f|--file filename]\n"
+ "\t[--type {current|default|diff|missing|new|profilable|profilable-command|profilable-metadata}\n"
+ "\t[--atversion version]]\n"
+ "\t[--ignoreadvanced]\n"
+ "\t[--ignoreunsupported]\n"
+ "\t[--ignorelocal]\n"
+ "\t[--config ConfigurationString]\n"
+ "\t[--commandprofile ProfileName]\n"
+ "\t[--profile ProfileName]\n"
+ "\t[--metadataprofile ProfileName]\n"
+ "\t[--mergedconfig]\n"
+ "\t[--validate]\n"
+ "\t[--withcomments]\n"
+ "\t[--withfullcomments]\n"
+ "\t[--unconfigured]\n"
+ "\t[--withversions]\n"
+ "\t[ConfigurationNode...]\n",
+ atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
+ ignoreunsupported_ARG, ignorelocal_ARG, mergedconfig_ARG, metadataprofile_ARG,
+ validate_ARG, withcomments_ARG, withfullcomments_ARG, unconfigured_ARG, withversions_ARG)
+
xx(lvmdiskscan,
"List devices that may be used as physical volumes",
PERMITTED_READ_ONLY | ENABLE_ALL_DEVS,
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index d1b4acc..341bffa 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -257,3 +257,13 @@ out:
return r;
}
+
+int config(struct cmd_context *cmd, int argc, char **argv)
+{
+ return dumpconfig(cmd, argc, argv);
+}
+
+int lvmconfig(struct cmd_context *cmd, int argc, char **argv)
+{
+ return dumpconfig(cmd, argc, argv);
+}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 26c48f9..78974df 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1286,7 +1286,9 @@ static int _prepare_profiles(struct cmd_context *cmd)
* If --profile is used with dumpconfig, it's used
* to dump the profile without the profile being applied.
*/
- if (!strcmp(cmd->command->name, "dumpconfig"))
+ if (!strcmp(cmd->command->name, "dumpconfig") ||
+ !strcmp(cmd->command->name, "lvmconfig") ||
+ !strcmp(cmd->command->name, "config"))
return 1;
/*
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=beb229e1e8e8b95d…
Commit: beb229e1e8e8b95de09920195c2bc4171e89dc19
Parent: 6cc37275cebdc590f58bbd4e91110fe4d38801ce
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 24 14:58:58 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 28 10:41:32 2015 -0500
devices: improve handling of duplicate PVs
Example:
/dev/loop0 and /dev/loop1 are duplicates,
created by copying one backing file to the
other.
'identity /dev/loopX' creates an identity
mapping for loopX named idmloopX, which
adds a duplicate for the named device.
The duplicate selection code for lvmetad is
incomplete, and lvmetad is disabled for this
example.
[~]# losetup -f loopfile0
[~]# pvs
PV VG Fmt Attr PSize PFree
/dev/loop0 foo lvm2 a-- 308.00m 296.00m
[~]# losetup -f loopfile1
[~]# pvs
Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/loop1 not /dev/loop0
Using duplicate PV /dev/loop1 which is more recent, replacing /dev/loop0
PV VG Fmt Attr PSize PFree
/dev/loop1 foo lvm2 a-- 308.00m 308.00m
[~]# ./identity /dev/loop0
[~]# pvs
Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/loop1 not /dev/loop0
Using duplicate PV /dev/loop1 without holders, replacing /dev/loop0
Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/mapper/idmloop0 not /dev/loop1
Using duplicate PV /dev/mapper/idmloop0 from subsystem DM, replacing /dev/loop1
PV VG Fmt Attr PSize PFree
/dev/mapper/idmloop0 foo lvm2 a-- 308.00m 296.00m
[~]# ./identity /dev/loop1
[~]# pvs
WARNING: duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV is being used from both devices /dev/loop0 and /dev/loop1
Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/loop1 not /dev/loop0
Using duplicate PV /dev/loop1 which is more recent, replacing /dev/loop0
Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/mapper/idmloop0 not /dev/loop1
Using duplicate PV /dev/mapper/idmloop0 from subsystem DM, replacing /dev/loop1
Found duplicate PV LnSOEqzEYED3RvIOa5PZP2s7uyuBLmAV: using /dev/mapper/idmloop1 not /dev/mapper/idmloop0
Using duplicate PV /dev/mapper/idmloop1 which is more recent, replacing /dev/mapper/idmloop0
PV VG Fmt Attr PSize PFree
/dev/mapper/idmloop1 foo lvm2 a-- 308.00m 308.00m
---
lib/cache/lvmcache.c | 248 ++++++++++++++++++++++++++++++++++++++++---------
lib/cache/lvmetad.c | 17 +++-
lib/device/dev-type.c | 3 +
3 files changed, 220 insertions(+), 48 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index c5f78c8..90e7b28 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1529,6 +1529,64 @@ void lvmcache_replace_dev(struct cmd_context *cmd, struct physical_volume *pv,
pv->dev = dev;
}
+/*
+ * We can see multiple different devices with the
+ * same pvid, i.e. duplicates.
+ *
+ * There may be different reasons for seeing two
+ * devices with the same pvid:
+ * - multipath showing two paths to the same thing
+ * - one device copied to another, e.g. with dd,
+ * also referred to as cloned devices.
+ * - a "subsystem" taking a device and creating
+ * another device of its own that represents the
+ * underlying device it is using, e.g. using dm
+ * to create an identity mapping of a PV.
+ *
+ * Given duplicate devices, we have to choose one
+ * of them to be the "preferred" dev, i.e. the one
+ * that will be referenced in lvmcache, by pv->dev.
+ * We can keep the existing dev, that's currently
+ * used in lvmcache, or we can replace the existing
+ * dev with the new duplicate.
+ *
+ * Regardless of which device is preferred, we need
+ * to print messages explaining which devices were
+ * found so that a user can sort out for themselves
+ * what has happened if the preferred device is not
+ * the one they are interested in.
+ *
+ * If a user wants to use the non-preferred device,
+ * they will need to filter out the device that
+ * lvm is preferring.
+ *
+ * The dev_subsystem calls check if the major number
+ * of the dev is part of a subsystem like DM/MD/DRBD.
+ * A dev that's part of a subsystem is preferred over a
+ * duplicate of that dev that is not part of a
+ * subsystem.
+ *
+ * The has_holders calls check if the device is being
+ * used by another, and prefers one that's being used.
+ *
+ * FIXME: why do we prefer a device without holders
+ * over a device with holders? We should understand
+ * the reason for that choice.
+ *
+ * FIXME: there may be other reasons to prefer one
+ * device over another:
+ *
+ * . are there other use/open counts we could check
+ * beyond the holders?
+ *
+ * . check if either is bad/usable and prefer
+ * the good one?
+ *
+ * . prefer the one with smaller minor number?
+ * Might avoid disturbing things due to a new
+ * transient duplicate?
+ */
+
struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
struct device *dev,
const char *vgname, const char *vgid,
@@ -1576,54 +1634,156 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
lvmcache_del_bas(info);
} else {
if (existing->dev != dev) {
- /* Is the existing entry a duplicate pvid e.g. md ? */
- if (dev_subsystem_part_major(dt, existing->dev) &&
- !dev_subsystem_part_major(dt, dev)) {
- log_very_verbose("Ignoring duplicate PV %s on "
- "%s - using %s %s",
- pvid, dev_name(dev),
- dev_subsystem_name(dt, existing->dev),
- dev_name(existing->dev));
- return NULL;
- } else if (dm_is_dm_major(MAJOR(existing->dev->dev)) &&
- !dm_is_dm_major(MAJOR(dev->dev))) {
- log_very_verbose("Ignoring duplicate PV %s on "
- "%s - using dm %s",
- pvid, dev_name(dev),
- dev_name(existing->dev));
+ int old_in_subsystem = 0;
+ int new_in_subsystem = 0;
+ int old_is_dm = 0;
+ int new_is_dm = 0;
+ int old_has_holders = 0;
+ int new_has_holders = 0;
+
+ /*
+ * Here are different devices with the same pvid:
+ * duplicates. See comment above.
+ */
+
+ /*
+ * This flag tells the process_each_pv code to search
+ * the devices list for duplicates, so that devices
+ * can be processed together with their duplicates
+ * (while processing the VG, rather than reporting
+ * pv->dev under the VG, and its duplicate outside
+ * the VG context.)
+ */
+ _found_duplicate_pvs = 1;
+
+ /*
+ * The new dev may not have pvid set.
+ * The process_each_pv code needs to have the pvid
+ * set in each device to detect that the devices
+ * are duplicates.
+ */
+ strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
+
+ /*
+ * Now decide if we are going to ignore the new
+ * device, or replace the existing/old device in
+ * lvmcache with the new one.
+ */
+ old_in_subsystem = dev_subsystem_part_major(dt, existing->dev);
+ new_in_subsystem = dev_subsystem_part_major(dt, dev);
+
+ old_is_dm = dm_is_dm_major(MAJOR(existing->dev->dev));
+ new_is_dm = dm_is_dm_major(MAJOR(dev->dev));
+
+ old_has_holders = dm_device_has_holders(MAJOR(existing->dev->dev), MINOR(existing->dev->dev));
+ new_has_holders = dm_device_has_holders(MAJOR(dev->dev), MINOR(dev->dev));
+
+ if (old_has_holders && new_has_holders) {
+ /*
+ * This is not a selection of old or new, but
+ * just a warning to be aware of.
+ */
+ log_warn("WARNING: duplicate PV %s is being used from both devices %s and %s",
+ pvid_s,
+ dev_name(existing->dev),
+ dev_name(dev));
+ }
+
+ if (old_in_subsystem && !new_in_subsystem) {
+ /* Use old, ignore new. */
+ log_warn("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(existing->dev),
+ dev_name(dev));
+ log_warn("Using duplicate PV %s from subsystem %s, ignoring %s",
+ dev_name(existing->dev),
+ dev_subsystem_name(dt, existing->dev),
+ dev_name(dev));
return NULL;
- } else if (!dev_subsystem_part_major(dt, existing->dev) &&
- dev_subsystem_part_major(dt, dev))
- log_very_verbose("Duplicate PV %s on %s - "
- "using %s %s", pvid,
- dev_name(existing->dev),
- dev_subsystem_name(dt, existing->dev),
- dev_name(dev));
- else if (!dm_is_dm_major(MAJOR(existing->dev->dev)) &&
- dm_is_dm_major(MAJOR(dev->dev)))
- log_very_verbose("Duplicate PV %s on %s - "
- "using dm %s", pvid,
- dev_name(existing->dev),
- dev_name(dev));
- /* FIXME If both dm, check dependencies */
- //else if (dm_is_dm_major(MAJOR(existing->dev->dev)) &&
- //dm_is_dm_major(MAJOR(dev->dev)))
- //
- else if (!strcmp(pvid_s, existing->dev->pvid)) {
- log_error("Found duplicate PV %s: using %s not %s",
- pvid_s,
- dev_name(existing->dev),
- dev_name(dev));
- strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
- _found_duplicate_pvs = 1;
+
+ } else if (!old_in_subsystem && new_in_subsystem) {
+ /* Use new, replace old. */
+ log_warn("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(dev),
+ dev_name(existing->dev));
+ log_warn("Using duplicate PV %s from subsystem %s, replacing %s",
+ dev_name(dev),
+ dev_subsystem_name(dt, dev),
+ dev_name(existing->dev));
+
+ } else if (old_has_holders && !new_has_holders) {
+ /* Use new, replace old. */
+ /* FIXME: why choose the one without olders? */
+ log_warn("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(dev),
+ dev_name(existing->dev));
+ log_warn("Using duplicate PV %s without holders, replacing %s",
+ dev_name(dev),
+ dev_name(existing->dev));
+
+ } else if (!old_has_holders && new_has_holders) {
+ /* Use old, ignore new. */
+ log_warn("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(existing->dev),
+ dev_name(dev));
+ log_warn("Using duplicate PV %s without holders, ignoring %s",
+ dev_name(existing->dev),
+ dev_name(dev));
return NULL;
+
+ } else if (old_is_dm && new_is_dm) {
+ /* Use new, replace old. */
+ /* FIXME: why choose the new instead of the old? */
+ log_warn("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(dev),
+ dev_name(existing->dev));
+ log_warn("Using duplicate PV %s which is more recent, replacing %s",
+ dev_name(dev),
+ dev_name(existing->dev));
+
+ } else if (!strcmp(pvid_s, existing->dev->pvid)) {
+ /* No criteria to use for preferring old or new. */
+ /* FIXME: why choose the new instead of the old? */
+ /* FIXME: a transient duplicate would be a reason
+ * to select the old instead of the new. */
+ log_warn("Found duplicate PV %s: using %s not %s",
+ pvid_s,
+ dev_name(dev),
+ dev_name(existing->dev));
+ log_warn("Using duplicate PV %s which is more recent, replacing %s",
+ dev_name(dev),
+ dev_name(existing->dev));
}
+ } else {
+ /*
+ * The new dev is the same as the existing dev.
+ *
+ * FIXME: Why can't we just return NULL here if the
+ * device already exists? Things don't seem to work
+ * if we do that for some reason.
+ */
+ log_verbose("Found same device %s with same pvid %s",
+ dev_name(existing->dev), pvid_s);
}
- if (strcmp(pvid_s, existing->dev->pvid))
- log_debug_cache("Updating pvid cache to %s (%s) from %s (%s)",
- pvid_s, dev_name(dev),
- existing->dev->pvid, dev_name(existing->dev));
- /* Switch over to new preferred device */
+
+ /*
+ * FIXME: when could this ever happen?
+ * If this does happen, identify when/why here, and
+ * if not, remove this code.
+ */
+ if (strcmp(pvid_s, existing->dev->pvid)) {
+ log_warn("Replacing dev %s pvid %s with dev %s pvid %s",
+ dev_name(existing->dev), existing->dev->pvid,
+ dev_name(dev), pvid_s);
+ }
+
+ /*
+ * Switch over to new preferred device.
+ */
existing->dev = dev;
info = existing;
/* Has labeller changed? */
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 600a6cb..470a7b3 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -366,10 +366,19 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
while (alt_device) {
dev_alternate = dev_cache_get_by_devt(alt_device->v.i, cmd->filter);
- if (dev_alternate)
- lvmcache_add(fmt->labeller, (const char *)&pvid, dev_alternate,
- vgname, (const char *)&vgid, 0);
- else
+ if (dev_alternate) {
+ if ((info = lvmcache_add(fmt->labeller, (const char *)&pvid, dev_alternate,
+ vgname, (const char *)&vgid, 0))) {
+ /*
+ * FIXME: when lvmcache_add returns non-NULL,
+ * it means that it has made dev_alternate
+ * the preferred device in lvmcache.
+ * I think that means it should be followed
+ * by the same steps done above?
+ */
+ log_warn("lvmcache only partially updated for alternate device %s", dev_name(dev));
+ }
+ } else
log_warn("Duplicate of PV %s dev %s exists on unknown device %"PRId64 ":%" PRId64,
pvid_txt, dev_name(dev), MAJOR(alt_device->v.i), MINOR(alt_device->v.i));
alt_device = alt_device->next;
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index d3407d1..5a4c658 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -225,6 +225,9 @@ int dev_subsystem_part_major(struct dev_types *dt, struct device *dev)
const char *dev_subsystem_name(struct dev_types *dt, struct device *dev)
{
+ if (MAJOR(dev->dev) == dt->device_mapper_major)
+ return "DM";
+
if (MAJOR(dev->dev) == dt->md_major)
return "MD";
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6cc37275cebdc590…
Commit: 6cc37275cebdc590f58bbd4e91110fe4d38801ce
Parent: ae0014e2dfd84b2348c7c8dd57f83159c79fda85
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 28 10:06:23 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 28 10:06:23 2015 -0500
config: improve the description of options lists
Describe
thin_check_options, thin_repair_options,
cache_check_option, scache_repair_options
as a "list of options", rather than a "string of options"
because a single string, e.g. "-q --clear-needs-check-flag"
does not work, and needs to be entered as a list,
e.g. ["-q", "--clear-needs-check-flag"]
---
lib/config/config_settings.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 76b040b..e97ada5 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -813,7 +813,7 @@ cfg(global_thin_repair_executable_CFG, "thin_repair_executable", global_CFG_SECT
"(For thin tools, see thin_check_executable.)\n")
cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_CHECK_OPTION1 "#S" DEFAULT_THIN_CHECK_OPTION2, vsn(2, 2, 96), NULL,
- "String of options passed to the thin_check command.\n"
+ "List of options passed to the thin_check command.\n"
"With thin_check version 2.1 or newer you can add\n"
"--ignore-non-fatal-errors to let it pass through\n"
"ignorable errors and fix them later.\n"
@@ -821,7 +821,7 @@ cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTIO
"--clear-needs-check-flag.\n")
cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, "#S" DEFAULT_THIN_REPAIR_OPTIONS, vsn(2, 2, 100), NULL,
- "String of options passed to the thin_repair command.\n")
+ "List of options passed to the thin_repair command.\n")
cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL,
"Features to not use in the thin driver.\n"
@@ -858,10 +858,10 @@ cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SE
"(For cache tools, see cache_check_executable.)\n")
cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_CHECK_OPTION1, vsn(2, 2, 108), NULL,
- "String of options passed to the cache_check command.\n")
+ "List of options passed to the cache_check command.\n")
cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_REPAIR_OPTIONS, vsn(2, 2, 108), NULL,
- "String of options passed to the cache_repair command.\n")
+ "List of options passed to the cache_repair command.\n")
cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SYSTEM_ID_SOURCE, vsn(2, 2, 117), NULL,
"The method LVM uses to set the local system ID.\n"