From: Daniel Hokka Zakrisson Date: Mon, 8 Aug 2011 07:23:28 +0000 (+0200) Subject: Only give ionice the arguments provided X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65600eead296f8d5f1c04f2cecb565baec7ac169;p=util-vserver.git Only give ionice the arguments provided --- diff --git a/scripts/vserver.functions b/scripts/vserver.functions index d10ccf2..ee1751e 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -154,15 +154,21 @@ function _generateNiceCommand function _generateIONiceCommand { local vdir=$1 - local ionice_class=2 - local ionice_priority=0 + local ionice_class= + local ionice_priority= test -n "$_IONICE" || return 0 test -r "$vdir/ionice/class" && read ionice_class <"$vdir"/ionice/class test -r "$vdir/ionice/priority" && read ionice_priority <"$vdir"/ionice/priority - IONICE_CMD=( $_IONICE -c$ionice_class -n$ionice_priority ) + test -n "$ionice_class$ionice_priority" || return 0 + + if test -z "$ionice_class" -a -n "$ionice_priority"; then + IONICE_CMD=( $_IONICE -c2 -n"$ionice_priority" ) + else + IONICE_CMD=( $_IONICE ${ionice_class:+-c$ionice_class} ${ionice_priority:+-n$ionice_priority} ) + fi } function _generatePersonalityOptions