Changeset 3016 in MondoRescue


Ignore:
Timestamp:
Jun 3, 2012, 1:52:28 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Substitue a complex awk expression by a more simpler perl one in analyze-my-lvm
  • Fix a bug on RHEL 5 where lvdisplay doesn't support redirection. Adds a | cat in between, as was done for vgdisplay
Location:
branches/3.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/analyze-my-lvm

    r3001 r3016  
    1313GetValueFromField() {
    1414    local res
    15     sed s/'    '/~/ "$1" | tr -s ' ' ' ' | sed s/'~ '/'~'/ | grep -i "$2~" | cut -d'~' -f2,3,4,5 | tr '~' ' ' | gawk '{ if ($2=="MB") {printf "%dm",$1;} else if ($2=="MiB") {printf "%dm",$1;} else if ($2=="KB") {printf "%dk",$1;} else if ($2=="KiB") {printf "%dk",$1;} else if ($2=="GB") {printf "%fg",$1;} else if ($2=="GiB") {printf "%fg",$1;} else if ($2=="TB") {printf "%dt",$1;} else if ($2=="TiB") {printf "%dt",$1;} else {print $0;};}'
     15    grep -i "$2" "$1" | perl -pi -e 's/\s*(.*)\s\s\s+(.+)$/$2/;s/\sT[i]*B/t/;s/\sG[i]*B/g/;s/\sM[i]*B/m/;s/\sK[i]*B/k/'
    1616}
    1717
     
    8484    device=$1
    8585    output=""
    86     $LVMCMD lvdisplay $device > $fname
     86    $LVMCMD lvdisplay $device | cat > $fname
    8787    stripes=`GetValueFromField $fname "Stripes"`
    8888    stripesize=`GetValueFromField $fname "Stripe size (MByte)"`m
     
    9090    [ "$stripesize" = "k" ] && stripesize=""
    9191    allocation=`GetValueFromField $fname "LV Size"`
    92     [ ! "`echo "$allocation" | grep "[k,m,g]"`" ] && allocation="$allocation"m
     92    [ ! "`echo "$allocation" | grep "[k,m,g,t]"`" ] && allocation="$allocation"m
    9393    if echo "$allocation" | grep -E '^.*g$' > /dev/null 2> /dev/null ; then
    9494        val=`echo "$allocation" | sed s/g//`
     
    124124    rm -f $VG_info_file
    125125}
    126 
    127 
    128126
    129127
  • branches/3.0/mondo/test/mondo-test

    r3015 r3016  
    257257    sudomrtest "scp -i $MRTEST/.ssh/pb_dsa -P $port /tmp/script root@localhost:"
    258258    sudomrtest "ssh -i $MRTEST/.ssh/pb_dsa -p $port root@localhost ./script"
    259     sudomrtest "qemu-img create -f qcow2 $MRTEST/vm/$d.rest 8"
     259    sudomrtest "qemu-img create -f qcow2 $MRTEST/vm/$d.rest 8G"
    260260    sudomrtest "chmod 666 $MRTEST/vm/$d.rest"
    261261    #sudomrtest "ssh -i $MRTEST/.ssh/pb_dsa -p $port root@localhost /sbin/halt -p" &
Note: See TracChangeset for help on using the changeset viewer.