Blob Blame History Raw
From f9fc4330da71dfb43c64fb424a5fef2909e4f4c3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 21 Oct 2013 09:09:26 +0200
Subject: [PATCH] lvm: always install thin utils for lvm

---
 modules.d/90lvm/module-setup.sh | 34 ++++++++--------------------------
 1 file changed, 8 insertions(+), 26 deletions(-)

diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 50d9b98..f1c19a2 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -22,7 +22,8 @@ depends() {
     return 0
 }
 
-get_host_lvs() {
+# called by dracut
+cmdline() {
     local _activated
     declare -A _activated
 
@@ -35,35 +36,20 @@ get_host_lvs() {
         eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
         [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
         if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
-            printf "%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
+            printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
             _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
         fi
     done
 }
 
-cmdline() {
-    get_host_lvs | while read line; do
-        printf " rd.lvm.lv=$line"
-    done
-}
-
+# called by dracut
 install() {
-    local _i _needthin
+    local _i
 
     inst lvm
 
-    if [[ $hostonly ]]; then
-        while read line; do
-            [[ -n "$line" ]] || continue
-            printf "%s" " rd.lvm.lv=$line"
-            if ! [[ $_needthin ]]; then
-                [[ "$(lvs --noheadings -o segtype ${line%%/*} 2>/dev/null)" == *thin* ]] && _needthin=1
-            fi
-        done <<<$(get_host_lvs) >> "${initdir}/etc/cmdline.d/90lvm.conf"
-        echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
-    else
-        _needthin=1
-    fi
+    cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
+    echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
 
     inst_rules "$moddir/64-lvm.rules"
 
@@ -99,9 +85,5 @@ install() {
 
     inst_libdir_file "libdevmapper-event-lvm*.so"
 
-    if [[ $_needthin ]]; then
-        inst_multiple -o thin_dump thin_restore thin_check thin_repair
-    fi
-
+    inst_multiple -o thin_dump thin_restore thin_check thin_repair
 }
-