ia64/xen-unstable

changeset 298:c087ff762f6a

bitkeeper revision 1.122.1.15 (3e71afadv9l-u2tI8SHy7dEiub2gNg)

added "mynewdom" script. Horribly CL site specific, but damn useful.
author iap10@labyrinth.cl.cam.ac.uk
date Fri Mar 14 10:32:13 2003 +0000 (2003-03-14)
parents 8d97a5bf81d2
children f233fd11d69e
files .rootkeys tools/domain_builder/mynewdom
line diff
     1.1 --- a/.rootkeys	Thu Mar 13 21:37:07 2003 +0000
     1.2 +++ b/.rootkeys	Fri Mar 14 10:32:13 2003 +0000
     1.3 @@ -187,6 +187,7 @@ 3e4d0046ouLij_CMN_j7-dUHZIBI_A tools/dom
     1.4  3e4d0046EKs06fY0CWDEgZQcn7DYUg tools/domain_builder/dom_kill.c
     1.5  3e4d0046aPbGiRTtdWxqY5b3ytWurA tools/domain_builder/hypervisor_defs.h
     1.6  3e4d00468aE86IfyjfrJwYoxzM7pAw tools/domain_builder/mem_defs.h
     1.7 +3e71afadoAI0VvAGKebLpToVQxUKfQ tools/domain_builder/mynewdom
     1.8  3e4d0046VHhXwFuG5FK34AVxqd5A_A tools/domain_builder/newdom
     1.9  3e4d0046IBzDIeaMbQB-e2QB2ahbig tools/domain_builder/vifinit
    1.10  3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/domain_builder/mynewdom	Fri Mar 14 10:32:13 2003 +0000
     2.3 @@ -0,0 +1,52 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +# mynewdom <size> <extra args>
     2.7 +
     2.8 +SIZE=${1:?"size missing"}
     2.9 +
    2.10 +shift;
    2.11 +
    2.12 +ARGS="$*"
    2.13 +
    2.14 +IMAGE=../../../xenolinux-2.4.21-pre4/arch/xeno/boot/image
    2.15 +
    2.16 +
    2.17 +LASTDOM=`/bin/ls /proc/xeno/ | grep -v cmd | cut -c4- | sort -rn | head -1`
    2.18 +DOM=$[LASTDOM+1]
    2.19 +
    2.20 +echo Domain ${DOM} looks free
    2.21 +
    2.22 +ADDR=`/sbin/ifconfig eth0 | grep inet.addr | sed -e 's/.*inet addr:\([0-9.]*\) .*/\1/'`
    2.23 +LO=`echo $ADDR | sed -e 's/[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)/\1/'`
    2.24 +HI=`echo $ADDR | sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/'`
    2.25 +NEWADDR=$HI.$[LO+DOM]
    2.26 +
    2.27 +echo New IP address : ${NEWADDR}
    2.28 +
    2.29 +CMDLINE=`cat /proc/cmdline`
    2.30 +case $CMDLINE in
    2.31 +*root=/dev/nfs*)
    2.32 +ROOT_DIR=`echo $CMDLINE | sed -e 's,.*nfsroot=\([^ ]*\).*,\1,'`
    2.33 +ROOT_PATH=`echo $ROOT_DIR | sed -e 's!^\(.*\)[0-9]\+$!\1!'`
    2.34 +ROOT_NUM=`echo $ROOT_DIR | sed -e 's!^.*\([0-9]\+\)$!\1!'`
    2.35 +NEWROOT_DEV="root=/dev/nfs nfsroot=${ROOT_PATH}$[ROOT_NUM+DOM]"
    2.36 +;;
    2.37 +*root=/dev/[hs]d[abcd][0-9]*|*root=/dev/x[hs]d[abcd][0-9]*)
    2.38 +ROOT_DEV=`echo $CMDLINE | sed -e 's!^.*root=\(/dev/[x]*[hs]da[0-9]\+\).*$!\1!'`
    2.39 +ROOT_DISK=`echo $ROOT_DEV | sed -e 's!\(/dev/[x]\?[hs]d[a-z]\)[0-9]\+!\1!'`
    2.40 +ROOT_PART=`echo $ROOT_DEV | sed -e 's!/dev/[x]\?[hs]d[a-z]\([0-9]\+\)!\1!'`
    2.41 +NEWROOT_DEV="root=${ROOT_DISK}$[ROOT_PART+DOM] ro"
    2.42 +;;
    2.43 +*)
    2.44 +echo Could not determine root from /proc/cmdline
    2.45 +exit
    2.46 +;;
    2.47 +esac
    2.48 +
    2.49 +echo New root arguments : ${NEWROOT_DEV}
    2.50 +
    2.51 +echo ./newdom ${SIZE} ${IMAGE} ${NEWADDR} ${NEWROOT_DEV} ${ARGS}
    2.52 +
    2.53 +./newdom ${SIZE} ${IMAGE} ${NEWADDR} ${NEWROOT_DEV} ${ARGS}
    2.54 +
    2.55 +