diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-04-14 19:42:51 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-04-14 20:34:20 +0200 |
commit | 1bb133b505d5aade0cc0b6c6e16f1bc3e9a266f7 (patch) | |
tree | 700c90e8040f13442d27a520cb167f01f0a70aab /sys-fs/lvm2/files | |
parent | sys-fs/lvm2: runscript: output msg when we are loading module (diff) | |
download | gentoo-1bb133b505d5aade0cc0b6c6e16f1bc3e9a266f7.tar.gz gentoo-1bb133b505d5aade0cc0b6c6e16f1bc3e9a266f7.tar.bz2 gentoo-1bb133b505d5aade0cc0b6c6e16f1bc3e9a266f7.zip |
sys-fs/lvm2: runscript: rework start()
- Don't use LVM script anymore: If one command within script failed,
any following command won't run anymore.
- Be verbose when rc_verbose=yes is set.
- Only call pvscan when lvmetad is used.
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'sys-fs/lvm2/files')
-rw-r--r-- | sys-fs/lvm2/files/lvm.rc-2.02.187 | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.187 b/sys-fs/lvm2/files/lvm.rc-2.02.187 index d9c11730cdb2..f9ad753ea82d 100644 --- a/sys-fs/lvm2/files/lvm.rc-2.02.187 +++ b/sys-fs/lvm2/files/lvm.rc-2.02.187 @@ -86,24 +86,33 @@ start() { fi if [ -d /proc/lvm ] || dm_in_proc ; then - ebegin "Setting up the Logical Volume Manager" - #still echo stderr for debugging - lvm_commands="#!${lvm_path}\n" - # Extra PV find pass because some devices might not have been available until very recently - lvm_commands="${lvm_commands}pvscan --config '${config}'\n" + local has_errors=0 verbose_command + + yesno "${rc_verbose}" && verbose_command=" -v" + + ebegin "Starting the Logical Volume Manager" + + if _use_lvmetad ; then + # Extra PV find pass because some devices might not have been available until very recently + ${lvm_path} pvscan${verbose_command} --config "${config}" --cache + [ $? -ne 0 ] && has_errors=1 + fi + # Now make the nodes - lvm_commands="${lvm_commands}vgscan --config '${config}' --mknodes\n" - # And turn them on! - lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ly\n" + ${lvm_path} vgscan${verbose_command} --config "${config}" --mknodes + [ $? -ne 0 ] && has_errors=1 + + # Enable all VGs + ${lvm_path} vgchange${verbose_command} --config "${config}" --sysinit --activate y + [ $? -ne 0 ] && has_errors=1 if _use_lvmlockd ; then # Start lockd VGs as required - lvm_commands="${lvm_commands}vgchange --config '${config}' --lock-start --lock-opt auto\n" + ${lvm_path} vgchange${verbose_command} --config "${config}" --lock-start --lock-opt auto + [ $? -ne 0 ] && has_errors=1 fi - # Order of this is important, have to work around dash and LVM readline - printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 >/dev/null - eend $? "Failed to setup the LVM" + eend ${has_errors} "Failed to start the Logical Volume Manager" fi fi } |