Subject: util-vserver + cpuset
From: Sebastien Bonnegent <sebastien.bonnegent@insa-rouen.fr>
Date: Mon, 05 Jan 2009 16:58:05 +0100
Mon, 05 Jan 2009 16:58:05 +0100
Hi,

I use linux-vserver with cpuset on a recent kernel and I had to modify the function
"addtoCPUSET" of /usr/lib/util-vserver/vserver.functions. Maybe it will be usefull for
other.


function addtoCPUSET
{
    local vdir=$1
    local cpuset
    local f="$vdir"/cpuset
    local i
    local configured=0

    test -d "$f" || return 0
    test -e "$f"/name || return 0

    read cpuset < "$f"/name

    test -e "$f"/nocreate || {
       test -d /dev/cpuset/"$cpuset" || mkdir /dev/cpuset/"$cpuset" || configured=1

       for i in cpus mems cpu exclusive mem exclusive virtualized; do
           if test -e "$f"/"$i"; then

### only one modification on the line below
# before: cat "$f"/"$i" >/dev/cpuset/"$cpuset"/"$i" || {
# explication: filenames in a cpuset are different,
#   /dev/cpuset/foo/cpus became /dev/cpuset/foo/cpuset.cpus

               cat "$f"/"$i" >/dev/cpuset/"$cpuset"/cpuset."$i" || {
                   configured=1
                   break
               }
           fi
       done
    }

    echo $$ >/dev/cpuset/"$cpuset"/tasks || configured=1
    if [ "$configured" -ne 0 ]; then
       warning $"\
WARNING: Failed to create or CPUSET \"$cpuset\" does not exist! Not using it!" >&2
       rmdir /dev/cpuset/"$cpuset" 2>/dev/null || :
       return 0
    fi
}


Ubuntu 8.04.1
Linux 2.6.28
Patch linux vserver 2.6.28-vs2.3.0.36.2
util-vserver 0.30.214-6


Best regard
-- 
Cordialement - Sébastien Bonnegent

                  "GNU/Linux, il y a moins bien mais c'est plus cher."
---------------------------------------------------------------------------------------
| http://www.insa-rouen.fr/institution/organisation/equipe-de-direction/informatique/
|
---------------------------------------------------------------------------------------
       | Ingénieur système et réseau | Tél: 02 32 95 98 61 | GnuPG: 0x669176B0 |
       -------------------------------------------------------------------------
                 | https://asi.insa-rouen.fr/asipedia/index.php/GnuPG |
                 ------------------------------------------------------



["application/pgp-signature" not shown]