X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=238c4b8cd2ed55b5b9022a0426374ce95d60eb9d;hb=00f4a733697e86ef0b39ce3c6fc4f8a8a2f28eb6;hp=c97c0c6734a714f1a58c0f8ef78bfdac112889ba;hpb=3d2cab9a6a00cf148c1cd586ea9bf6f75df62673;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index c97c0c6..238c4b8 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -20,6 +20,7 @@ # $VSERVER_NAME ... name of vserver declare -a NICE_CMD=() +declare -a IONICE_CMD=() declare -a CHBIND_CMD=() declare -a CAP_OPTS=() declare -a CHCONTEXT_INIT_OPTS=() @@ -135,6 +136,17 @@ function _generateNiceCommand NICE_CMD=( $_NICE -n $nice ) } +function _generateIONiceCommand +{ + local vdir=$1 + local ionice_class=2 + local ionice_priority=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 ) +} function _generatePersonalityOptions { @@ -561,6 +573,7 @@ function _processSingleInterface local mac local extip local up="up" + local peer _getInterfaceValue ip '' "$iface" _getInterfaceValue extip '' "$iface" "$iface/.." @@ -571,6 +584,7 @@ function _processSingleInterface _getInterfaceValue name '' "$iface" _getInterfaceValue scope '' "$iface" "$iface/.." _getInterfaceValue mac '' "$iface" + _getInterfaceValue peer '' "$iface" test -n "$ip" || { echo $"Can not read ip for '$iface'" >&2; return 1; } test -n "$dev" -o -e "$iface"/nodev || { @@ -613,7 +627,7 @@ function _processSingleInterface _addInterfaceCmd TUNCTL "$dev" $tun_info fi - _addInterfaceCmd IP_ADDR "$ip${prefix:+/$prefix}" $use_bcast ${name:+label "$dev:$name"} dev "$dev" + _addInterfaceCmd IP_ADDR "$ip${prefix:+/$prefix}" $use_bcast ${name:+label "$dev:$name"} dev "$dev" ${peer:+peer "$peer"} #_addInterfaceCmd IP_ROUTE "$ip${prefix:+/$prefix}" dev "$dev" _addInterfaceCmd IP_LINK "$dev" $up elif ! test -n "$N_CONTEXT"; then @@ -755,8 +769,8 @@ function _generateSpaceOptions local vdir="$1" local d="$vdir"/spaces - test ! -e "$d"/pid || \ - OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --pid ) + ( test ! -e "$d"/pid ) || \ + OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --pid ) test ! -e "$d"/net || { OPTS_VSPACE=( "${OPTS_VSPACE[@]}" --net ) @@ -809,6 +823,7 @@ function generateOptions _generateInterfaceOptions "$1" test -n "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$1" _generateNiceCommand "$1" + _generateIONiceCommand "$1" _generateInitOptions "$1" _generateChcontextOptions "$1" _generateScheduleOptions "$1" @@ -1349,7 +1364,7 @@ function _namespaceCleanup done < /proc/mounts # separate loop to avoid races while reading /proc/mounts for i in "${list_umount[@]}"; do - $_UMOUNT -l -n "$i" + $_UMOUNT -l -n -i "$i" done }