Use 4 spaces instead of tabs

RIP 8-width *real* tab :(
This commit is contained in:
Alexis Ben Miloud--Josselin 2018-06-08 13:27:48 +02:00
parent ee4750cefa
commit 34e0f1cf6d

View file

@ -1,33 +1,33 @@
#!/bin/sh #!/bin/sh
usage () { usage () {
echo 'usage: kvmstats.sh [-u K|M|G]' echo 'usage: kvmstats.sh [-u K|M|G]'
exit 1 exit 1
} }
POW=$(echo 1024 ^ 3 | bc) POW=$(echo 1024 ^ 3 | bc)
while echo $1 | grep -q '^-[[:alnum:]]' while echo $1 | grep -q '^-[[:alnum:]]'
do do
case $1 in case $1 in
'-u') '-u')
case $2 in case $2 in
'K') 'K')
POW=$(echo 1024 ^ 1 | bc) POW=$(echo 1024 ^ 1 | bc)
;; ;;
'M') 'M')
POW=$(echo 1024 ^ 2 | bc) POW=$(echo 1024 ^ 2 | bc)
;; ;;
'G') 'G')
POW=$(echo 1024 ^ 3 | bc) POW=$(echo 1024 ^ 3 | bc)
;; ;;
*) *)
usage usage
esac esac
;; ;;
*) *)
usage usage
esac esac
shift shift
done done
# since libvirt seems to store memoy in KiB, POW must be lowered by 1 # since libvirt seems to store memoy in KiB, POW must be lowered by 1
@ -35,11 +35,11 @@ POW=$(expr $POW / 1024)
for DEP in hxselect lvs tempfile for DEP in hxselect lvs tempfile
do do
if [ -z "$(which $DEP)" ] if [ -z "$(which $DEP)" ]
then then
echo "kvmstats.sh: $DEP not found in \$PATH" 1>&2 echo "kvmstats.sh: $DEP not found in \$PATH" 1>&2
exit 1 exit 1
fi fi
done done
TMPFILE=$(tempfile) TMPFILE=$(tempfile)
@ -55,14 +55,14 @@ do
do do
case $DEV in case $DEV in
/dev/drbd/*) /dev/drbd/*)
DISK=$(cat $LVSOUT | awk "/$VM/ { ans += \$NF } END { print ans / 1024 ^ 3 }") DISK=$(cat $LVSOUT | awk "/$VM/ { ans += \$NF } END { print ans / 1024 ^ 3 }")
;; ;;
*.qcow2) *.qcow2)
DISK=$(du -sBG $DEV | awk '{ print substr($1, 0, length($1) - 1) }') DISK=$(du -sBG $DEV | awk '{ print substr($1, 0, length($1) - 1) }')
;; ;;
*) *)
DISK=0 DISK=0
esac esac
done done
echo $VM $VCPU $RAM $DISK echo $VM $VCPU $RAM $DISK
done >$TMPFILE done >$TMPFILE