Skip to contentSkip to conversation

dmraid/lvm/mdraid activation logic fix.

PATCH In review WANG Chao 1 participant 2 messages Oct 22, 2012 – Oct 31, 2012 1 message not in the archive

lore
Share & tools
lore

WANG Chao

author
#0 lore raw

PATCH 1/1 dmraid/lvm/mdraid activation logic fix.

Current dmraid/lvm/mdraid activation logic looks like a mess.

Only activate dmraid/lvm/mdraid under any of the following conditions:
1. User specify rd.dm.uuid/rd.md.uuid/rd.lvm.{vg,lv} on the cmdline.
2. rd.dm/rd.md/rd.lvm != 0 and rd.auto=1

On the contrary, disable activation when !(cond 1 or cond 2).

---
 modules.d/90dmraid/parse-dm.sh | 13 +++++--------
 modules.d/90lvm/parse-lvm.sh   |  5 +++--
 modules.d/90mdraid/parse-md.sh |  3 ++-
 3 files changed, 10 insertions(+), 11 deletions(-)
modules.d/90dmraid/parse-dm.sh +5 -8
index 76dfb5d..4bc903c 100755
@@ -2,8 +2,11 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 # nodmraid for anaconda / rc.sysinit compatibility
-if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
-    info "rd.dm=0: removing DM RAID activation"
+
+DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
+
+if [ -z "$DM_RAIDS" ] && \
+    (! getargbool 0 rd.auto || ! getargbool 1 rd.dm -d -n rd_NO_DM -d -n nodmraid); then
     udevproperty rd_NO_DM=1
 fi
 
@@ -16,9 +19,3 @@ if  ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n
     info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
     udevproperty rd_NO_MDDDF=1
 fi
-
-DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
-
-if [ -z "$DM_RAIDS" ] && ! getargbool 0 rd.auto; then
-    udevproperty rd_NO_DM=1
-fi
modules.d/90lvm/parse-lvm.sh +3 -2
index 3e6b371..655d6c6 100755
@@ -1,14 +1,15 @@
 #!/bin/sh
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
+
 if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
     rm -f /etc/lvm/lvm.conf
 fi
 
 LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
 
-if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
-    || ( [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto ); then
+if [ -z "$LV_DEVS" ] && \
+    (! getargbool 0 rd.auto || ! getargbool 1 rd.lvm -d -n rd_NO_LVM ); then
     info "rd.lvm=0: removing LVM activation"
     rm -f /etc/udev/rules.d/64-lvm*.rules
 else
modules.d/90mdraid/parse-md.sh +2 -1
index 2de435b..80a19bc 100755
@@ -4,7 +4,8 @@
 
 MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
 
-if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
+if [ -z "$MD_UUID" ] && \
+    (! getargbool 0 rd.auto || ! getargbool 1 rd.md -d -n rd_NO_MD); then
     info "rd.md=0: removing MD RAID activation"
     udevproperty rd_NO_MD=1
 else
Signature · 1 line
1.7.12.4

A message that is not in the archive (sent off-list or not yet received): 1350907147-26720-1-git-send-email-chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

author
#2 lore raw
Quoted 71 lines · WANG Chao

Current dmraid/lvm/mdraid activation logic looks like a mess.

Only activate dmraid/lvm/mdraid under any of the following conditions:
1. User specify rd.dm.uuid/rd.md.uuid/rd.lvm.{vg,lv} on the cmdline.
2. rd.dm/rd.md/rd.lvm != 0 and rd.auto=1

On the contrary, disable activation when !(cond 1 or cond 2).

---
  modules.d/90dmraid/parse-dm.sh | 13 +++++--------
  modules.d/90lvm/parse-lvm.sh   |  5 +++--
  modules.d/90mdraid/parse-md.sh |  3 ++-
  3 files changed, 10 insertions(+), 11 deletions(-)
modules.d/90dmraid/parse-dm.sh +5 -8
index 76dfb5d..4bc903c 100755
@@ -2,8 +2,11 @@
  # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
  # ex: ts=8 sw=4 sts=4 et filetype=sh
  # nodmraid for anaconda / rc.sysinit compatibility
-if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
-    info "rd.dm=0: removing DM RAID activation"
+
+DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
+
+if [ -z "$DM_RAIDS" ] && \
+    (! getargbool 0 rd.auto || ! getargbool 1 rd.dm -d -n rd_NO_DM -d -n nodmraid); then
      udevproperty rd_NO_DM=1
  fi
 
@@ -16,9 +19,3 @@ if  ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n
      info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
      udevproperty rd_NO_MDDDF=1
  fi
-
-DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
-
-if [ -z "$DM_RAIDS" ] && ! getargbool 0 rd.auto; then
-    udevproperty rd_NO_DM=1
-fi
modules.d/90lvm/parse-lvm.sh +3 -2
index 3e6b371..655d6c6 100755
@@ -1,14 +1,15 @@
  #!/bin/sh
  # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
  # ex: ts=8 sw=4 sts=4 et filetype=sh
+
  if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
      rm -f /etc/lvm/lvm.conf
  fi
 
  LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
 
-if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
-    || ( [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto ); then
+if [ -z "$LV_DEVS" ] && \
+    (! getargbool 0 rd.auto || ! getargbool 1 rd.lvm -d -n rd_NO_LVM ); then
      info "rd.lvm=0: removing LVM activation"
      rm -f /etc/udev/rules.d/64-lvm*.rules
  else
modules.d/90mdraid/parse-md.sh +0 -0
index 2de435b..80a19bc 100755

modules.d/90mdraid/parse-md.sh line 11

Quoted 9 lines
modules.d/90mdraid/parse-md.sh +2 -1
@@ -4,7 +4,8 @@
 
  MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
 
-if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
+if [ -z "$MD_UUID" ] && \
+    (! getargbool 0 rd.auto || ! getargbool 1 rd.md -d -n rd_NO_MD); then
      info "rd.md=0: removing MD RAID activation"
      udevproperty rd_NO_MD=1
  else

Hi, Harald

What do you think of this patch?

And also kdump need this patch. cc4037d explains why we need override rd.dm/rd.md if rd.dm.uuid/rd.md.uuid is provided. And e064127 which introduces rd.auto breaks the rules.

Thanks,
WANG Chao