Only give ionice the arguments provided
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Mon, 8 Aug 2011 07:23:28 +0000 (09:23 +0200)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Mon, 8 Aug 2011 07:23:28 +0000 (09:23 +0200)
scripts/vserver.functions

index d10ccf2..ee1751e 100644 (file)
@@ -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