Mike Burns
2011-Jul-29 18:32 UTC
[Ovirt-devel] [PATCH node] fix dracut plugin wildcard handling
The plugin was breaking when a device with a wildcard was passed. rhbz#725964 Signed-off-by: Mike Burns <mburns at redhat.com> --- dracut/install | 1 + dracut/ovirt-cleanup.sh | 8 ++++---- scripts/ovirt-boot-functions | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dracut/install b/dracut/install index f3f2f07..1832b89 100755 --- a/dracut/install +++ b/dracut/install @@ -1,6 +1,7 @@ #!/bin/bash inst yes +inst head inst_hook pre-pivot 01 "$moddir/ovirt-cleanup.sh" inst_simple "$moddir/ovirt-boot-functions" /sbin/ovirt-boot-functions diff --git a/dracut/ovirt-cleanup.sh b/dracut/ovirt-cleanup.sh index 775bcf8..a6762cf 100755 --- a/dracut/ovirt-cleanup.sh +++ b/dracut/ovirt-cleanup.sh @@ -34,9 +34,9 @@ fi # Blank entry will result in getting first disk if getarg storage_init; then - storage_init=$(getarg storage_init) + storage_init="$(sed -r 's/^.*storage_init=([^ ]*) .*$/\1/' /proc/cmdline)" elif getarg ovirt_init; then - storage_init=$(getarg ovirt_init) + storage_init="$(sed -r 's/^.*ovirt_init=([^ ]*) .*$/\1/' /proc/cmdline)" else return 0 fi @@ -49,13 +49,13 @@ fi # would partition sda and sdb as part of HostVG and # sdc and sdd as part of AppVG # Since we only care which disks are being used, change to a single list -storage_init=$(echo $storage_init | sed 's/;/,/') +storage_init="$(echo "$storage_init" | sed 's/;/,/')" oldIFS=$IFS lvm pvscan 2>/dev/null IFS="," -for dev in $storage_init; do +for dev in "$storage_init"; do device=$(IFS=$oldIFS parse_disk_id "$dev") echo "Wiping LVM from device: ${device}" IFS=$oldIFS diff --git a/scripts/ovirt-boot-functions b/scripts/ovirt-boot-functions index 8d9cda6..c7e54af 100644 --- a/scripts/ovirt-boot-functions +++ b/scripts/ovirt-boot-functions @@ -128,7 +128,7 @@ parse_disk_id() { serial=${i#:} ;; /dev/*) - disk="$(ls -1 "$i" 2>/dev/null | grep -m 1 "$dev")" + disk="$(ls -1 "$i" 2>/dev/null | head -n1)" ;; esac if [ -n "$bus" ]; then -- 1.7.4.4
Reasonably Related Threads
- [PATCH node] Add debugging info to dracut plugin
- [PATCH node] always remove HostVG in dracut when reinstall/uninstall/firstboot passed
- [PATCH node] handle wildcards appropriately in dracut plugin
- [PATCH] RFC: Advanced Storage Configuration
- [PATCH node] only wipe HostVG if storage_init is not passed in dracut