aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-03-14 10:32:13 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-03-14 10:32:13 +0000
commit87dee5fbcc9c32a163cf7499ee74439e2befc321 (patch)
tree859a668519b16626c6821425a29715ce5965fb16 /tools
parentf9e443afb85c3843c8abd0760ee4a77b0aceeeed (diff)
downloadxen-87dee5fbcc9c32a163cf7499ee74439e2befc321.tar.gz
xen-87dee5fbcc9c32a163cf7499ee74439e2befc321.tar.bz2
xen-87dee5fbcc9c32a163cf7499ee74439e2befc321.zip
bitkeeper revision 1.122.1.15 (3e71afadv9l-u2tI8SHy7dEiub2gNg)
added "mynewdom" script. Horribly CL site specific, but damn useful.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/domain_builder/mynewdom52
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/domain_builder/mynewdom b/tools/domain_builder/mynewdom
new file mode 100755
index 0000000000..fd5d8763f6
--- /dev/null
+++ b/tools/domain_builder/mynewdom
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# mynewdom <size> <extra args>
+
+SIZE=${1:?"size missing"}
+
+shift;
+
+ARGS="$*"
+
+IMAGE=../../../xenolinux-2.4.21-pre4/arch/xeno/boot/image
+
+
+LASTDOM=`/bin/ls /proc/xeno/ | grep -v cmd | cut -c4- | sort -rn | head -1`
+DOM=$[LASTDOM+1]
+
+echo Domain ${DOM} looks free
+
+ADDR=`/sbin/ifconfig eth0 | grep inet.addr | sed -e 's/.*inet addr:\([0-9.]*\) .*/\1/'`
+LO=`echo $ADDR | sed -e 's/[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)/\1/'`
+HI=`echo $ADDR | sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\)\.[0-9]\+/\1/'`
+NEWADDR=$HI.$[LO+DOM]
+
+echo New IP address : ${NEWADDR}
+
+CMDLINE=`cat /proc/cmdline`
+case $CMDLINE in
+*root=/dev/nfs*)
+ROOT_DIR=`echo $CMDLINE | sed -e 's,.*nfsroot=\([^ ]*\).*,\1,'`
+ROOT_PATH=`echo $ROOT_DIR | sed -e 's!^\(.*\)[0-9]\+$!\1!'`
+ROOT_NUM=`echo $ROOT_DIR | sed -e 's!^.*\([0-9]\+\)$!\1!'`
+NEWROOT_DEV="root=/dev/nfs nfsroot=${ROOT_PATH}$[ROOT_NUM+DOM]"
+;;
+*root=/dev/[hs]d[abcd][0-9]*|*root=/dev/x[hs]d[abcd][0-9]*)
+ROOT_DEV=`echo $CMDLINE | sed -e 's!^.*root=\(/dev/[x]*[hs]da[0-9]\+\).*$!\1!'`
+ROOT_DISK=`echo $ROOT_DEV | sed -e 's!\(/dev/[x]\?[hs]d[a-z]\)[0-9]\+!\1!'`
+ROOT_PART=`echo $ROOT_DEV | sed -e 's!/dev/[x]\?[hs]d[a-z]\([0-9]\+\)!\1!'`
+NEWROOT_DEV="root=${ROOT_DISK}$[ROOT_PART+DOM] ro"
+;;
+*)
+echo Could not determine root from /proc/cmdline
+exit
+;;
+esac
+
+echo New root arguments : ${NEWROOT_DEV}
+
+echo ./newdom ${SIZE} ${IMAGE} ${NEWADDR} ${NEWROOT_DEV} ${ARGS}
+
+./newdom ${SIZE} ${IMAGE} ${NEWADDR} ${NEWROOT_DEV} ${ARGS}
+
+