direct-io.hg

changeset 452:316a46d203dd

bitkeeper revision 1.233 (3ec4b0f6Cj_75HMxVrjHKR0QUy_kNA)

Many files:
new file
xenohead.def:
change bean persistence from session to application
Makefile:
clean web/tmpl too
xi_list:
add raw integer state to output
Many files:
split for dual use: original command line invocation from domctl
and new xenctl gui
domctl:
look for domctl.xml in /var/lib/xen
domctl.xml:
xi_tools_dir should come at the top
build-dom.xml:
remove silliness
Makefile:
add support for xenctl
build-dom.xml:
Rename: tools/control/build-domctl.xml -> tools/control/build-dom.xml
build-domctl.xml:
Rename: tools/control/build.xml -> tools/control/build-domctl.xml
Many files:
mvdir
author kaf24@scramble.cl.cam.ac.uk
date Fri May 16 09:35:50 2003 +0000 (2003-05-16)
parents 973c31c99779
children 8bdb0d520994
files .rootkeys tools/control/Makefile tools/control/build-dom.xml tools/control/build-xen.xml tools/control/build.properties tools/control/domctl tools/control/domctl.xml tools/control/src/uk/ac/cam/cl/xeno/domctl/Command.java tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandHelp.java tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandList.java tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandStart.java tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandStop.java tools/control/src/uk/ac/cam/cl/xeno/domctl/Defaults.java tools/control/src/uk/ac/cam/cl/xeno/domctl/Domain.java tools/control/src/uk/ac/cam/cl/xeno/domctl/InetAddressPattern.java tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java tools/control/src/uk/ac/cam/cl/xeno/domctl/Settings.java tools/control/src/uk/ac/cam/cl/xeno/domctl/StringPattern.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/Extent.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/Library.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/Main.java.orig tools/control/src/uk/ac/cam/cl/xeno/xenctl/Mode.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/Parser.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/Partition.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/PartitionManager.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualBlockDevice.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualDisk.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualDiskManager.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/XML.java tools/control/src/uk/ac/cam/cl/xeno/xenctl/XMLHelper.java tools/control/web/WEB-INF/web.xml tools/control/web/img/cambridge.gif tools/control/web/img/help.gif tools/control/web/img/home.gif tools/control/web/img/pixel.gif tools/control/web/img/search.gif tools/control/web/img/xeno.gif tools/control/web/tmpl/about.tmpl tools/control/web/tmpl/dom-del.tmpl tools/control/web/tmpl/dom-delr.tmpl tools/control/web/tmpl/dom-lis.tmpl tools/control/web/tmpl/dom-new.tmpl tools/control/web/tmpl/dom-newr.tmpl tools/control/web/tmpl/dom-sta.tmpl tools/control/web/tmpl/dom-star.tmpl tools/control/web/tmpl/dom-stp.tmpl tools/control/web/tmpl/dom-stpr.tmpl tools/control/web/tmpl/dom.tmpl tools/control/web/tmpl/dommenu.tmpl tools/control/web/tmpl/help.tmpl tools/control/web/tmpl/index.tmpl tools/control/web/tmpl/install.pl tools/control/web/tmpl/makefile tools/control/web/tmpl/newdom.tmpl tools/control/web/tmpl/vd-fv.tmpl tools/control/web/tmpl/vd-pa.tmpl tools/control/web/tmpl/vd-par.tmpl tools/control/web/tmpl/vd-pv.tmpl tools/control/web/tmpl/vd-vbdc.tmpl tools/control/web/tmpl/vd-vbdcr.tmpl tools/control/web/tmpl/vd-vbdd.tmpl tools/control/web/tmpl/vd-vbdf.tmpl tools/control/web/tmpl/vd-vbdfr.tmpl tools/control/web/tmpl/vd-vbdv.tmpl tools/control/web/tmpl/vd-vdc.tmpl tools/control/web/tmpl/vd-vdcr.tmpl tools/control/web/tmpl/vd-vdd.tmpl tools/control/web/tmpl/vd-vddr.tmpl tools/control/web/tmpl/vd-vdr.tmpl tools/control/web/tmpl/vd-vdrr.tmpl tools/control/web/tmpl/vd-vdv.tmpl tools/control/web/tmpl/vd.tmpl tools/control/web/tmpl/vdmenu.tmpl tools/control/web/tmpl/xenofoot.def tools/control/web/tmpl/xenohead.def tools/control/web/tmpl/xenostyle.css tools/domctl/Makefile tools/domctl/build.xml tools/domctl/domctl tools/domctl/domctl.xml tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Command.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandHelp.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandStart.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandStop.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Defaults.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/InetAddressPattern.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Main.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Settings.java tools/domctl/src/uk/ac/cam/cl/xeno/domctl/StringPattern.java tools/internal/xi_helper tools/internal/xi_list
line diff
     1.1 --- a/.rootkeys	Thu May 15 17:57:46 2003 +0000
     1.2 +++ b/.rootkeys	Fri May 16 09:35:50 2003 +0000
     1.3 @@ -6,6 +6,85 @@ 3eb788d6Kleck_Cut0ouGneviGzliQ Makefile
     1.4  3e6377b24eQqYMsDi9XrFkIgTzZ47A tools/balloon/Makefile
     1.5  3e6377d6eiFjF1hHIS6JEIOFk62xSA tools/balloon/README
     1.6  3e6377dbGcgnisKw16DPCaND7oGO3Q tools/balloon/balloon.c
     1.7 +3eb781edFwm_pW9FwnQACIe68viLOw tools/control/Makefile
     1.8 +3eb781fcTp_LPQwaot3SSSehkaf4eg tools/control/build-dom.xml
     1.9 +3ec41f7cWCxQ8pdH8ZWqhhv-38qQ1w tools/control/build-xen.xml
    1.10 +3ec41f7ca6IBXDSe0HVcMPp3PPloOQ tools/control/build.properties
    1.11 +3eb781fcXf-WczEdAhnTpWfbR55jqA tools/control/domctl
    1.12 +3eb781fcabCKRogwxJA3-jJKstw9Vg tools/control/domctl.xml
    1.13 +3eb781fcffCXkrcWLBxUTOfQFa3Saw tools/control/src/uk/ac/cam/cl/xeno/domctl/Command.java
    1.14 +3eb781fcOLcVAcqnZOAikur6sAP0rA tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java
    1.15 +3eb781fcQuQVSKxKtp4fBgPOwx7DDw tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandHelp.java
    1.16 +3ec41f7czS8UBqCsIi-nmojTBtg_iQ tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandList.java
    1.17 +3eb781fcRYdxK1HbjBX7r7VlO5PS0w tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java
    1.18 +3eb781fcbp9IAHTl40CoMavY1FNd_g tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandStart.java
    1.19 +3eb781fdRXSsyEre7LxCmPJMpB5BaQ tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandStop.java
    1.20 +3eb781fdX_thm9iHSxQ8vqQ0fL7Ncg tools/control/src/uk/ac/cam/cl/xeno/domctl/Defaults.java
    1.21 +3ec41f7cALw7QY_whiAsucUUb006Gg tools/control/src/uk/ac/cam/cl/xeno/domctl/Domain.java
    1.22 +3eb781fdTWJr8RPdfuG20IC0CzYL2A tools/control/src/uk/ac/cam/cl/xeno/domctl/InetAddressPattern.java
    1.23 +3eb781fdA8LFQEYE2fXg1JDB9OceYA tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java
    1.24 +3eb781fd_CgRvlaIBkJjxUSnuvCuHQ tools/control/src/uk/ac/cam/cl/xeno/domctl/Settings.java
    1.25 +3eb781fdFDS4lap1-3ZVDtbKZfpVZA tools/control/src/uk/ac/cam/cl/xeno/domctl/StringPattern.java
    1.26 +3ec41f7csVaMDEEUMZBotpSftCy0rg tools/control/src/uk/ac/cam/cl/xeno/xenctl/Extent.java
    1.27 +3ec41f7cO5uUI4qZmJ29jsammoZP4Q tools/control/src/uk/ac/cam/cl/xeno/xenctl/Library.java
    1.28 +3ec41f7civcv4mQiYK0DeX9Zvsxhrw tools/control/src/uk/ac/cam/cl/xeno/xenctl/Main.java.orig
    1.29 +3ec41f7dOVcHj4xU3BFut_einNzj6A tools/control/src/uk/ac/cam/cl/xeno/xenctl/Mode.java
    1.30 +3ec41f7d3-xTeoVJBJqWqxVfU-ANoQ tools/control/src/uk/ac/cam/cl/xeno/xenctl/Parser.java
    1.31 +3ec41f7dnnLe-6h-XWIvQVoP9oZu_A tools/control/src/uk/ac/cam/cl/xeno/xenctl/Partition.java
    1.32 +3ec41f7dD8h6MGxKTPtKzXPdGJS7bw tools/control/src/uk/ac/cam/cl/xeno/xenctl/PartitionManager.java
    1.33 +3ec41f7dOVZgjP4sQS6vjuBnExdlMQ tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java
    1.34 +3ec41f7dvPdszb0frNEkMnEdJUBVjA tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java
    1.35 +3ec41f7dlW5Buk3MO18HHtBax1Jz9g tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualBlockDevice.java
    1.36 +3ec41f7dP3VglJUTuP45rwvSAoW_pg tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualDisk.java
    1.37 +3ec41f7d8_ZsS9JjYQq861OFAZS9GA tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualDiskManager.java
    1.38 +3ec41f7dSJieScU3uvPMGXk-8NgHvA tools/control/src/uk/ac/cam/cl/xeno/xenctl/XML.java
    1.39 +3ec41f7dGO96BS8-6FWGDjCxjncOGg tools/control/src/uk/ac/cam/cl/xeno/xenctl/XMLHelper.java
    1.40 +3ec41f7dO6IuKGGLG4VRUhMDmkTn5g tools/control/web/WEB-INF/web.xml
    1.41 +3ec41f7dRAPXBA0jQUd1k6MB3xVidg tools/control/web/img/cambridge.gif
    1.42 +3ec41f7dvxVe1Vb3kVOLZcN5Jra2tQ tools/control/web/img/help.gif
    1.43 +3ec41f7dJYExm-ityN2SgVVaeR_BYA tools/control/web/img/home.gif
    1.44 +3ec41f7d4IYjCuVYWjgq-OCue4O0Vw tools/control/web/img/pixel.gif
    1.45 +3ec41f7dW6Rxbc2h5vulWqEkj0rMzA tools/control/web/img/search.gif
    1.46 +3ec41f7d-WawzXt-iMiQON6VVF0d6Q tools/control/web/img/xeno.gif
    1.47 +3ec41f7d6gAIVIeI6d36osnxPNIbEw tools/control/web/tmpl/about.tmpl
    1.48 +3ec41f7dU7BdfMqTjNuI2yFIE9YTxQ tools/control/web/tmpl/dom-del.tmpl
    1.49 +3ec41f7dnAVr1lPsPDV0cwNe-cDiSw tools/control/web/tmpl/dom-delr.tmpl
    1.50 +3ec41f7dKNiNO7usbqUVaXvZafVzSg tools/control/web/tmpl/dom-lis.tmpl
    1.51 +3ec41f7dJ4oF7TdF8c858DgzXAPJUA tools/control/web/tmpl/dom-new.tmpl
    1.52 +3ec41f7dPelejfeiuXzFeETZXtYY3g tools/control/web/tmpl/dom-newr.tmpl
    1.53 +3ec41f7deN7cXpkmKhmp9nGMWtQ9Yw tools/control/web/tmpl/dom-sta.tmpl
    1.54 +3ec41f7dFl7cFsLVTEu06abaLjrh7A tools/control/web/tmpl/dom-star.tmpl
    1.55 +3ec41f7dOyejg7nsGjHhwS9dRwuwJQ tools/control/web/tmpl/dom-stp.tmpl
    1.56 +3ec41f7d-jdCAs49yO8mmvGdbVnFcQ tools/control/web/tmpl/dom-stpr.tmpl
    1.57 +3ec41f7d2S1JM6utrcajiWWmPi85TA tools/control/web/tmpl/dom.tmpl
    1.58 +3ec41f7dPyCkHbXAufQ0Nxnvhq7XpQ tools/control/web/tmpl/dommenu.tmpl
    1.59 +3ec41f7dZRDqKe8wk__95ztDQmaAOA tools/control/web/tmpl/help.tmpl
    1.60 +3ec41f7eTqbaFqMGU7lJG09vlEt0TQ tools/control/web/tmpl/index.tmpl
    1.61 +3ec41f7ed6_QZ1mg0vuA9Xu1wu1plw tools/control/web/tmpl/install.pl
    1.62 +3ec41f7emmAnjM4gsW6JWkqsjfi4Rg tools/control/web/tmpl/makefile
    1.63 +3ec41f7eGeQD-tCpxZNxNVcnKt6HfA tools/control/web/tmpl/newdom.tmpl
    1.64 +3ec41f7eoDHD2raa4x6dBINr4QLO3A tools/control/web/tmpl/vd-fv.tmpl
    1.65 +3ec41f7eawycxV05Ow3LfZtOlHZJPA tools/control/web/tmpl/vd-pa.tmpl
    1.66 +3ec41f7ef4mVT4vwOEL40MKIzS4EeA tools/control/web/tmpl/vd-par.tmpl
    1.67 +3ec41f7e1-bFRAfSveBhJNc-yQguXQ tools/control/web/tmpl/vd-pv.tmpl
    1.68 +3ec41f7e6v7MAKuV03qkOLX94vCGQg tools/control/web/tmpl/vd-vbdc.tmpl
    1.69 +3ec41f7eInaxQyoN0zPtGH6O1l0qaA tools/control/web/tmpl/vd-vbdcr.tmpl
    1.70 +3ec41f7e6vb1amZZa0IBdsPkPURj8Q tools/control/web/tmpl/vd-vbdd.tmpl
    1.71 +3ec41f7e678cIPHf9EjP5W6hVcssYA tools/control/web/tmpl/vd-vbdf.tmpl
    1.72 +3ec41f7e0PF1fM5WdSWxgtzcWTV__w tools/control/web/tmpl/vd-vbdfr.tmpl
    1.73 +3ec41f7eSe6rb0p4IxLU16czqIaTCA tools/control/web/tmpl/vd-vbdv.tmpl
    1.74 +3ec41f7eAYtNdK1Yy-RdGMCcSDNfBA tools/control/web/tmpl/vd-vdc.tmpl
    1.75 +3ec41f7eFxwTmuQ8wWMdvVQ5jtiKKA tools/control/web/tmpl/vd-vdcr.tmpl
    1.76 +3ec41f7e2osvqR4HUXCd9zUIIvUjaA tools/control/web/tmpl/vd-vdd.tmpl
    1.77 +3ec41f7e_TlFUNtMUUk1vivYx-4M2w tools/control/web/tmpl/vd-vddr.tmpl
    1.78 +3ec41f7eqey0GnU2CvlvO0OvX0Pmgg tools/control/web/tmpl/vd-vdr.tmpl
    1.79 +3ec41f7elad0gJQYmWPOikqUUKkMtA tools/control/web/tmpl/vd-vdrr.tmpl
    1.80 +3ec41f7eQ2vdTzXZAbxIWCosxZHJkg tools/control/web/tmpl/vd-vdv.tmpl
    1.81 +3ec41f7estxrL28BGG8obBnzt-SiAA tools/control/web/tmpl/vd.tmpl
    1.82 +3ec41f7e6SAwV8ebs9Be7zV2LV92oQ tools/control/web/tmpl/vdmenu.tmpl
    1.83 +3ec41f7ecn3uvsSrOVxKC8G8ACuulg tools/control/web/tmpl/xenofoot.def
    1.84 +3ec41f7ek1RffqN2yRUzSTkD5m1J6w tools/control/web/tmpl/xenohead.def
    1.85 +3ec41f7e1ZpfCsgQ2qRJBooBn_iRtA tools/control/web/tmpl/xenostyle.css
    1.86  3e4d00468-FN2VDeEHo96zxrMHK_mA tools/domain_builder/Makefile
    1.87  3e4d0046SPau_y0sw2WLJz8QkqNoRA tools/domain_builder/README
    1.88  3e4d0046bbdH0GsI9J_1Eb4ZQHfIiQ tools/domain_builder/dom0_defs.h
    1.89 @@ -17,21 +96,6 @@ 3e4d00468aE86IfyjfrJwYoxzM7pAw tools/dom
    1.90  3e71afadoAI0VvAGKebLpToVQxUKfQ tools/domain_builder/mynewdom
    1.91  3e4d0046VHhXwFuG5FK34AVxqd5A_A tools/domain_builder/newdom
    1.92  3e4d0046IBzDIeaMbQB-e2QB2ahbig tools/domain_builder/vifinit
    1.93 -3eb781edFwm_pW9FwnQACIe68viLOw tools/domctl/Makefile
    1.94 -3eb781fcTp_LPQwaot3SSSehkaf4eg tools/domctl/build.xml
    1.95 -3eb781fcXf-WczEdAhnTpWfbR55jqA tools/domctl/domctl
    1.96 -3eb781fcabCKRogwxJA3-jJKstw9Vg tools/domctl/domctl.xml
    1.97 -3eb781fcffCXkrcWLBxUTOfQFa3Saw tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Command.java
    1.98 -3eb781fcOLcVAcqnZOAikur6sAP0rA tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java
    1.99 -3eb781fcQuQVSKxKtp4fBgPOwx7DDw tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandHelp.java
   1.100 -3eb781fcRYdxK1HbjBX7r7VlO5PS0w tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java
   1.101 -3eb781fcbp9IAHTl40CoMavY1FNd_g tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandStart.java
   1.102 -3eb781fdRXSsyEre7LxCmPJMpB5BaQ tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandStop.java
   1.103 -3eb781fdX_thm9iHSxQ8vqQ0fL7Ncg tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Defaults.java
   1.104 -3eb781fdTWJr8RPdfuG20IC0CzYL2A tools/domctl/src/uk/ac/cam/cl/xeno/domctl/InetAddressPattern.java
   1.105 -3eb781fdA8LFQEYE2fXg1JDB9OceYA tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Main.java
   1.106 -3eb781fd_CgRvlaIBkJjxUSnuvCuHQ tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Settings.java
   1.107 -3eb781fdFDS4lap1-3ZVDtbKZfpVZA tools/domctl/src/uk/ac/cam/cl/xeno/domctl/StringPattern.java
   1.108  3eb781fdl4lXWYZzmqDDUAYhAThRqQ tools/internal/Makefile
   1.109  3eb781fdc539MQQm47rYRCCR3N5i-Q tools/internal/dom0_defs.h
   1.110  3eb781fdEYILyFg60YVBsWNqxWFf1g tools/internal/dom0_ops.h
   1.111 @@ -40,6 +104,7 @@ 3eb781fdKiQbgozBsgs_zzJQ9ubehw tools/int
   1.112  3eb781fdgbSkh2O6JQS-65Dz4n0ItQ tools/internal/xi_build.c
   1.113  3eb781fdW1SAyiaC4mTsXq_9fRHh-A tools/internal/xi_create.c
   1.114  3eb781fdcJ0fF7rWfzAOArW-x4-gwA tools/internal/xi_destroy.c
   1.115 +3ec43c5dmQxGDvgJJXbV1yLxT30Y1A tools/internal/xi_helper
   1.116  3eb83c3bZeECmphOKOJxSu4Lo1LpBw tools/internal/xi_list
   1.117  3eb781fd8oRfPgH7qTh7xvgmwD6NgA tools/internal/xi_start.c
   1.118  3eb781fd0Eo9K1jEFCSAVzO51i_ngg tools/internal/xi_stop.c
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/control/Makefile	Fri May 16 09:35:50 2003 +0000
     2.3 @@ -0,0 +1,35 @@
     2.4 +default: domctl xenctl
     2.5 +
     2.6 +install: install-domctl install-xenctl
     2.7 +
     2.8 +clean: clean-domctl clean-xenctl
     2.9 +
    2.10 +
    2.11 +
    2.12 +domctl: FORCE
    2.13 +	ant -buildfile build-dom.xml dist
    2.14 +
    2.15 +install-domctl: domctl
    2.16 +	cp domctl.jar domctl ../../../install/bin
    2.17 +	chmod 755 ../../../install/bin/domctl
    2.18 +
    2.19 +clean-domctl:
    2.20 +	ant -buildfile build-dom.xml clean
    2.21 +	rm -f domctl.jar
    2.22 +
    2.23 +
    2.24 +
    2.25 +xenctl: FORCE
    2.26 +	(cd web/tmpl; make)
    2.27 +	ant -buildfile build-xen.xml dist
    2.28 +
    2.29 +install-xenctl: xenctl
    2.30 +	-ant -buildfile build-xen.xml remove
    2.31 +	ant -buildfile build-xen.xml install
    2.32 +
    2.33 +clean-xenctl:
    2.34 +	(cd web/tmpl; make clean)
    2.35 +	ant -buildfile build-xen.xml clean
    2.36 +	rm -f xenctl.jar
    2.37 +
    2.38 +FORCE:
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/control/build-dom.xml	Fri May 16 09:35:50 2003 +0000
     3.3 @@ -0,0 +1,48 @@
     3.4 +<project name="domctl project" default="compile">
     3.5 +  <property name="src" location="src"/>
     3.6 +  <property name="build" location="build-dom"/>
     3.7 +
     3.8 +  <target name="init">
     3.9 +    <tstamp/>
    3.10 +    <mkdir dir="${build}"/>     
    3.11 +  </target>
    3.12 +
    3.13 +  <target name="compile" depends="init">
    3.14 +    <javac srcdir="${src}" destdir="${build}" debug="on">
    3.15 +      <include name="uk/ac/cam/cl/xeno/domctl/**"/>
    3.16 +    </javac>
    3.17 +  </target>
    3.18 +
    3.19 +  <target name="dist" depends="compile">
    3.20 +    <jar jarfile="domctl.jar"
    3.21 +         excludes="*~"
    3.22 +	 basedir="${build}">
    3.23 +      <fileset dir="${src}">
    3.24 +        <include name="uk/ac/cam/cl/xeno/domctl/**"/>
    3.25 +      </fileset>
    3.26 +      <fileset dir=".">
    3.27 +        <include name="build-domctl.xml"/>
    3.28 +        <include name="domctl"/>
    3.29 +        <include name="domctl.xml"/>
    3.30 +        <include name="Makefile"/>
    3.31 +      </fileset>
    3.32 +      <manifest>
    3.33 +        <attribute name="Built-By" value="${user.name}"/>
    3.34 +	<attribute name="Main-Class" value="uk.ac.cam.cl.xeno.domctl.Main"/>
    3.35 +	<attribute name="Sealed" value="true"/>
    3.36 +      </manifest>
    3.37 +    </jar>
    3.38 +  </target>
    3.39 +
    3.40 +  <target name="test" depends="compile">
    3.41 +    <java fork="true" classname="uk.ac.cam.cl.xeno.domctl.Main">
    3.42 +      <classpath>
    3.43 +        <pathelement path="${build}"/>
    3.44 +      </classpath>
    3.45 +    </java>
    3.46 +  </target>
    3.47 +
    3.48 +  <target name="clean">
    3.49 +    <delete dir="${build}"/>
    3.50 +  </target>
    3.51 +</project>
    3.52 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/control/build-xen.xml	Fri May 16 09:35:50 2003 +0000
     4.3 @@ -0,0 +1,506 @@
     4.4 +<!--
     4.5 +     General purpose build script for web applications and web services,
     4.6 +     including enhanced support for deploying directly to a Tomcat 4
     4.7 +     based server.
     4.8 +
     4.9 +     This build script assumes that the source code of your web application
    4.10 +     is organized into the following subdirectories underneath the source
    4.11 +     code directory from which you execute the build script:
    4.12 +
    4.13 +        docs                 Static documentation files to be copied to
    4.14 +                             the "docs" subdirectory of your distribution.
    4.15 +
    4.16 +        src                  Java source code (and associated resource files)
    4.17 +                             to be compiled to the "WEB-INF/classes"
    4.18 +                             subdirectory of your web applicaiton.
    4.19 +
    4.20 +        web                  Static HTML, JSP, and other content (such as
    4.21 +                             image files), including the WEB-INF subdirectory
    4.22 +                             and its configuration file contents.
    4.23 +
    4.24 +     $Id: build.xml.txt,v 1.7 2002/12/28 09:08:58 jfclere Exp $
    4.25 +-->
    4.26 +
    4.27 +
    4.28 +<!-- A "project" describes a set of targets that may be requested
    4.29 +     when Ant is executed.  The "default" attribute defines the
    4.30 +     target which is executed if no specific target is requested,
    4.31 +     and the "basedir" attribute defines the current working directory
    4.32 +     from which Ant executes the requested task.  This is normally
    4.33 +     set to the current working directory.
    4.34 +-->
    4.35 +
    4.36 +<project name="My Project" default="compile" basedir=".">
    4.37 +
    4.38 +
    4.39 +
    4.40 +<!-- ===================== Property Definitions =========================== -->
    4.41 +
    4.42 +
    4.43 +<!--
    4.44 +
    4.45 +  Each of the following properties are used in the build script.
    4.46 +  Values for these properties are set by the first place they are
    4.47 +  defined, from the following list:
    4.48 +
    4.49 +  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
    4.50 +
    4.51 +  * Definitions from a "build.properties" file in the top level
    4.52 +    source directory of this application.
    4.53 +
    4.54 +  * Definitions from a "build.properties" file in the developer's
    4.55 +    home directory.
    4.56 +
    4.57 +  * Default definitions in this build.xml file.
    4.58 +
    4.59 +  You will note below that property values can be composed based on the
    4.60 +  contents of previously defined properties.  This is a powerful technique
    4.61 +  that helps you minimize the number of changes required when your development
    4.62 +  environment is modified.  Note that property composition is allowed within
    4.63 +  "build.properties" files as well as in the "build.xml" script.
    4.64 +
    4.65 +-->
    4.66 +
    4.67 +  <property file="build.properties"/>
    4.68 +  <property file="${user.home}/build.properties"/>
    4.69 +
    4.70 +
    4.71 +<!-- ==================== File and Directory Names ======================== -->
    4.72 +
    4.73 +
    4.74 +<!--
    4.75 +
    4.76 +  These properties generally define file and directory names (or paths) that
    4.77 +  affect where the build process stores its outputs.
    4.78 +
    4.79 +  app.name             Base name of this application, used to
    4.80 +                       construct filenames and directories.
    4.81 +                       Defaults to "myapp".
    4.82 +
    4.83 +  app.path             Context path to which this application should be
    4.84 +                       deployed (defaults to "/" plus the value of the
    4.85 +                       "app.name" property).
    4.86 +
    4.87 +  app.version          Version number of this iteration of the application.
    4.88 +
    4.89 +  build.home           The directory into which the "prepare" and
    4.90 +                       "compile" targets will generate their output.
    4.91 +                       Defaults to "build".
    4.92 +
    4.93 +  catalina.home        The directory in which you have installed
    4.94 +                       a binary distribution of Tomcat 4.  This will
    4.95 +                       be used by the "deploy" target.
    4.96 +
    4.97 +  dist.home            The name of the base directory in which
    4.98 +                       distribution files are created.
    4.99 +                       Defaults to "dist".
   4.100 +
   4.101 +  manager.password     The login password of a user that is assigned the
   4.102 +                       "manager" role (so that he or she can execute
   4.103 +                       commands via the "/manager" web application)
   4.104 +
   4.105 +  manager.url          The URL of the "/manager" web application on the
   4.106 +                       Tomcat installation to which we will deploy web
   4.107 +                       applications and web services.
   4.108 +
   4.109 +  manager.username     The login username of a user that is assigned the
   4.110 +                       "manager" role (so that he or she can execute
   4.111 +                       commands via the "/manager" web application)
   4.112 +
   4.113 +-->
   4.114 +
   4.115 +  <property name="app.name"      value="myapp"/>
   4.116 +  <property name="app.path"      value="/${app.name}"/>
   4.117 +  <property name="app.version"   value="0.1-dev"/>
   4.118 +  <property name="build.home"    value="${basedir}/build"/>
   4.119 +  <property name="catalina.home" value="../../../.."/> <!-- UPDATE THIS! -->
   4.120 +  <property name="dist.home"     value="${basedir}/dist"/>
   4.121 +  <property name="docs.home"     value="${basedir}/docs"/>
   4.122 +<!--  <property name="manager.url"   value="http://localhost:8080/manager"/> -->
   4.123 +  <property name="src.home"      value="${basedir}/src"/>
   4.124 +  <property name="web.home"      value="${basedir}/web"/>
   4.125 +
   4.126 +
   4.127 +<!-- ================== Custom Ant Task Definitions ======================= -->
   4.128 +
   4.129 +
   4.130 +<!--
   4.131 +
   4.132 +  These properties define custom tasks for the Ant build tool that interact
   4.133 +  with the "/manager" web application installed with Tomcat 4.  Before they
   4.134 +  can be successfully utilized, you must perform the following steps:
   4.135 +
   4.136 +  - Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
   4.137 +    installation into the "lib" directory of your Ant installation.
   4.138 +
   4.139 +  - Create a "build.properties" file in your application's top-level
   4.140 +    source directory (or your user login home directory) that defines
   4.141 +    appropriate values for the "manager.password", "manager.url", and
   4.142 +    "manager.username" properties described above.
   4.143 +
   4.144 +  For more information about the Manager web application, and the functionality
   4.145 +  of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
   4.146 +
   4.147 +-->
   4.148 +
   4.149 +  <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
   4.150 +  <taskdef name="list"    classname="org.apache.catalina.ant.ListTask"/>
   4.151 +  <taskdef name="reload"  classname="org.apache.catalina.ant.ReloadTask"/>
   4.152 +  <taskdef name="remove"  classname="org.apache.catalina.ant.RemoveTask"/>
   4.153 +
   4.154 +
   4.155 +<!--  ==================== Compilation Control Options ==================== -->
   4.156 +
   4.157 +<!--
   4.158 +
   4.159 +  These properties control option settings on the Javac compiler when it
   4.160 +  is invoked using the <javac> task.
   4.161 +
   4.162 +  compile.debug        Should compilation include the debug option?
   4.163 +
   4.164 +  compile.deprecation  Should compilation include the deprecation option?
   4.165 +
   4.166 +  compile.optimize     Should compilation include the optimize option?
   4.167 +
   4.168 +-->
   4.169 +
   4.170 +  <property name="compile.debug"       value="true"/>
   4.171 +  <property name="compile.deprecation" value="false"/>
   4.172 +  <property name="compile.optimize"    value="true"/>
   4.173 +
   4.174 +
   4.175 +
   4.176 +<!-- ==================== External Dependencies =========================== -->
   4.177 +
   4.178 +
   4.179 +<!--
   4.180 +
   4.181 +  Use property values to define the locations of external JAR files on which
   4.182 +  your application will depend.  In general, these values will be used for
   4.183 +  two purposes:
   4.184 +  * Inclusion on the classpath that is passed to the Javac compiler
   4.185 +  * Being copied into the "/WEB-INF/lib" directory during execution
   4.186 +    of the "deploy" target.
   4.187 +
   4.188 +  Because we will automatically include all of the Java classes that Tomcat 4
   4.189 +  exposes to web applications, we will not need to explicitly list any of those
   4.190 +  dependencies.  You only need to worry about external dependencies for JAR
   4.191 +  files that you are going to include inside your "/WEB-INF/lib" directory.
   4.192 +
   4.193 +-->
   4.194 +
   4.195 +<!-- Dummy external dependency -->
   4.196 +<!--
   4.197 +  <property name="foo.jar"
   4.198 +           value="/path/to/foo.jar"/>
   4.199 +-->
   4.200 +
   4.201 +
   4.202 +<!-- ==================== Compilation Classpath =========================== -->
   4.203 +
   4.204 +<!--
   4.205 +
   4.206 +  Rather than relying on the CLASSPATH environment variable, Ant includes
   4.207 +  features that makes it easy to dynamically construct the classpath you
   4.208 +  need for each compilation.  The example below constructs the compile
   4.209 +  classpath to include the servlet.jar file, as well as the other components
   4.210 +  that Tomcat makes available to web applications automatically, plus anything
   4.211 +  that you explicitly added.
   4.212 +
   4.213 +-->
   4.214 +
   4.215 +  <path id="compile.classpath">
   4.216 +
   4.217 +    <!-- Include all JAR files that will be included in /WEB-INF/lib -->
   4.218 +    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
   4.219 +<!--
   4.220 +    <pathelement location="${foo.jar}"/>
   4.221 +-->
   4.222 +
   4.223 +    <!-- Include all elements that Tomcat exposes to applications -->
   4.224 +    <pathelement location="${catalina.home}/common/classes"/>
   4.225 +    <fileset dir="${catalina.home}/common/endorsed">
   4.226 +      <include name="*.jar"/>
   4.227 +    </fileset>
   4.228 +    <fileset dir="${catalina.home}/common/lib">
   4.229 +      <include name="*.jar"/>
   4.230 +    </fileset>
   4.231 +    <pathelement location="${catalina.home}/shared/classes"/>
   4.232 +    <fileset dir="${catalina.home}/shared/lib">
   4.233 +      <include name="*.jar"/>
   4.234 +    </fileset>
   4.235 +
   4.236 +  </path>
   4.237 +
   4.238 +
   4.239 +
   4.240 +<!-- ==================== All Target ====================================== -->
   4.241 +
   4.242 +<!--
   4.243 +
   4.244 +  The "all" target is a shortcut for running the "clean" target followed
   4.245 +  by the "compile" target, to force a complete recompile.
   4.246 +
   4.247 +-->
   4.248 +
   4.249 +  <target name="all" depends="clean,compile"
   4.250 +   description="Clean build and dist directories, then compile"/>
   4.251 +
   4.252 +
   4.253 +
   4.254 +<!-- ==================== Clean Target ==================================== -->
   4.255 +
   4.256 +<!--
   4.257 +
   4.258 +  The "clean" target deletes any previous "build" and "dist" directory,
   4.259 +  so that you can be ensured the application can be built from scratch.
   4.260 +
   4.261 +-->
   4.262 +
   4.263 +  <target name="clean"
   4.264 +   description="Delete old build and dist directories">
   4.265 +    <delete dir="${build.home}"/>
   4.266 +    <delete dir="${dist.home}"/>
   4.267 +  </target>
   4.268 +
   4.269 +
   4.270 +
   4.271 +<!-- ==================== Compile Target ================================== -->
   4.272 +
   4.273 +<!--
   4.274 +
   4.275 +  The "compile" target transforms source files (from your "src" directory)
   4.276 +  into object files in the appropriate location in the build directory.
   4.277 +  This example assumes that you will be including your classes in an
   4.278 +  unpacked directory hierarchy under "/WEB-INF/classes".
   4.279 +
   4.280 +-->
   4.281 +
   4.282 +  <target name="compile" depends="prepare"
   4.283 +   description="Compile Java sources">
   4.284 +
   4.285 +    <!-- Compile Java classes as necessary -->
   4.286 +    <mkdir    dir="${build.home}/WEB-INF/classes"/>
   4.287 +    <javac srcdir="${src.home}"
   4.288 +          destdir="${build.home}/WEB-INF/classes"
   4.289 +            debug="${compile.debug}"
   4.290 +      deprecation="${compile.deprecation}"
   4.291 +         optimize="${compile.optimize}">
   4.292 +        <classpath refid="compile.classpath"/>
   4.293 +    </javac>
   4.294 +
   4.295 +    <!-- Copy application resources -->
   4.296 +    <copy  todir="${build.home}/WEB-INF/classes">
   4.297 +      <fileset dir="${src.home}" excludes="**/*.java"/>
   4.298 +    </copy>
   4.299 +
   4.300 +  </target>
   4.301 +
   4.302 +
   4.303 +
   4.304 +<!-- ==================== Dist Target ===================================== -->
   4.305 +
   4.306 +
   4.307 +<!--
   4.308 +
   4.309 +  The "dist" target creates a binary distribution of your application
   4.310 +  in a directory structure ready to be archived in a tar.gz or zip file.
   4.311 +  Note that this target depends on two others:
   4.312 +
   4.313 +  * "compile" so that the entire web application (including external
   4.314 +    dependencies) will have been assembled
   4.315 +
   4.316 +  * "javadoc" so that the application Javadocs will have been created
   4.317 +
   4.318 +-->
   4.319 +
   4.320 +  <target name="dist" depends="compile,javadoc"
   4.321 +   description="Create binary distribution">
   4.322 +
   4.323 +    <!-- Copy documentation subdirectories -->
   4.324 +    <mkdir   dir="${dist.home}/docs"/>
   4.325 +    <copy    todir="${dist.home}/docs">
   4.326 +      <fileset dir="${docs.home}"/>
   4.327 +    </copy>
   4.328 +
   4.329 +    <!-- Create application JAR file -->
   4.330 +    <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
   4.331 +         basedir="${build.home}"/>
   4.332 +
   4.333 +    <!-- Copy additional files to ${dist.home} as necessary -->
   4.334 +
   4.335 +  </target>
   4.336 +
   4.337 +
   4.338 +
   4.339 +<!-- ==================== Install Target ================================== -->
   4.340 +
   4.341 +<!--
   4.342 +
   4.343 +  The "install" target tells the specified Tomcat 4 installation to dynamically
   4.344 +  install this web application and make it available for execution.  It does
   4.345 +  *not* cause the existence of this web application to be remembered across
   4.346 +  Tomcat restarts; if you restart the server, you will need to re-install all
   4.347 +  this web application.
   4.348 +
   4.349 +  If you have already installed this application, and simply want Tomcat to
   4.350 +  recognize that you have updated Java classes (or the web.xml file), use the
   4.351 +  "reload" target instead.
   4.352 +
   4.353 +  NOTE:  This target will only succeed if it is run from the same server that
   4.354 +  Tomcat is running on.
   4.355 +
   4.356 +  NOTE:  This is the logical opposite of the "remove" target.
   4.357 +
   4.358 +-->
   4.359 +
   4.360 +  <target name="install" depends="compile"
   4.361 +   description="Install application to servlet container">
   4.362 +
   4.363 +    <install url="${manager.url}"
   4.364 +        username="${manager.username}"
   4.365 +        password="${manager.password}"
   4.366 +            path="${app.path}"
   4.367 +             war="file://${build.home}"/>
   4.368 +
   4.369 +  </target>
   4.370 +
   4.371 +
   4.372 +<!-- ==================== Javadoc Target ================================== -->
   4.373 +
   4.374 +<!--
   4.375 +
   4.376 +  The "javadoc" target creates Javadoc API documentation for the Java
   4.377 +  classes included in your application.  Normally, this is only required
   4.378 +  when preparing a distribution release, but is available as a separate
   4.379 +  target in case the developer wants to create Javadocs independently.
   4.380 +
   4.381 +-->
   4.382 +
   4.383 +  <target name="javadoc" depends="compile"
   4.384 +   description="Create Javadoc API documentation">
   4.385 +
   4.386 +    <mkdir          dir="${dist.home}/docs/api"/>
   4.387 +    <javadoc sourcepath="${src.home}"
   4.388 +                destdir="${dist.home}/docs/api"
   4.389 +           packagenames="*">
   4.390 +      <classpath refid="compile.classpath"/>
   4.391 +    </javadoc>
   4.392 +
   4.393 +  </target>
   4.394 +
   4.395 +
   4.396 +
   4.397 +<!-- ====================== List Target =================================== -->
   4.398 +
   4.399 +<!--
   4.400 +
   4.401 +  The "list" target asks the specified Tomcat 4 installation to list the
   4.402 +  currently running web applications, either loaded at startup time or
   4.403 +  installed dynamically.  It is useful to determine whether or not the
   4.404 +  application you are currently developing has been installed.
   4.405 +
   4.406 +-->
   4.407 +
   4.408 +  <target name="list"
   4.409 +   description="List installed applications on servlet container">
   4.410 +
   4.411 +    <list    url="${manager.url}"
   4.412 +        username="${manager.username}"
   4.413 +        password="${manager.password}"/>
   4.414 +
   4.415 +  </target>
   4.416 +
   4.417 +
   4.418 +<!-- ==================== Prepare Target ================================== -->
   4.419 +
   4.420 +<!--
   4.421 +
   4.422 +  The "prepare" target is used to create the "build" destination directory,
   4.423 +  and copy the static contents of your web application to it.  If you need
   4.424 +  to copy static files from external dependencies, you can customize the
   4.425 +  contents of this task.
   4.426 +
   4.427 +  Normally, this task is executed indirectly when needed.
   4.428 +
   4.429 +-->
   4.430 +
   4.431 +  <target name="prepare">
   4.432 +
   4.433 +    <!-- Create build directories as needed -->
   4.434 +    <mkdir  dir="${build.home}"/>
   4.435 +    <mkdir  dir="${build.home}/WEB-INF"/>
   4.436 +    <mkdir  dir="${build.home}/WEB-INF/classes"/>
   4.437 +
   4.438 +
   4.439 +    <!-- Copy static content of this web application -->
   4.440 +    <copy todir="${build.home}">
   4.441 +      <fileset dir="${web.home}"/>
   4.442 +    </copy>
   4.443 +
   4.444 +    <!-- Copy external dependencies as required -->
   4.445 +    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
   4.446 +    <mkdir  dir="${build.home}/WEB-INF/lib"/>
   4.447 +<!--
   4.448 +    <copy todir="${build.home}/WEB-INF/lib" file="${foo.jar}"/>
   4.449 +-->
   4.450 +
   4.451 +    <!-- Copy static files from external dependencies as needed -->
   4.452 +    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
   4.453 +
   4.454 +  </target>
   4.455 +
   4.456 +
   4.457 +<!-- ==================== Reload Target =================================== -->
   4.458 +
   4.459 +<!--
   4.460 +
   4.461 +  The "reload" target tells the specified Tomcat 4 installation to dynamically
   4.462 +  reload this web application, to reflect changes in the underlying classes or
   4.463 +  the "web.xml" deployment descriptor.
   4.464 +
   4.465 +-->
   4.466 +
   4.467 +  <target name="reload" depends="compile"
   4.468 +   description="Reload application on servlet container">
   4.469 +
   4.470 +    <reload url="${manager.url}"
   4.471 +       username="${manager.username}"
   4.472 +       password="${manager.password}"
   4.473 +           path="${app.path}"/>
   4.474 +
   4.475 +  </target>
   4.476 +
   4.477 +
   4.478 +<!-- ==================== Remove Target =================================== -->
   4.479 +
   4.480 +<!--
   4.481 +
   4.482 +  The "remove" target tells the specified Tomcat 4 installation to dynamically
   4.483 +  remove this web application from service.
   4.484 +
   4.485 +  NOTE:  This is the logical opposite of the "install" target.
   4.486 +
   4.487 +-->
   4.488 +
   4.489 +  <target name="remove"
   4.490 +   description="Remove application on servlet container">
   4.491 +
   4.492 +    <remove url="${manager.url}"
   4.493 +       username="${manager.username}"
   4.494 +       password="${manager.password}"
   4.495 +           path="${app.path}"/>
   4.496 +
   4.497 +  </target>
   4.498 +
   4.499 +
   4.500 +  <target name="help">
   4.501 +    <echo>all      clean, them compile</echo>
   4.502 +    <echo>dist     create war file</echo>
   4.503 +    <echo>install  install application in servlet container</echo>
   4.504 +    <echo>list     list applications installed in servelet container</echo>
   4.505 +    <echo>reload   reload application in servlet container</echo>
   4.506 +    <echo>remove   dynamically remove web application</echo>
   4.507 +  </target>
   4.508 +
   4.509 +</project>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/control/build.properties	Fri May 16 09:35:50 2003 +0000
     5.3 @@ -0,0 +1,8 @@
     5.4 +catalina.home=/anfs/scratch/labyrinth/ach61/jakarta-tomcat-4.1.24
     5.5 +manager.url=http://mousetrap-0.xeno.cl.cam.ac.uk:80/manager
     5.6 +manager.username=hobbes
     5.7 +manager.password=tiger
     5.8 +compile.optimize=false
     5.9 +build.home=/anfs/scratch/labyrinth/ach61/xeno-clone/xeno.bk/tools/control/build-xen
    5.10 +app.name=xenctl
    5.11 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tools/control/domctl	Fri May 16 09:35:50 2003 +0000
     6.3 @@ -0,0 +1,33 @@
     6.4 +#!/bin/bash 
     6.5 +
     6.6 +if [ -z "$DEFAULTS_FILE" ] ; then DEFAULTS_FILE=domctl.xml ; fi
     6.7 +if [ -z "$DEFAULTS_PATH" ] ; then DEFAULTS_PATH=.:/etc:/var/lib/xen ; fi
     6.8 +if [ -z "$QUERY_DEV" ] ; then QUERY_DEV=eth0 ; fi
     6.9 +if [ -z "$IFCONFIG" ] ; then IFCONFIG=/sbin/ifconfig ; fi
    6.10 +if [ -z "$ROUTE" ] ; then ROUTE=/sbin/route ; fi
    6.11 +if [ -z "$JAVA" ] ; then JAVA=java ; fi
    6.12 +
    6.13 +if [ "$1" = "new" ] ; then
    6.14 +  if [ ! -x "$IFCONFIG" ]; then  
    6.15 +    echo Could not find executable $IFCONFIG
    6.16 +    exit 1
    6.17 +  fi
    6.18 +
    6.19 +  if [ ! -x "$ROUTE" ]; then
    6.20 +    echo Could not find executable $ROUTE
    6.21 +    exit 1
    6.22 +  fi
    6.23 +
    6.24 +  # Try to determine dom0 network settings to avoid hard-coding
    6.25 +  # particular machines in the defaults file
    6.26 +  LOCAL_IP=$(/sbin/ifconfig $QUERY_DEV | grep 'inet addr' | tr ':' '\t' | awk '{print $3}')
    6.27 +  LOCAL_MASK=$(/sbin/ifconfig $QUERY_DEV | grep 'Mask' | tr ':' '\t' | awk '{print $7}')
    6.28 +  LOCAL_ROUTE=$(/sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}')
    6.29 +fi
    6.30 +
    6.31 +
    6.32 +#ARGS="-DTEST -DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH -DLOCAL_IP=$LOCAL_IP -DLOCAL_MASK=$LOCAL_MASK -DLOCAL_ROUTE=$LOCAL_ROUTE"
    6.33 +ARGS="-DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH -DLOCAL_IP=$LOCAL_IP -DLOCAL_MASK=$LOCAL_MASK -DLOCAL_ROUTE=$LOCAL_ROUTE"
    6.34 +
    6.35 +
    6.36 +$JAVA $ARGS -jar $(dirname $0)/domctl.jar $*
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tools/control/domctl.xml	Fri May 16 09:35:50 2003 +0000
     7.3 @@ -0,0 +1,15 @@
     7.4 +<?xml version="1.0"?>
     7.5 +<domctl_defaults>
     7.6 +<xi_tools_dir>/usr/local/bin/</xi_tools_dir>
     7.7 +<domain_name>XenoLinux</domain_name>
     7.8 +<domain_size_kb>16000</domain_size_kb>
     7.9 +<domain_image>./image</domain_image>
    7.10 +<domain_vifs>1</domain_vifs>
    7.11 +<root_device>/dev/nfs</root_device>
    7.12 +<nw_ip>=+</nw_ip>
    7.13 +<nw_gw>=</nw_gw>
    7.14 +<nw_mask>=</nw_mask>
    7.15 +<nw_nfs_server>128.232.32.20</nw_nfs_server>
    7.16 +<nw_nfs_root>/usr/groups/srgboot/moonraider/roots/root+</nw_nfs_root>
    7.17 +<max_domain_number>10</max_domain_number>
    7.18 +</domctl_defaults>
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Command.java	Fri May 16 09:35:50 2003 +0000
     8.3 @@ -0,0 +1,76 @@
     8.4 +package uk.ac.cam.cl.xeno.domctl;
     8.5 +
     8.6 +public abstract class Command
     8.7 +{
     8.8 +  public abstract int doCommand(Defaults d, String args[]);
     8.9 +  public abstract String getName();			
    8.10 +  public abstract String getUsage();
    8.11 +  public abstract String getHelpText();
    8.12 +
    8.13 +  public String getStringParameter(String args[], char key, String def)
    8.14 +  {
    8.15 +    String r = getParameter (args, key);
    8.16 +    return (r == null) ? def : r;
    8.17 +  }
    8.18 +
    8.19 +  public int getIntParameter(String args[], char key, int def)
    8.20 +  {
    8.21 +    String r = getParameter (args, key);
    8.22 +    return (r == null) ? def : (Integer.parseInt (r));
    8.23 +  }
    8.24 +
    8.25 +  public boolean getFlagParameter(String args[], char key)
    8.26 +  {
    8.27 +    String r = getParameter (args, key);
    8.28 +    return (r == null) ? false : true;
    8.29 +  }
    8.30 +
    8.31 +  public String getParameter (String args[], char key)
    8.32 +  {
    8.33 +    int i;
    8.34 +    String result = null;
    8.35 +    for (i = 0; i < args.length; i ++)
    8.36 +      {
    8.37 +	if (args[i].startsWith("-" + key)) 
    8.38 +	  {
    8.39 +	    if (args[i].length() > 2)
    8.40 +	      {
    8.41 +		result = args[i].substring(2, args[i].length());
    8.42 +	      }
    8.43 +	    else
    8.44 +	      {
    8.45 +		result = "";
    8.46 +	      }
    8.47 +	  }
    8.48 +      }
    8.49 +    return result;
    8.50 +  }
    8.51 +
    8.52 +  public String reportXIError (String message, String cmd_array[])
    8.53 +  {
    8.54 +    StringBuffer sb = new StringBuffer();
    8.55 +    int i;
    8.56 +    sb.append (message + " using: ");
    8.57 +    for (i = 0; i < cmd_array.length; i ++) {
    8.58 +      sb.append (cmd_array[i] + " ");
    8.59 +    }
    8.60 +    sb.append (System.getProperty("line.separator"));
    8.61 +    return sb.toString();
    8.62 +  }
    8.63 +
    8.64 +  public String reportError (String message)
    8.65 +  {
    8.66 +    return (message);
    8.67 +  }
    8.68 +
    8.69 +  public String reportCommand (String cmd_array[])
    8.70 +  {
    8.71 +    StringBuffer sb = new StringBuffer();
    8.72 +    int i;
    8.73 +    for (i = 0; i < cmd_array.length; i ++) {
    8.74 +      sb.append (cmd_array[i] + " ");
    8.75 +    }
    8.76 +    sb.append (System.getProperty("line.separator"));
    8.77 +    return sb.toString();
    8.78 +  }
    8.79 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java	Fri May 16 09:35:50 2003 +0000
     9.3 @@ -0,0 +1,84 @@
     9.4 +package uk.ac.cam.cl.xeno.domctl;
     9.5 +
     9.6 +import java.io.*;
     9.7 +import java.net.*;
     9.8 +
     9.9 +public class CommandDestroy extends Command
    9.10 +{
    9.11 +  public int doCommand(Defaults d, String args[])
    9.12 +  {
    9.13 +    int domain_id = getIntParameter(args, 'n', 0);
    9.14 +    boolean force = getFlagParameter(args, 'f');
    9.15 +    int rc = 0;
    9.16 +    String output;
    9.17 +
    9.18 +    if (domain_id == 0) {
    9.19 +      System.err.println ("Expected -n<domain_id>");
    9.20 +      rc = -1;
    9.21 +      return rc;
    9.22 +    }
    9.23 +
    9.24 +    output = executeCommand(d, domain_id, force);
    9.25 +    if (output != null)
    9.26 +    {
    9.27 +      System.err.println(output);
    9.28 +      return -1;
    9.29 +    }
    9.30 +    return 0;
    9.31 +  }
    9.32 +
    9.33 +  public String
    9.34 +  executeCommand(Defaults d,
    9.35 +		 int domain_id,
    9.36 +		 boolean force)
    9.37 +  {
    9.38 +    Runtime r = Runtime.getRuntime ();
    9.39 +    String output = null;
    9.40 +
    9.41 +    try
    9.42 +      {
    9.43 +	Process destroy_p;
    9.44 +	String destroy_cmdarray[] = force ? new String[3] : new String[2];
    9.45 +	int destroy_rc;
    9.46 +	int idx = 0;
    9.47 +	destroy_cmdarray[idx++] = d.XIToolsDir + "xi_destroy";
    9.48 +	if (force) {
    9.49 +	  destroy_cmdarray[idx++] = "-f";
    9.50 +	}
    9.51 +	destroy_cmdarray[idx++] = "" + domain_id;
    9.52 +
    9.53 +	if (Settings.TEST) {
    9.54 +	  output += reportCommand (destroy_cmdarray);
    9.55 +	} else {
    9.56 +	  destroy_p = r.exec (destroy_cmdarray);
    9.57 +	  destroy_rc = destroy_p.waitFor ();
    9.58 +	  
    9.59 +	  if (destroy_rc != 0) {
    9.60 +	    return reportXIError ("Could not destroy domain", destroy_cmdarray);
    9.61 +	  }
    9.62 +	}
    9.63 +      }
    9.64 +    catch (Exception e) 
    9.65 +      {
    9.66 +	return ("Could not destroy domain (" + e + ")");
    9.67 +      }
    9.68 +
    9.69 +    return output;
    9.70 +  }
    9.71 +
    9.72 +  public String getName()
    9.73 +  {
    9.74 +    return "destroy";
    9.75 +  }
    9.76 +
    9.77 +  public String getUsage()
    9.78 +  {
    9.79 +    return "[-f] [-n<domain_id>]";
    9.80 +  }
    9.81 +
    9.82 +  public String getHelpText()
    9.83 +  {
    9.84 +    return
    9.85 +      "Destory the specified domain.  -f forcibly destroys it.";
    9.86 +  }
    9.87 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandHelp.java	Fri May 16 09:35:50 2003 +0000
    10.3 @@ -0,0 +1,58 @@
    10.4 +package uk.ac.cam.cl.xeno.domctl;
    10.5 +
    10.6 +public class CommandHelp extends Command
    10.7 +{
    10.8 +  public int doCommand(Defaults d, String args[])
    10.9 +  {
   10.10 +    if (args.length <= 1)
   10.11 +      {
   10.12 +	System.out.println ("Usage:");
   10.13 +	for (int i = 0; i < Main.commands.length; i ++) 
   10.14 +	  {
   10.15 +	    String name = Main.commands[i].getName ();
   10.16 +	    String usage = Main.commands[i].getUsage ();
   10.17 +	    while (name.length() < 12) name = name + " ";
   10.18 +	    System.out.println ("   " + name + usage);
   10.19 +	  }
   10.20 +      }
   10.21 +    else 
   10.22 +      {
   10.23 +	for (int i = 0; i < Main.commands.length; i ++) 
   10.24 +	  {
   10.25 +	    String name = Main.commands[i].getName ();
   10.26 +	    String usage = Main.commands[i].getUsage ();
   10.27 +	    if (name.equals (args[1]))
   10.28 +	      {
   10.29 +		doHelpFor (Main.commands[i]);
   10.30 +		break;
   10.31 +	      }
   10.32 +	  }
   10.33 +      }
   10.34 +
   10.35 +    System.out.println ("");
   10.36 +    return 0;
   10.37 +  }
   10.38 +
   10.39 +  public int doHelpFor (Command c)
   10.40 +  {
   10.41 +    System.out.println ("domctl " + c.getName() + " " + c.getUsage());
   10.42 +    System.out.println ();
   10.43 +    System.out.println (c.getHelpText ());
   10.44 +    return 0;
   10.45 +  }
   10.46 +
   10.47 +  public String getName()
   10.48 +  {
   10.49 +    return "help";
   10.50 +  }
   10.51 +
   10.52 +  public String getUsage()
   10.53 +  {
   10.54 +    return "";
   10.55 +  }
   10.56 +
   10.57 +  public String getHelpText()
   10.58 +  {
   10.59 +    return "This message";
   10.60 +  }  
   10.61 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandList.java	Fri May 16 09:35:50 2003 +0000
    11.3 @@ -0,0 +1,139 @@
    11.4 +package uk.ac.cam.cl.xeno.domctl;
    11.5 +
    11.6 +import java.io.*;
    11.7 +import java.net.*;
    11.8 +import java.util.Vector;
    11.9 +import java.util.StringTokenizer;
   11.10 +
   11.11 +public class CommandList extends Command
   11.12 +{
   11.13 +  public int doCommand(Defaults d, String args[])
   11.14 +  {
   11.15 +    Domain [] domains = executeCommand(d);
   11.16 +
   11.17 +    for (int loop = 0; loop < domains.length; loop++)
   11.18 +    {
   11.19 +      System.out.println ("id: " + domains[loop].id + 
   11.20 +			  " (" + domains[loop].name+ ")");
   11.21 +      System.out.println ("  processor: " + domains[loop].processor);
   11.22 +      System.out.println ("  has cpu: " + domains[loop].cpu);
   11.23 +      System.out.println ("  state: " + domains[loop].nstate + " " +
   11.24 +			  domains[loop].state);
   11.25 +      System.out.println ("  mcu advance: " + domains[loop].mcu);
   11.26 +      System.out.println ("  total pages: " + domains[loop].pages);
   11.27 +    }
   11.28 +
   11.29 +    return 0;
   11.30 +  }
   11.31 +
   11.32 +  public Domain[]
   11.33 +  executeCommand(Defaults d)
   11.34 +  {
   11.35 +    Runtime r = Runtime.getRuntime ();
   11.36 +    int rc = 0;
   11.37 +    Vector v = new Vector();
   11.38 +    String outline;
   11.39 +    BufferedReader in;
   11.40 +    Domain[] array;
   11.41 +    String output = null;
   11.42 +
   11.43 +    try
   11.44 +      {
   11.45 +	Process start_p;
   11.46 +	String start_cmdarray[] = new String[1];
   11.47 +	int start_rc;
   11.48 +	start_cmdarray[0] = d.XIToolsDir + "xi_list";
   11.49 +
   11.50 +	if (Settings.TEST) {
   11.51 +	  output += reportCommand (start_cmdarray);
   11.52 +	} else {
   11.53 +	  start_p = r.exec (start_cmdarray);
   11.54 +	  start_rc = start_p.waitFor ();
   11.55 +	  if (start_rc != 0) {
   11.56 +	    return null;
   11.57 +	  }
   11.58 +	  
   11.59 +	  in = new BufferedReader(
   11.60 +		   new InputStreamReader(start_p.getInputStream()));
   11.61 +    
   11.62 +	  outline = in.readLine();
   11.63 +	  while (outline != null)
   11.64 +	  {
   11.65 +	    Domain domain = new Domain();
   11.66 +
   11.67 +	    StringTokenizer st = new StringTokenizer(outline);
   11.68 +	    if (st.hasMoreTokens())
   11.69 +	    {
   11.70 +	      domain.id = Integer.parseInt(st.nextToken());
   11.71 +	    }
   11.72 +	    if (st.hasMoreTokens())
   11.73 +	    {
   11.74 +	      domain.processor = Integer.parseInt(st.nextToken());
   11.75 +	    }
   11.76 +	    if (st.hasMoreTokens())
   11.77 +	    {
   11.78 +	      if (st.nextToken().equals("1"))
   11.79 +	      {
   11.80 +		domain.cpu = true;
   11.81 +	      }
   11.82 +	      else
   11.83 +	      {
   11.84 +		domain.cpu = false;
   11.85 +	      }
   11.86 +	    }
   11.87 +	    if (st.hasMoreTokens())
   11.88 +	    {
   11.89 +	      domain.nstate = Integer.parseInt(st.nextToken());
   11.90 +	    }
   11.91 +	    if (st.hasMoreTokens())
   11.92 +	    {
   11.93 +	      domain.state = st.nextToken().toLowerCase();
   11.94 +	    }
   11.95 +	    if (st.hasMoreTokens())
   11.96 +	    {
   11.97 +	      domain.mcu = Integer.parseInt(st.nextToken());
   11.98 +	    }
   11.99 +	    if (st.hasMoreTokens())
  11.100 +	    {
  11.101 +	      domain.pages = Integer.parseInt(st.nextToken());
  11.102 +	    }
  11.103 +	    if (st.hasMoreTokens())
  11.104 +	    {
  11.105 +	      domain.name = st.nextToken();
  11.106 +	    }
  11.107 +	    
  11.108 +	    v.add(domain);
  11.109 +
  11.110 +	    outline = in.readLine();
  11.111 +	  }
  11.112 +
  11.113 +	}
  11.114 +      }
  11.115 +    catch (Exception e) 
  11.116 +      {
  11.117 +	System.err.println ("Could not get domain list(" + e + ")");
  11.118 +	e.printStackTrace ();
  11.119 +	return null;
  11.120 +      }
  11.121 +
  11.122 +    array = new Domain[v.size()];
  11.123 +    v.toArray(array);
  11.124 +    return array;
  11.125 +  }
  11.126 +
  11.127 +  public String getName()
  11.128 +  {
  11.129 +    return "list";
  11.130 +  }
  11.131 +
  11.132 +  public String getUsage()
  11.133 +  {
  11.134 +    return "";
  11.135 +  }
  11.136 +
  11.137 +  public String getHelpText()
  11.138 +  {
  11.139 +    return
  11.140 +      "List domain information";
  11.141 +  }
  11.142 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java	Fri May 16 09:35:50 2003 +0000
    12.3 @@ -0,0 +1,291 @@
    12.4 +package uk.ac.cam.cl.xeno.domctl;
    12.5 +
    12.6 +import java.io.*;
    12.7 +import java.util.zip.*;
    12.8 +import java.net.*;
    12.9 +
   12.10 +public class CommandNew extends Command
   12.11 +{
   12.12 +  public int doCommand(Defaults d, String args[])
   12.13 +  {
   12.14 +    String name = getStringParameter(args, 'n', d.domainName);
   12.15 +    int size = getIntParameter(args, 'k', d.domainSizeKB);
   12.16 +    String image = getStringParameter(args, 'i', d.domainImage);
   12.17 +    String initrd = getStringParameter (args, 'r', d.domainInitRD);
   12.18 +    int vifs = getIntParameter(args, 'v', d.domainVIFs);
   12.19 +    String bargs = getStringParameter (args, 'a', d.args) + " ";
   12.20 +    String root_dev = getStringParameter (args, 'd', d.rootDevice);
   12.21 +    String nfs_root_path = getStringParameter (args, 'f', d.NWNFSRoot);
   12.22 +    String nw_ip = getStringParameter (args, '4', d.NWIP);
   12.23 +    String nw_gw = getStringParameter (args, 'g', d.NWGW);
   12.24 +    String nw_mask = getStringParameter (args, 'm', d.NWMask);
   12.25 +    String nw_nfs_server = getStringParameter (args, 's', d.NWNFSServer);
   12.26 +    String nw_host = getStringParameter (args, 'h', d.NWHost);
   12.27 +    String output;
   12.28 +
   12.29 +    d.describe ();
   12.30 +
   12.31 +    output = executeCommand(d, name, size, image, initrd, vifs,
   12.32 +			    bargs, root_dev, nfs_root_path,
   12.33 +			    nw_ip, nw_gw, nw_mask, nw_nfs_server, nw_host);
   12.34 +    if (output != null)
   12.35 +    {
   12.36 +      System.err.println(output);
   12.37 +      return -1;
   12.38 +    }
   12.39 +    return 0;
   12.40 +  }
   12.41 +
   12.42 +  public String
   12.43 +  executeCommand(Defaults d,
   12.44 +		 String name,
   12.45 +		 int size,
   12.46 +		 String image,
   12.47 +		 String initrd,
   12.48 +		 int vifs,
   12.49 +		 String bargs,
   12.50 +		 String root_dev,
   12.51 +		 String nfs_root_path,
   12.52 +		 String nw_ip,
   12.53 +		 String nw_gw,
   12.54 +		 String nw_mask,
   12.55 +		 String nw_nfs_server,
   12.56 +		 String nw_host)
   12.57 +  {
   12.58 +    Runtime r = Runtime.getRuntime ();
   12.59 +    int domain_id = -1;
   12.60 +    BufferedReader br;
   12.61 +    int idx;
   12.62 +    int i;
   12.63 +    File image_tmp = null;
   12.64 +    File initrd_tmp = null;
   12.65 +    String domain_ip = "";
   12.66 +    String output = "";
   12.67 +
   12.68 +    String create_cmdarray[] = new String[3];
   12.69 +    String build_cmdarray[] = new String[6];
   12.70 +    String vifinit_cmdarray[] = new String[4];
   12.71 +
   12.72 +    try
   12.73 +      {
   12.74 +	try
   12.75 +	  {
   12.76 +	    /* Some initial sanity checks */
   12.77 +	    if (root_dev.equals ("/dev/nfs") && (vifs == 0)) {
   12.78 +	      return reportError ("Cannot use NFS root without VIFs configured");
   12.79 +	    }
   12.80 +	    
   12.81 +	    /* Uncompress the image and initrd */
   12.82 +	    if (image.endsWith (".gz")) {
   12.83 +	      image_tmp = getUncompressed ("xen-image-", image);
   12.84 +	      image = image_tmp.getPath ();
   12.85 +	    }
   12.86 +	    
   12.87 +	    if (initrd != null && initrd.endsWith (".gz")) {
   12.88 +	      initrd_tmp = getUncompressed ("xen-initrd-", initrd);
   12.89 +	      initrd = initrd_tmp.getPath ();
   12.90 +	    }
   12.91 +	    
   12.92 +	    /* Create a new empty domain */
   12.93 +	    Process create_p;
   12.94 +	    int create_rc;
   12.95 +	    create_cmdarray[0] = d.XIToolsDir + "xi_create";
   12.96 +	    create_cmdarray[1] = "" + size;
   12.97 +	    create_cmdarray[2] = name;
   12.98 +	    if (Settings.TEST) {
   12.99 +	      reportCommand (create_cmdarray);
  12.100 +	      domain_id=1;
  12.101 +	      create_rc=0;
  12.102 +	    } else {
  12.103 +	      create_p = r.exec (create_cmdarray);
  12.104 +	      br = new BufferedReader (
  12.105 +			   new InputStreamReader (create_p.getInputStream ()));
  12.106 +	      domain_id = Integer.parseInt (br.readLine ());
  12.107 +	      create_rc = create_p.waitFor ();
  12.108 +	    }
  12.109 +	    
  12.110 +	    if (create_rc != 0) {
  12.111 +	      return reportXIError("Failed to create domain", create_cmdarray);
  12.112 +	    } else if (domain_id > d.MaxDomainNumber) {
  12.113 +	      return reportError ("Cannot configure more than " + 
  12.114 +				  d.MaxDomainNumber + " domains");
  12.115 +	    }
  12.116 +	    
  12.117 +	    /* Set up boot parameters to pass to xi_build. */
  12.118 +	    if (root_dev.equals ("/dev/nfs")) {
  12.119 +	      if (vifs == 0) {
  12.120 +		return reportError ("Cannot use NFS root without VIFs configured");
  12.121 +	      }
  12.122 +	      if (nfs_root_path == null) {
  12.123 +		return reportError ("No NFS root specified");
  12.124 +	      }
  12.125 +	      if (nw_nfs_server == null) {
  12.126 +		return reportError ("No NFS server specified");
  12.127 +	      }
  12.128 +	      bargs = (bargs + 
  12.129 +		       " root=/dev/nfs " +
  12.130 +		       "nfsroot=" + StringPattern.parse(nfs_root_path).resolve(domain_id) +
  12.131 +		       " ");
  12.132 +	    } else {
  12.133 +	      bargs = (bargs + 
  12.134 +		       " root=" + StringPattern.parse(root_dev).resolve(domain_id) +
  12.135 +		       " ");
  12.136 +	      
  12.137 +	    }
  12.138 +	    
  12.139 +	    if (vifs > 0) {
  12.140 +	      domain_ip = InetAddressPattern.parse(nw_ip).resolve(domain_id);
  12.141 +	      if (nw_host == null) {
  12.142 +		try {
  12.143 +		  nw_host = InetAddress.getByName(domain_ip).getHostName();
  12.144 +		} catch (UnknownHostException uhe) {
  12.145 +		  nw_host = "" + nw_ip;
  12.146 +		}
  12.147 +		
  12.148 +	      }
  12.149 +	      bargs = ("ip=" + domain_ip +
  12.150 +		       ":" + ((nw_nfs_server == null) ? "" : (InetAddressPattern.parse(nw_nfs_server).resolve(domain_id))) +
  12.151 +		       ":" + ((nw_gw == null) ? "" : (InetAddressPattern.parse(nw_gw).resolve(domain_id))) + 
  12.152 +		       ":" + ((nw_mask == null) ? "" : InetAddressPattern.parse(nw_mask).resolve(domain_id)) +
  12.153 +		       ":" + ((nw_host == null) ? "" : nw_host) + 
  12.154 +		       ":eth0:off " + bargs);
  12.155 +	    }
  12.156 +	    
  12.157 +	    /* Build the domain */
  12.158 +	    Process build_p;
  12.159 +	    int build_rc;
  12.160 +	    idx = 0;
  12.161 +	    for (i = 0; i < build_cmdarray.length; i ++) 
  12.162 +	      build_cmdarray[i] = "";
  12.163 +	    build_cmdarray[idx ++] = d.XIToolsDir + "xi_build";
  12.164 +	    build_cmdarray[idx ++] = "" + domain_id;
  12.165 +	    build_cmdarray[idx ++] = "" + image;
  12.166 +	    build_cmdarray[idx ++] = "" + vifs;
  12.167 +	    if (initrd != null) build_cmdarray[idx ++] = "initrd=" + initrd;
  12.168 +	    build_cmdarray[idx ++] = "" + bargs;
  12.169 +	    System.out.println ("Build args: " + bargs);
  12.170 +	    if (Settings.TEST) {
  12.171 +	      reportCommand (build_cmdarray);
  12.172 +	      build_rc = 0;
  12.173 +	    } else {
  12.174 +	      build_p = r.exec (build_cmdarray);
  12.175 +	      build_rc = build_p.waitFor ();
  12.176 +	    }
  12.177 +	    
  12.178 +	    if (build_rc != 0) {
  12.179 +	      return reportXIError ("Failed to build domain", build_cmdarray);
  12.180 +	    }
  12.181 +	    
  12.182 +	    /* Set up the first VIF if necessary */
  12.183 +	    if (vifs > 0) {
  12.184 +	      Process vifinit_p;
  12.185 +	      int vifinit_rc;
  12.186 +	      vifinit_cmdarray[0] = d.XIToolsDir + "xi_vifinit";
  12.187 +	      vifinit_cmdarray[1] = "" + domain_id;
  12.188 +	      vifinit_cmdarray[2] = "0";
  12.189 +	      vifinit_cmdarray[3] = domain_ip;
  12.190 +	      if (Settings.TEST) {
  12.191 +		reportCommand (vifinit_cmdarray);
  12.192 +		vifinit_rc = 0;
  12.193 +	      } else {
  12.194 +		vifinit_p = r.exec (vifinit_cmdarray);
  12.195 +		vifinit_rc = vifinit_p.waitFor ();
  12.196 +	      }
  12.197 +	      
  12.198 +	      if (vifinit_rc != 0) {
  12.199 +		return reportXIError ("Failed to initialise VIF 0", vifinit_cmdarray);
  12.200 +	      }
  12.201 +	    }
  12.202 +	  } finally {
  12.203 +	    if (image_tmp != null) image_tmp.delete();
  12.204 +	    if (initrd_tmp != null) initrd_tmp.delete ();
  12.205 +	  }
  12.206 +      }
  12.207 +    catch (Exception e) 
  12.208 +      {
  12.209 +	e.printStackTrace();
  12.210 +	return ("Could not create new domain (" + e + ")");
  12.211 +      }
  12.212 +
  12.213 +    output += "\n<b>domain created</b> with arguments:<br>\n";
  12.214 +    for (i = 0; i < create_cmdarray.length; i ++) 
  12.215 +      output += create_cmdarray[i] + "<br>";
  12.216 +    output += "\n<b>domain built</b> with arguments:<br>\n";
  12.217 +    for (i = 0; i < build_cmdarray.length; i ++) 
  12.218 +      output += build_cmdarray[i] + "<br>";
  12.219 +    output += "\n<b>VIF 0 initialized</b> with arguments:<br>\n";
  12.220 +    for (i = 0; i < vifinit_cmdarray.length; i ++) 
  12.221 +      output += vifinit_cmdarray[i] + "<br>";
  12.222 +
  12.223 +    return output;
  12.224 +  }
  12.225 +
  12.226 +  File getUncompressed (String prefix, String original) throws IOException {
  12.227 +    FileOutputStream fos;
  12.228 +    GZIPInputStream gis;
  12.229 +    File result;
  12.230 +    byte buffer[] = new byte[1024];
  12.231 +    int l;
  12.232 +    
  12.233 +    result = File.createTempFile (prefix, null);
  12.234 +    
  12.235 +    try {
  12.236 +      fos = new FileOutputStream (result);
  12.237 +      gis = new GZIPInputStream (new FileInputStream (original));
  12.238 +      while ((l = gis.read(buffer, 0, buffer.length)) != -1) {
  12.239 +	fos.write (buffer, 0, l);
  12.240 +      }	  
  12.241 +    } catch (IOException ioe) {
  12.242 +      result.delete ();
  12.243 +      throw ioe;
  12.244 +    }
  12.245 +
  12.246 +    return result;
  12.247 +  }
  12.248 +
  12.249 +  public String getName()
  12.250 +  {
  12.251 +    return "new";
  12.252 +  }
  12.253 +
  12.254 +  public String getUsage()
  12.255 +  {
  12.256 +    return "[-n<domain_name>] [-k<size>] [-i<image>] [-v<num_vifs>] [-r<initrd>] [-d<root_device>] [-f<nfs_root>] [-s<nfs_boot_server>] [-4<ipv4_boot_address>] [-g<ipv4_boot_gateway>] [-m<ipv4_boot_netmask>] [-h<hostname>] [-a<args>]";
  12.257 +  }
  12.258 +
  12.259 +  public String getHelpText()
  12.260 +  {
  12.261 +    return
  12.262 +      "Create a new domain.  Note that most of the parameters will assume\n" +
  12.263 +      "default values: it should not be necessary to specify them all. See\n" +
  12.264 +      "domctl.xml for the current default settings.\n" +
  12.265 +      "\n" +
  12.266 +      "General command line options:\n" +
  12.267 +      "  -n  Domain name                              domain_name\n" +
  12.268 +      "  -k  Domain size (kb)                         domain_size_kb\n" +
  12.269 +      "  -i  Domain image name                        domain_image\n" +
  12.270 +      "  -v  Number of VIFs                           domain_vifs\n" +
  12.271 +      "  -r  InitRD (if required)                     domain_init_rd\n" +
  12.272 +      "  -d  Root device (e.g /dev/nfs, /dev/hda3)    root_device\n" +
  12.273 +      "  -a  Additional boot parameters\n" +
  12.274 +      "\n" +
  12.275 +      "Networking options:\n" +
  12.276 +      "  -f  NFS root (if /dev/nfs specified)         nw_nfs_root\n" +
  12.277 +      "  -s  NFS server                               nw_nfs_server\n" +
  12.278 +      "  -4  Domain IPv4 address                      nw_ip\n" +
  12.279 +      "  -g  Domain gateway                           nw_gw\n" +
  12.280 +      "  -m  Domain net mask                          nw_mask\n" +
  12.281 +      "  -h  Domain hostname                          nw_host\n" +
  12.282 +      "\n" +
  12.283 +      "Parameters to -d, -f, -4, -g, -h can be specified as patterns into\n" +
  12.284 +      "which the allocated domain ID will be incorporated.  e.g.  for\n" +
  12.285 +      "domain 1 patterns would expand as follows:\n" +
  12.286 +      "\n" +
  12.287 +      "  /dev/hda+       /dev/hda1\n" +
  12.288 +      "  /dev/hda7+      /dev/hda8\n" +
  12.289 +      "  128.232.8.50+   128.232.8.51\n" +
  12.290 +      "\n" +
  12.291 +      "Additionally, patterns for -4 -g -m can include an = which is\n" + 
  12.292 +      "expanded to the corresponding setting from the calling domain.\n";
  12.293 +  }
  12.294 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandStart.java	Fri May 16 09:35:50 2003 +0000
    13.3 @@ -0,0 +1,76 @@
    13.4 +package uk.ac.cam.cl.xeno.domctl;
    13.5 +
    13.6 +import java.io.*;
    13.7 +import java.net.*;
    13.8 +
    13.9 +public class CommandStart extends Command
   13.10 +{
   13.11 +  public int doCommand(Defaults d, String args[])
   13.12 +  {
   13.13 +    int domain_id = getIntParameter(args, 'n', 0);
   13.14 +    String output;
   13.15 +
   13.16 +    if (domain_id == 0) {
   13.17 +      System.err.println ("Expected -n<domain_id>");
   13.18 +      return -1;
   13.19 +    }
   13.20 +
   13.21 +    output = executeCommand(d, domain_id);
   13.22 +    if (output != null)
   13.23 +    {
   13.24 +      System.err.println(output);
   13.25 +      return -1;
   13.26 +    }
   13.27 +
   13.28 +    return 0;
   13.29 +  }
   13.30 +
   13.31 +
   13.32 +  public String
   13.33 +  executeCommand(Defaults d, int domain_id)
   13.34 +  {
   13.35 +    Runtime r = Runtime.getRuntime ();
   13.36 +    String output = null;
   13.37 +
   13.38 +    try
   13.39 +      {
   13.40 +	Process start_p;
   13.41 +	String start_cmdarray[] = new String[2];
   13.42 +	int start_rc;
   13.43 +	start_cmdarray[0] = d.XIToolsDir + "xi_start";
   13.44 +	start_cmdarray[1] = "" + domain_id;
   13.45 +
   13.46 +	if (Settings.TEST) {
   13.47 +	  output += reportCommand (start_cmdarray);
   13.48 +	} else {
   13.49 +	  start_p = r.exec (start_cmdarray);
   13.50 +	  start_rc = start_p.waitFor ();
   13.51 +	  if (start_rc != 0) {
   13.52 +	    return reportXIError ("Could not start domain", start_cmdarray);
   13.53 +	  }
   13.54 +	}
   13.55 +      }
   13.56 +    catch (Exception e) 
   13.57 +      {
   13.58 +	return ("Could not start new domain (" + e + ")");
   13.59 +      }
   13.60 +
   13.61 +    return output;
   13.62 +  }
   13.63 +
   13.64 +  public String getName()
   13.65 +  {
   13.66 +    return "start";
   13.67 +  }
   13.68 +
   13.69 +  public String getUsage()
   13.70 +  {
   13.71 +    return "[-n<domain_id>]";
   13.72 +  }
   13.73 +
   13.74 +  public String getHelpText()
   13.75 +  {
   13.76 +    return
   13.77 +      "Start the specified domain.";
   13.78 +  }
   13.79 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/CommandStop.java	Fri May 16 09:35:50 2003 +0000
    14.3 @@ -0,0 +1,76 @@
    14.4 +package uk.ac.cam.cl.xeno.domctl;
    14.5 +
    14.6 +import java.io.*;
    14.7 +import java.net.*;
    14.8 +
    14.9 +public class CommandStop extends Command
   14.10 +{
   14.11 +  public int doCommand(Defaults d, String args[])
   14.12 +  {
   14.13 +    int domain_id = getIntParameter(args, 'n', 0);
   14.14 +    String output;
   14.15 +
   14.16 +    if (domain_id == 0) {
   14.17 +      System.err.println ("Expected -n<domain_id>");
   14.18 +      return -1;
   14.19 +    }
   14.20 +
   14.21 +    output = executeCommand(d, domain_id);
   14.22 +    if (output != null)
   14.23 +    {
   14.24 +      System.err.println(output);
   14.25 +      return -1;
   14.26 +    }
   14.27 +    return 0;
   14.28 +  }
   14.29 +
   14.30 +  public String
   14.31 +  executeCommand(Defaults d,
   14.32 +		 int domain_id)
   14.33 +  {
   14.34 +    Runtime r = Runtime.getRuntime ();
   14.35 +    String output = null;
   14.36 +
   14.37 +    try
   14.38 +      {
   14.39 +	Process stop_p;
   14.40 +	String stop_cmdarray[] = new String[2];
   14.41 +	int stop_rc;
   14.42 +	stop_cmdarray[0] = d.XIToolsDir + "xi_stop";
   14.43 +	stop_cmdarray[1] = "" + domain_id;
   14.44 +
   14.45 +	if (Settings.TEST) {
   14.46 +	  output += reportCommand (stop_cmdarray);
   14.47 +	} else {
   14.48 +	  stop_p = r.exec (stop_cmdarray);
   14.49 +	  stop_rc = stop_p.waitFor ();
   14.50 +	  
   14.51 +	  if (stop_rc != 0) {
   14.52 +	    return reportXIError ("Could not stop domain", stop_cmdarray);
   14.53 +	  }
   14.54 +	}
   14.55 +      }
   14.56 +    catch (Exception e) 
   14.57 +      {
   14.58 +	return ("Could not stop new domain (" + e + ")");
   14.59 +      }
   14.60 +
   14.61 +    return output;
   14.62 +  }
   14.63 +
   14.64 +  public String getName()
   14.65 +  {
   14.66 +    return "stop";
   14.67 +  }
   14.68 +
   14.69 +  public String getUsage()
   14.70 +  {
   14.71 +    return "[-n<domain_id>]";
   14.72 +  }
   14.73 +
   14.74 +  public String getHelpText()
   14.75 +  {
   14.76 +    return
   14.77 +      "Stop the specified domain.";
   14.78 +  }
   14.79 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Defaults.java	Fri May 16 09:35:50 2003 +0000
    15.3 @@ -0,0 +1,196 @@
    15.4 +package uk.ac.cam.cl.xeno.domctl;
    15.5 +
    15.6 +import java.net.InetAddress;
    15.7 +import java.io.*;
    15.8 +import org.xml.sax.*;
    15.9 +import org.xml.sax.helpers.*;
   15.10 +
   15.11 +/* these values are used in xenctl & domctl, so they need to be public */
   15.12 +
   15.13 +public class Defaults
   15.14 +{
   15.15 +  public String domainName;
   15.16 +
   15.17 +  public int domainSizeKB;
   15.18 +  public String domainImage;
   15.19 +  public String domainInitRD;
   15.20 +  public int domainVIFs;
   15.21 +
   15.22 +  public String rootDevice;
   15.23 +
   15.24 +  public String NWIP;
   15.25 +  public String NWGW;
   15.26 +  public String NWMask;
   15.27 +  public String NWHost;
   15.28 +
   15.29 +  public String NWNFSServer;
   15.30 +  public String NWNFSRoot;
   15.31 +
   15.32 +  int MaxDomainNumber = Integer.MAX_VALUE;
   15.33 +  String args = "";
   15.34 +
   15.35 +  public String XIToolsDir = "";
   15.36 +
   15.37 +  /***********************************************************************/
   15.38 +
   15.39 +  public Defaults ()
   15.40 +  {
   15.41 +    File f = Settings.getDefaultsFile ();
   15.42 +
   15.43 +    if (f == null)
   15.44 +    {
   15.45 +      return;
   15.46 +    }
   15.47 +
   15.48 +    try
   15.49 +      {
   15.50 +	XMLReader xr = new org.apache.crimson.parser.XMLReaderImpl();
   15.51 +	Handler handler = new Handler ();
   15.52 +	xr.setContentHandler (handler);
   15.53 +	xr.setErrorHandler (handler);
   15.54 +	xr.parse (new InputSource(new FileReader (f)));
   15.55 +      }
   15.56 +    catch (Exception e) 
   15.57 +      {
   15.58 +	System.err.println ("Could not read defaults file " + f +
   15.59 +			    "\nException: " + e);
   15.60 +	e.printStackTrace();
   15.61 +	return;
   15.62 +      }
   15.63 +  }
   15.64 +
   15.65 +  public void describe () {
   15.66 +    System.out.println ("Domain defaults:");
   15.67 +    System.out.println ("   name            " + domainName);
   15.68 +    System.out.println ("   size            " + domainSizeKB);
   15.69 +    System.out.println ("   vifs            " + domainVIFs);
   15.70 +    System.out.println ("   domainImage     " + domainImage);
   15.71 +    System.out.println ("   domainInitRD    " + domainInitRD);
   15.72 +    System.out.println ("   rootDevice      " + rootDevice);
   15.73 +    System.out.println ("   NWIP            " + NWIP);
   15.74 +    System.out.println ("   NWGW            " + NWGW);
   15.75 +    System.out.println ("   NWMask          " + NWMask);
   15.76 +    System.out.println ("   MaxDomainNumber " + MaxDomainNumber);
   15.77 +    System.out.println ("   NWNFSServer     " + NWNFSServer);
   15.78 +    System.out.println ("   NWNFSRoot       " + NWNFSRoot);
   15.79 +    System.out.println ("   XIToolsDir      " + XIToolsDir);
   15.80 +    System.out.println ("   args            " + args);
   15.81 +  }
   15.82 +
   15.83 +  /***********************************************************************/
   15.84 +
   15.85 +  class Handler extends DefaultHandler
   15.86 +  {
   15.87 +    boolean inDomctlDefaults;
   15.88 +    String lastName;
   15.89 +
   15.90 +    public void startDocument ()
   15.91 +    {
   15.92 +    }
   15.93 +
   15.94 +    public void endDocument ()
   15.95 +    {
   15.96 +    }
   15.97 +
   15.98 +    public void startElement (String uri, String name,
   15.99 +			      String qname, Attributes atts)
  15.100 +    {
  15.101 +      if (qname.equals ("domctl_defaults")) {
  15.102 +	inDomctlDefaults = true;
  15.103 +      } else {
  15.104 +	lastName = qname;
  15.105 +      }
  15.106 +    }
  15.107 +
  15.108 +    public void endElement (String uri, String name, String qname)
  15.109 +    {
  15.110 +      lastName = "";
  15.111 +      if (qname.equals ("domctl_defaults")) {
  15.112 +	inDomctlDefaults = false;
  15.113 +      }
  15.114 +    }
  15.115 +    
  15.116 +    public void characters (char ch[], int start, int length)
  15.117 +    {
  15.118 +      String s = new String (ch, start, length);
  15.119 +      if (lastName != null)
  15.120 +	{
  15.121 +	  if (lastName.equals ("domain_size_kb")) {
  15.122 +	    domainSizeKB = Integer.parseInt (s);
  15.123 +	  } else if (lastName.equals ("domain_image")) {
  15.124 +	    domainImage = s;
  15.125 +	  } else if (lastName.equals ("domain_name")) {
  15.126 +	    domainName = s;
  15.127 +	  } else if (lastName.equals ("domain_init_rd")) {
  15.128 +	    domainInitRD = s;
  15.129 +	  } else if (lastName.equals ("domain_vifs")) {
  15.130 +	    domainVIFs = Integer.parseInt (s);
  15.131 +	  } else if (lastName.equals ("root_device")) {
  15.132 +	    rootDevice = s;
  15.133 +	  } else if (lastName.equals ("nw_ip")) {
  15.134 +	    NWIP = expandDefault (s, runCommand(XIToolsDir+Settings.XI_HELPER+" ip").trim());
  15.135 +	  } else if (lastName.equals ("nw_gw")) {
  15.136 +	    NWGW = expandDefault (s, runCommand(XIToolsDir+Settings.XI_HELPER+" route").trim());
  15.137 +	  } else if (lastName.equals ("nw_mask")) {
  15.138 +	    NWMask = expandDefault (s, runCommand(XIToolsDir+Settings.XI_HELPER+" mask").trim());
  15.139 +	  } else if (lastName.equals ("nw_host")) {
  15.140 +	    NWHost = s;
  15.141 +	  } else if (lastName.equals ("nw_nfs_server")) {
  15.142 +	    NWNFSServer = s;
  15.143 +	  } else if (lastName.equals ("nw_nfs_root")) {
  15.144 +	    NWNFSRoot = s;
  15.145 +	  } else if (lastName.equals ("args")) {
  15.146 +	    args = s;
  15.147 +	  } else if (lastName.equals ("max_domain_number")) {
  15.148 +	    MaxDomainNumber = Integer.parseInt(s);
  15.149 +	  } else if (lastName.equals ("xi_tools_dir")) {
  15.150 +	    XIToolsDir = s;
  15.151 +	  }
  15.152 +	}
  15.153 +    }
  15.154 +  }
  15.155 +
  15.156 +  public String expandDefault (String supplied, String self)
  15.157 +  {
  15.158 +    if (supplied.startsWith ("=")) {
  15.159 +      if (supplied.length() > 1) {
  15.160 +	return self + supplied.substring (1, supplied.length());
  15.161 +      } else {
  15.162 +	return self;
  15.163 +      }
  15.164 +    } else {
  15.165 +      return supplied;
  15.166 +    }
  15.167 +  }
  15.168 +
  15.169 +  
  15.170 +  public String
  15.171 +    runCommand (String command)
  15.172 +  {
  15.173 +    Runtime runtime = Runtime.getRuntime();
  15.174 +    String outline;
  15.175 +    StringBuffer output = new StringBuffer();
  15.176 +
  15.177 +    try
  15.178 +    {
  15.179 +      Process process = runtime.exec(command);
  15.180 +      BufferedReader in = new BufferedReader(
  15.181 +                         new InputStreamReader(process.getInputStream()));
  15.182 +
  15.183 +      outline = in.readLine();
  15.184 +      while (outline != null)
  15.185 +      {
  15.186 +        output.append("\n" + outline);
  15.187 +        outline = in.readLine();
  15.188 +      }
  15.189 +    }
  15.190 +    catch (IOException e)
  15.191 +    {
  15.192 +      return e.toString();
  15.193 +    }
  15.194 +
  15.195 +    return output.toString();
  15.196 +  }
  15.197 +
  15.198 +
  15.199 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Domain.java	Fri May 16 09:35:50 2003 +0000
    16.3 @@ -0,0 +1,27 @@
    16.4 +package uk.ac.cam.cl.xeno.domctl;
    16.5 +
    16.6 +public class
    16.7 +Domain
    16.8 +{
    16.9 +  public int id;                                                /* domain id */
   16.10 +  public int processor;                                         /* processor */
   16.11 +  public boolean cpu;                                             /* has cpu */
   16.12 +  public int   nstate;                                              /* state */
   16.13 +  public String state;            /* running, interruptable, uninterruptable,
   16.14 +				                      wait, suspended, dying */
   16.15 +  public int mcu;                                            /* mcu advances */
   16.16 +  public int pages;                                           /* total pages */
   16.17 +  public String name;                                                /* name */
   16.18 +
   16.19 +  Domain()
   16.20 +  {
   16.21 +    id = 0;
   16.22 +    processor = 0;
   16.23 +    cpu = false;
   16.24 +    nstate = 0;
   16.25 +    state = "";
   16.26 +    mcu = 0;
   16.27 +    pages = 0;
   16.28 +    name = "none";
   16.29 +  }
   16.30 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/InetAddressPattern.java	Fri May 16 09:35:50 2003 +0000
    17.3 @@ -0,0 +1,60 @@
    17.4 +package uk.ac.cam.cl.xeno.domctl;
    17.5 +
    17.6 +import java.net.*;
    17.7 +
    17.8 +public class InetAddressPattern
    17.9 +{
   17.10 +  InetAddress base;
   17.11 +  boolean addDom;
   17.12 +
   17.13 +  static InetAddressPattern parse (String t)
   17.14 +  {
   17.15 +    InetAddressPattern result = new InetAddressPattern ();
   17.16 +    char[] ca = t.toCharArray ();
   17.17 +    int idx = 0;
   17.18 +    int len = ca.length;
   17.19 +
   17.20 +    try {
   17.21 +      if (len == 0) {
   17.22 +	result.base = null;
   17.23 +	result.addDom = false;
   17.24 +      } else if (ca[len - 1] == '+') {
   17.25 +	result.base = InetAddress.getByName(t.substring(0, len - 1));
   17.26 +	result.addDom = true;
   17.27 +      } else {
   17.28 +	result.base = InetAddress.getByName(t);
   17.29 +	result.addDom = false;
   17.30 +      }
   17.31 +    } catch (UnknownHostException uhe) {
   17.32 +      result.base = null;
   17.33 +      result.addDom = false;
   17.34 +    }
   17.35 +
   17.36 +    return result;
   17.37 +  }
   17.38 +
   17.39 +  public String resolve (int domain_id) {
   17.40 +    byte b[] = base.getAddress ();
   17.41 +    if (addDom) {
   17.42 +      if (((int)b[3]) + domain_id > 255) {
   17.43 +	if (((int)b[2]) + domain_id > 255) {
   17.44 +	  if (((int)b[1]) + domain_id > 255) {
   17.45 +	    b[0] ++;
   17.46 +	  }
   17.47 +	  b[1] ++;
   17.48 +	}
   17.49 +	b[2] ++;
   17.50 +      }
   17.51 +      b[3] += domain_id;
   17.52 +    }
   17.53 +    return "" + 
   17.54 +      (b[0] + (b[0] < 0 ? 256 : 0)) + "." + 
   17.55 +      (b[1] + (b[1] < 0 ? 256 : 0)) + "." + 
   17.56 +      (b[2] + (b[2] < 0 ? 256 : 0)) + "." + 
   17.57 +      (b[3] + (b[3] < 0 ? 256 : 0));
   17.58 +  }
   17.59 +
   17.60 +  public String toString () {
   17.61 +    return "[" + base + (addDom ? "+dom_id" : "") + "]";
   17.62 +  }
   17.63 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Main.java	Fri May 16 09:35:50 2003 +0000
    18.3 @@ -0,0 +1,40 @@
    18.4 +package uk.ac.cam.cl.xeno.domctl;
    18.5 +
    18.6 +public class Main 
    18.7 +{
    18.8 +  static CommandHelp help = new CommandHelp ();
    18.9 +  static CommandNew newdom = new CommandNew ();
   18.10 +  static CommandStart start = new CommandStart ();
   18.11 +  static CommandStop stop = new CommandStop ();
   18.12 +  static CommandDestroy destroy = new CommandDestroy ();
   18.13 +  static CommandList list = new CommandList ();
   18.14 +  static Command commands[] = { help, newdom, start, stop, destroy, list };
   18.15 +
   18.16 +  public static void main (String[] args)
   18.17 +  {
   18.18 +    Defaults d = new Defaults ();
   18.19 +    int ec = -1;
   18.20 +
   18.21 +    if (args.length == 0) {
   18.22 +      ec = help.doCommand (d, args);
   18.23 +    } else {
   18.24 +      String c = args[0];
   18.25 +      int i;
   18.26 +      for (i = 0; i < commands.length; i ++) {
   18.27 +	if (commands[i].getName().equals(c)) {
   18.28 +	  if (commands[i].getFlagParameter (args, '?')) {
   18.29 +	    ec = help.doHelpFor (commands[i]);
   18.30 +	  } else {
   18.31 +	    ec = commands[i].doCommand (d, args);
   18.32 +	  }
   18.33 +	  break;
   18.34 +	}
   18.35 +      }
   18.36 +      if (i == commands.length) {
   18.37 +	System.out.println ("Unknown command " + c);
   18.38 +      }
   18.39 +    }
   18.40 +
   18.41 +    System.exit (ec);
   18.42 +  }
   18.43 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/Settings.java	Fri May 16 09:35:50 2003 +0000
    19.3 @@ -0,0 +1,38 @@
    19.4 +package uk.ac.cam.cl.xeno.domctl;
    19.5 +
    19.6 +import java.util.*;
    19.7 +import java.io.*;
    19.8 +import org.xml.sax.*;
    19.9 +
   19.10 +public final class Settings
   19.11 +{
   19.12 +  public static final String DEFAULTS_FILE = System.getProperty ("DEFAULTS_FILE", "domctl.xml");
   19.13 +  public static final String DEFAULTS_PATH = System.getProperty ("DEFAULTS_PATH", ".:/etc:/var/lib/xen");
   19.14 +  public static final String LOCAL_IP = System.getProperty ("LOCAL_IP");
   19.15 +  public static final String LOCAL_MASK = System.getProperty ("LOCAL_MASK");
   19.16 +  public static final String LOCAL_GW = System.getProperty ("LOCAL_ROUTE");
   19.17 +  public static final boolean TEST = (System.getProperty ("TEST") != null);
   19.18 +  public static final String XI_HELPER = System.getProperty ("XI_HELPER", "xi_helper");
   19.19 +
   19.20 +
   19.21 +  public static File getDefaultsFile() {
   19.22 +    StringTokenizer tok = new StringTokenizer (DEFAULTS_PATH, ":");
   19.23 +    File result = null;
   19.24 +    File probe;
   19.25 +
   19.26 +    while (tok.hasMoreTokens ()) {
   19.27 +      String probe_dir = tok.nextToken ();
   19.28 +      probe = new File (probe_dir, DEFAULTS_FILE);
   19.29 +      if (probe.exists ()) {
   19.30 +	result = probe;
   19.31 +	break;
   19.32 +      }
   19.33 +    }
   19.34 +
   19.35 +    if (result == null) {
   19.36 +      System.err.println ("Could not find " + DEFAULTS_FILE + " in path " + DEFAULTS_PATH);
   19.37 +    }
   19.38 +
   19.39 +    return result;
   19.40 +  }
   19.41 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/domctl/StringPattern.java	Fri May 16 09:35:50 2003 +0000
    20.3 @@ -0,0 +1,59 @@
    20.4 +package uk.ac.cam.cl.xeno.domctl;
    20.5 +
    20.6 +public class StringPattern
    20.7 +{
    20.8 +  String base;
    20.9 +  int bn;
   20.10 +  boolean addDom;
   20.11 +  boolean appendDom;
   20.12 +
   20.13 +  static StringPattern parse (String t)
   20.14 +  {
   20.15 +    StringPattern result = new StringPattern ();
   20.16 +    char[] ca = t.toCharArray ();
   20.17 +    int idx = 0;
   20.18 +    int len = ca.length;
   20.19 +
   20.20 +    if (len == 0) {
   20.21 +      result.base = "";
   20.22 +      result.bn = 0;
   20.23 +      result.addDom = false;
   20.24 +    } else if (ca[len - 1] == '+') {
   20.25 +      idx = len - 2;
   20.26 +      if ((idx >= 0) && (ca[idx] >= '0') && (ca[idx] <= '9')) {
   20.27 +	while ((idx >= 0) && (ca[idx] >= '0') && (ca[idx] <= '9')) {
   20.28 +	  idx --;
   20.29 +	}
   20.30 +	result.base = t.substring(0, idx + 1);
   20.31 +	result.bn = Integer.parseInt (t.substring (idx + 1, len - 1));
   20.32 +	result.addDom = true;
   20.33 +      } else {
   20.34 +	result.base = t.substring(0, len - 1);
   20.35 +	result.appendDom = true;
   20.36 +      }
   20.37 +    } else {
   20.38 +      result.base = t;
   20.39 +    }
   20.40 +
   20.41 +    return result;
   20.42 +  }
   20.43 +
   20.44 +  public String resolve (int domain_id) {
   20.45 +    if (addDom) {
   20.46 +      return base + (bn + domain_id);
   20.47 +    } else if (appendDom) {
   20.48 +      return base + domain_id;
   20.49 +    } else {
   20.50 +      return base;
   20.51 +    }
   20.52 +  }
   20.53 +
   20.54 +  public String toString () {
   20.55 +    return ("[" + 
   20.56 +	    base + 
   20.57 +	    (addDom ? "+" + bn : "") + 
   20.58 +	    ((addDom || appendDom) ? "+ID" : "") + 
   20.59 +	    "]");
   20.60 +  }
   20.61 +
   20.62 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Extent.java	Fri May 16 09:35:50 2003 +0000
    21.3 @@ -0,0 +1,32 @@
    21.4 +/*
    21.5 + * Extent.java
    21.6 + * 03.03.26 aho creation
    21.7 + */
    21.8 +
    21.9 +package uk.ac.cam.cl.xeno.xenctl;
   21.10 +
   21.11 +public class
   21.12 +Extent
   21.13 +{
   21.14 +  int disk;
   21.15 +  long offset;                                           /* offset into disk */
   21.16 +  long size;                      /* size of this extent in 512 byte sectors */
   21.17 +
   21.18 +  public int
   21.19 +  getDisk()
   21.20 +  {
   21.21 +    return disk;
   21.22 +  }
   21.23 +
   21.24 +  public long
   21.25 +  getOffset()
   21.26 +  {
   21.27 +    return offset;
   21.28 +  }
   21.29 +
   21.30 +  public long
   21.31 +  getSize()
   21.32 +  {
   21.33 +    return size;
   21.34 +  }
   21.35 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Library.java	Fri May 16 09:35:50 2003 +0000
    22.3 @@ -0,0 +1,114 @@
    22.4 +/*
    22.5 + * Library.java
    22.6 + * 03.03.28 aho creation
    22.7 + */
    22.8 +
    22.9 +package uk.ac.cam.cl.xeno.xenctl;
   22.10 +
   22.11 +public class
   22.12 +Library
   22.13 +{
   22.14 +  /*
   22.15 +   * convert a number to a fixed width string
   22.16 +   */
   22.17 +  static String
   22.18 +  format (long input, int width, int prefix)
   22.19 +  {
   22.20 +    String sss = Long.toString(input);
   22.21 +    String space = "                                ";
   22.22 +
   22.23 +    if (width < sss.length())
   22.24 +    {
   22.25 +      width = sss.length();
   22.26 +    }
   22.27 +
   22.28 +    if (prefix == 0)
   22.29 +    {
   22.30 +      return space.substring(0, width - sss.length()) + sss;
   22.31 +    }
   22.32 +    else
   22.33 +    {
   22.34 +      return sss + space.substring(0, width - sss.length());
   22.35 +    }
   22.36 +  }
   22.37 +
   22.38 +  /*
   22.39 +   * convert a string to a fixed width string
   22.40 +   */
   22.41 +  static String
   22.42 +  format (String input, int width, int prefix)
   22.43 +  {
   22.44 +    String space = "                                ";
   22.45 +
   22.46 +    if (width < input.length())
   22.47 +    {
   22.48 +      width = input.length();
   22.49 +    }
   22.50 +
   22.51 +    if (prefix == 0)
   22.52 +    {
   22.53 +      return space.substring(0, width - input.length()) + input;
   22.54 +    }
   22.55 +    else
   22.56 +    {
   22.57 +      return input + space.substring(0, width - input.length());
   22.58 +    }
   22.59 +  }
   22.60 +
   22.61 +  /*
   22.62 +   * convert a number (string format) into 
   22.63 +   * the corresponding integer value.
   22.64 +   */
   22.65 +  static long
   22.66 +  parse_size(String size)
   22.67 +  {
   22.68 +    String substring = size;
   22.69 +    int    suffix = 1;
   22.70 +
   22.71 +    if ((substring = check(size, 'm')) != null)
   22.72 +    {
   22.73 +      suffix = 1024 * 1024;
   22.74 +    }
   22.75 +    else if ((substring = check(size, 'M')) != null)
   22.76 +    {
   22.77 +      suffix = 1024 * 1024;
   22.78 +    }
   22.79 +    else if ((substring = check(size, 'k')) != null)
   22.80 +    {
   22.81 +      suffix = 1024;
   22.82 +    }
   22.83 +    else if ((substring = check(size, 'K')) != null)
   22.84 +    {
   22.85 +      suffix = 1024;
   22.86 +    }
   22.87 +    else if ((substring = check(size, 'g')) != null)
   22.88 +    {
   22.89 +      suffix = 1024 * 1024 * 1024;
   22.90 +    }
   22.91 +    else if ((substring = check(size, 'G')) != null)
   22.92 +    {
   22.93 +      suffix = 1024 * 1024 * 1024;
   22.94 +    }
   22.95 +    else
   22.96 +    {
   22.97 +      substring = size;
   22.98 +    }
   22.99 +
  22.100 +    return Long.decode(substring).longValue() * suffix;
  22.101 +  }
  22.102 +
  22.103 +  static String
  22.104 +  check(String size, char suffix)
  22.105 +  {
  22.106 +    int index = size.indexOf(suffix);
  22.107 +
  22.108 +    if (index != -1)
  22.109 +    {
  22.110 +      return size.substring(0, index);
  22.111 +    }
  22.112 +    else
  22.113 +    {
  22.114 +      return null;
  22.115 +    }
  22.116 +  }
  22.117 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Main.java.orig	Fri May 16 09:35:50 2003 +0000
    23.3 @@ -0,0 +1,35 @@
    23.4 +/*
    23.5 + * Main.java
    23.6 + * 03.03.26 aho creation
    23.7 + */
    23.8 +
    23.9 +package uk.ac.cam.cl.xeno.vdmanager;
   23.10 +
   23.11 +import java.util.Date;
   23.12 +
   23.13 +public class
   23.14 +Main
   23.15 +{
   23.16 +  static String state_filename_in  = "/var/lib/xen/vdstate.xml";
   23.17 +  static String state_filename_out = "/var/lib/xen/vdstate.xml";
   23.18 +  static String partition_filename = "/proc/partitions";
   23.19 +
   23.20 +  void
   23.21 +  go (String[] argv)
   23.22 +  {
   23.23 +    PartitionManager pm = new PartitionManager(partition_filename);
   23.24 +    VirtualDiskManager vdm = new VirtualDiskManager();;
   23.25 +    Parser parser = new Parser(pm, vdm);
   23.26 +
   23.27 +    XML.load_state(pm, vdm, state_filename_in);
   23.28 +    parser.parse_main(argv);
   23.29 +    XML.dump_state(pm, vdm, state_filename_out);
   23.30 +  }
   23.31 +
   23.32 +  public static void
   23.33 +  main (String[] argv)
   23.34 +  {
   23.35 +    Main foo = new Main();
   23.36 +    foo.go(argv);
   23.37 +  }
   23.38 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Mode.java	Fri May 16 09:35:50 2003 +0000
    24.3 @@ -0,0 +1,22 @@
    24.4 +/*
    24.5 + * Mode.java
    24.6 + * 03.03.27 aho creation
    24.7 + *
    24.8 + * until we have jdk1.5, we're left with this mess...
    24.9 + */
   24.10 +
   24.11 +package uk.ac.cam.cl.xeno.xenctl;
   24.12 +
   24.13 +public class 
   24.14 +Mode 
   24.15 +{
   24.16 +  private final String name;
   24.17 +
   24.18 +  private Mode(String name) { this.name = name; }
   24.19 +
   24.20 +  public String toString()  { return name; }
   24.21 +
   24.22 +  public static final Mode READ_ONLY  = new Mode("ro");
   24.23 +  public static final Mode READ_WRITE = new Mode("rw");
   24.24 +}
   24.25 +
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Parser.java	Fri May 16 09:35:50 2003 +0000
    25.3 @@ -0,0 +1,446 @@
    25.4 +/*
    25.5 + * Parser.java
    25.6 + * 03.03.27 aho creation
    25.7 + */
    25.8 +
    25.9 +package uk.ac.cam.cl.xeno.xenctl;
   25.10 +
   25.11 +import java.io.BufferedReader;
   25.12 +import java.io.FileReader;
   25.13 +import java.io.InputStreamReader;
   25.14 +import java.io.FileNotFoundException;
   25.15 +import java.io.IOException;
   25.16 +import java.util.StringTokenizer;
   25.17 +import java.util.Vector;
   25.18 +import java.util.Date;
   25.19 +
   25.20 +public class
   25.21 +Parser
   25.22 +{
   25.23 +  static String prompt = "vdmanager> ";
   25.24 +  static String default_addpartition_chunksize = "104857600";        /* 100M */
   25.25 +  static int    default_sector_size = 512;
   25.26 +
   25.27 +  PartitionManager pm;
   25.28 +  VirtualDiskManager vdm;
   25.29 +
   25.30 +  Parser (PartitionManager pm, VirtualDiskManager vdm)
   25.31 +  {
   25.32 +    this.pm = pm;
   25.33 +    this.vdm = vdm;
   25.34 +  }
   25.35 +
   25.36 +  void
   25.37 +  parse_main (String[] argv)
   25.38 +  {
   25.39 +    if (argv.length == 0)
   25.40 +    {
   25.41 +      parse_input(null);
   25.42 +    }
   25.43 +    else
   25.44 +    {
   25.45 +      parse_commandline(argv);
   25.46 +    }
   25.47 +  }
   25.48 +
   25.49 +  void
   25.50 +  parse_input (String filename)
   25.51 +  {
   25.52 +    String line;
   25.53 +    BufferedReader in;
   25.54 +
   25.55 +    if (filename != null)
   25.56 +    {
   25.57 +      try
   25.58 +      {
   25.59 +	in = new BufferedReader(new FileReader(filename));
   25.60 +      }
   25.61 +      catch (FileNotFoundException fnfe)
   25.62 +      {
   25.63 +	System.err.println (fnfe);
   25.64 +	return;
   25.65 +      }
   25.66 +    }
   25.67 +    else
   25.68 +    {
   25.69 +      in = new BufferedReader(new InputStreamReader(System.in));
   25.70 +    }
   25.71 +
   25.72 +    try
   25.73 +    {
   25.74 +      if (filename == null)
   25.75 +      {
   25.76 +	System.out.print (prompt);
   25.77 +      }
   25.78 +      line = in.readLine();
   25.79 +      while (line != null)
   25.80 +      {
   25.81 +	StringTokenizer st = new StringTokenizer(line);
   25.82 +	Vector v = new Vector();
   25.83 +
   25.84 +	while (st.hasMoreTokens()) 
   25.85 +	{
   25.86 +	  v.add(st.nextToken());
   25.87 +	}
   25.88 +
   25.89 +	if (parse_commandline((String[]) v.toArray(new String[v.size()])))
   25.90 +	{
   25.91 +	  return;
   25.92 +	}
   25.93 +	
   25.94 +	if (filename == null)
   25.95 +	{
   25.96 +	  System.out.print (prompt);
   25.97 +	}
   25.98 +	line = in.readLine();
   25.99 +      }
  25.100 +    }
  25.101 +    catch (IOException ioe)
  25.102 +    {
  25.103 +      System.err.println(ioe);
  25.104 +    }
  25.105 +
  25.106 +    if (filename == null)
  25.107 +    {
  25.108 +      System.out.println ("");
  25.109 +    }
  25.110 +    return;
  25.111 +  }
  25.112 +
  25.113 +  boolean
  25.114 +  parse_commandline (String[] commands)
  25.115 +  {
  25.116 +    if (commands.length == 0)
  25.117 +    {
  25.118 +      return false;
  25.119 +    }
  25.120 +
  25.121 +    String keyword = commands[0].toLowerCase();
  25.122 +    if (keyword.equals("file"))
  25.123 +    {
  25.124 +      if (commands.length < 2)
  25.125 +      {
  25.126 +	System.out.println ("file [filename]");
  25.127 +	return false;
  25.128 +      }
  25.129 +      for (int i = 1; i < commands.length; i++)
  25.130 +      {
  25.131 +	System.out.println ("file " + commands[i]);
  25.132 +	parse_input(commands[i]);
  25.133 +      }
  25.134 +    }
  25.135 +    else if (keyword.equals("show"))
  25.136 +    {
  25.137 +      parse_show(commands);
  25.138 +    }
  25.139 +    else if (keyword.equals("addpartition"))
  25.140 +    {
  25.141 +      parse_addpartition(commands);
  25.142 +    }
  25.143 +    else if (keyword.equals("vdcreate"))
  25.144 +    {
  25.145 +      parse_vdcreate(commands);
  25.146 +    }
  25.147 +    else if (keyword.equals("vddelete"))
  25.148 +    {
  25.149 +      parse_vddelete(commands);
  25.150 +    }
  25.151 +    else if (keyword.equals("vdrefresh"))
  25.152 +    {
  25.153 +      parse_vdrefresh(commands);
  25.154 +    }
  25.155 +    else if (keyword.equals("vbdcreate"))
  25.156 +    {
  25.157 +      parse_vbdcreate(commands);
  25.158 +    }
  25.159 +    else if (keyword.equals("vbddelete"))
  25.160 +    {
  25.161 +      parse_vbddelete(commands);
  25.162 +    }
  25.163 +    else if (keyword.equals("vbdflush"))
  25.164 +    {
  25.165 +      vdm.flush_virtual_block_devices();
  25.166 +    }
  25.167 +    else if (keyword.equals("load"))
  25.168 +    {
  25.169 +      if (commands.length < 2)
  25.170 +      {
  25.171 +	System.out.println ("load <filename>");
  25.172 +	return false;
  25.173 +      }
  25.174 +      XML.load_state (pm, vdm, commands[1]);
  25.175 +    }
  25.176 +    else if (keyword.equals("save"))
  25.177 +    {
  25.178 +      if (commands.length < 2)
  25.179 +      {
  25.180 +	System.out.println ("save <filename>");
  25.181 +	return false;
  25.182 +      }
  25.183 +      XML.dump_state (pm, vdm, commands[1]);
  25.184 +    }
  25.185 +    else if (keyword.equals("help") ||
  25.186 +	     keyword.equals("?"))
  25.187 +    {
  25.188 +      parse_help();
  25.189 +    }
  25.190 +    else if (keyword.equals("exit") ||
  25.191 +	     keyword.equals("quit"))
  25.192 +    {
  25.193 +      return true;
  25.194 +    }
  25.195 +    else
  25.196 +    {
  25.197 +      System.out.println ("unknown command [" + commands[0] + "]. " +
  25.198 +			  "try \"help\"");
  25.199 +    }
  25.200 +    return false;
  25.201 +  }
  25.202 +
  25.203 +  void
  25.204 +  parse_vdcreate (String[] commands)
  25.205 +  {
  25.206 +    VirtualDisk vd;
  25.207 +
  25.208 +    if (commands.length < 4)
  25.209 +    {
  25.210 +      System.out.println ("vdcreate name size expiry");
  25.211 +      return;
  25.212 +    }
  25.213 +
  25.214 +    vd = vdm.create_virtual_disk(commands[1],
  25.215 +		     Library.parse_size(commands[2]) / default_sector_size,
  25.216 +				 new Date());
  25.217 +
  25.218 +    System.out.println ("Virtual Disk created with key: " + vd.get_key());
  25.219 +  }
  25.220 +
  25.221 +  void
  25.222 +  parse_vddelete (String[] commands)
  25.223 +  {
  25.224 +    if (commands.length < 2)
  25.225 +    {
  25.226 +      System.out.println ("vddelete key");
  25.227 +      return;
  25.228 +    }
  25.229 +
  25.230 +    vdm.delete_virtual_disk(commands[1]);
  25.231 +  }
  25.232 +
  25.233 +  void
  25.234 +  parse_vdrefresh (String[] commands)
  25.235 +  {
  25.236 +    if (commands.length < 3)
  25.237 +    {
  25.238 +      System.out.println ("vdrefresh key expiry");
  25.239 +      return;
  25.240 +    }
  25.241 +
  25.242 +    vdm.refresh_virtual_disk(commands[1],
  25.243 +			     new Date());
  25.244 +  }
  25.245 +
  25.246 +  void
  25.247 +  parse_vbdcreate (String[] commands)
  25.248 +  {
  25.249 +    VirtualDisk vd;
  25.250 +    VirtualBlockDevice vbd;
  25.251 +
  25.252 +    if (commands.length < 4)
  25.253 +    {
  25.254 +      System.out.println ("vbdcreate <key> <domain number> <vbd number>");
  25.255 +      return;
  25.256 +    }
  25.257 +
  25.258 +    if (commands[1].startsWith("sd") ||
  25.259 +	commands[1].startsWith("hd"))
  25.260 +    {
  25.261 +      /*
  25.262 +       * this is a gross hack to allow you to create a virtual block
  25.263 +       * device that maps directly to a physical partition
  25.264 +       */
  25.265 +
  25.266 +      /* find the appropriate partition */
  25.267 +      Partition partition = pm.get_partition(commands[1]);
  25.268 +      if (partition == null)
  25.269 +      {
  25.270 +	System.out.println ("vbdcreate error: couldn't find partition \"" +
  25.271 +			    commands[1] + "\"");
  25.272 +	return;
  25.273 +      }
  25.274 +
  25.275 +      /* create a virtual disk */
  25.276 +      vd = new VirtualDisk("vbd:" + commands[1]);
  25.277 +      vd.add_new_partition(partition, partition.nr_sects);
  25.278 +
  25.279 +
  25.280 +      /* display result */
  25.281 +      System.out.print("domain:" + commands[2] + " ");
  25.282 +      if (commands.length == 4)
  25.283 +      {
  25.284 +	System.out.print ("rw ");
  25.285 +      }
  25.286 +      else
  25.287 +      {
  25.288 +	System.out.print(commands[4] + " ");
  25.289 +      }
  25.290 +      System.out.print("segment:" + commands[3] + " ");
  25.291 +      System.out.print(vd.dump_xen());
  25.292 +      System.out.println("");
  25.293 +
  25.294 +      return;
  25.295 +    } 
  25.296 +
  25.297 +    if (commands.length == 4)
  25.298 +    {
  25.299 +      vbd =
  25.300 +      vdm.create_virtual_block_device(commands[1],
  25.301 +				      Integer.decode(commands[2]).intValue(),
  25.302 +				      Integer.decode(commands[3]).intValue(),
  25.303 +				      "rw");
  25.304 +    }
  25.305 +    else
  25.306 +    {
  25.307 +      vbd =
  25.308 +      vdm.create_virtual_block_device(commands[1],
  25.309 +				      Integer.decode(commands[2]).intValue(),
  25.310 +				      Integer.decode(commands[3]).intValue(),
  25.311 +				      commands[4]);
  25.312 +    }
  25.313 +
  25.314 +    /* display commandline to user */
  25.315 +    {
  25.316 +      vd = vdm.get_virtual_disk_key(commands[1]);
  25.317 +      System.out.println ("\n" + vd.dump_xen(vbd) + "\n");
  25.318 +    }
  25.319 +  }
  25.320 +
  25.321 +  void
  25.322 +  parse_vbddelete (String[] commands)
  25.323 +  {
  25.324 +    if (commands.length < 3)
  25.325 +    {
  25.326 +      System.out.println ("vbddelete <domain number> <vbd number>");
  25.327 +      return;
  25.328 +    }
  25.329 +
  25.330 +    vdm.delete_virtual_block_device(Integer.decode(commands[1]).intValue(),
  25.331 +				    Integer.decode(commands[2]).intValue());
  25.332 +  }
  25.333 +
  25.334 +  static String show_helptxt = "show <partitions | free | vd [vd number] | vbd>";
  25.335 +  void
  25.336 +  parse_show (String[] commands)
  25.337 +  {
  25.338 +    String subword;
  25.339 +      
  25.340 +    if (commands.length < 2)
  25.341 +    {
  25.342 +      System.out.println (show_helptxt);
  25.343 +      return;
  25.344 +    }
  25.345 +
  25.346 +    subword = commands[1].toLowerCase();
  25.347 +    if (subword.equals("partition") ||
  25.348 +	subword.equals("partitions"))
  25.349 +    {
  25.350 +      System.out.println(pm.dump(true));
  25.351 +    }
  25.352 +    else if (subword.equals("vd"))
  25.353 +    {
  25.354 +      String text;
  25.355 +
  25.356 +      if (commands.length < 3)
  25.357 +      {
  25.358 +	System.out.println(vdm.dump_virtualdisks());
  25.359 +	return;
  25.360 +      }
  25.361 +      text = vdm.dump_virtualdisk(Integer.decode(commands[2]).intValue());
  25.362 +      if (text == null)
  25.363 +      {
  25.364 +	System.out.println("show vd error: invalid virtual disk number");
  25.365 +      }
  25.366 +      else
  25.367 +      {
  25.368 +	System.out.println(text);
  25.369 +      }
  25.370 +    }
  25.371 +    else if (subword.equals("vbd"))
  25.372 +    {
  25.373 +      System.out.println(vdm.dump_virtualblockdevices());
  25.374 +    }
  25.375 +    else if (subword.equals("free"))
  25.376 +    {
  25.377 +      System.out.println(vdm.dump_free());
  25.378 +    }
  25.379 +    else
  25.380 +    {
  25.381 +      System.out.println (show_helptxt);
  25.382 +      return;
  25.383 +    }
  25.384 +  }
  25.385 +
  25.386 +  void
  25.387 +  parse_addpartition(String[] commands)
  25.388 +  {
  25.389 +    String chunksize = default_addpartition_chunksize;
  25.390 +
  25.391 +    if (commands.length > 3 || commands.length < 2)
  25.392 +    {
  25.393 +      System.out.println ("addpartition <partition number> [chunksize]");
  25.394 +      return;
  25.395 +    }
  25.396 +    if (commands.length == 3)
  25.397 +    {
  25.398 +      chunksize = commands[2];
  25.399 +    }
  25.400 +
  25.401 +    System.out.println ("add partition " + commands[1] + " " + chunksize);
  25.402 +
  25.403 +    vdm.add_xeno_partition(pm.get_partition(Integer.parseInt(commands[1])), 
  25.404 +			   Library.parse_size(chunksize)/default_sector_size);
  25.405 +    pm.add_xeno_partition(pm.get_partition(Integer.parseInt(commands[1])));
  25.406 +  }
  25.407 +
  25.408 +  void
  25.409 +  parse_help()
  25.410 +  {
  25.411 +    System.out.println ("file <filename>     " +
  25.412 +			"read the contents of a file as input to vdmanager");
  25.413 +    System.out.println ("addpartition <partition number> [chunksize]");
  25.414 +    System.out.println ("                    " +
  25.415 +			"add a partition as a xeno partition");
  25.416 +    System.out.println ("vdcreate <name> <size> <expiry>");
  25.417 +    System.out.println ("                    " +
  25.418 +			"create a new virtual disk");
  25.419 +    System.out.println ("vddelete <key>      " +
  25.420 +			"delete a virtual disk");
  25.421 +    System.out.println ("vdrefresh <key> <expiry>");
  25.422 +    System.out.println ("                    " +
  25.423 +			"reset virtual disk expiry");
  25.424 +    System.out.println ("vbdcreate <key> <domain number> <vbd number> [rw|ro]");
  25.425 +    System.out.println ("                    " +
  25.426 +			"create a new virtual block device");
  25.427 +    System.out.println ("vbddelete <domain number> <vbd number>");
  25.428 +    System.out.println ("                    " +
  25.429 +			"delete a new virtual block device");
  25.430 +    System.out.println ("vbdflush            " +
  25.431 +			"remove all virtual block devices");
  25.432 +    System.out.println ("show partitions     " +
  25.433 +			"display a complete list of disk partitions");
  25.434 +    System.out.println ("show vd <vd number> " +
  25.435 +			"display virtual disk information");
  25.436 +    System.out.println ("show vbd            " +
  25.437 +			"display virtual virtual block device list");
  25.438 +    System.out.println ("show free           " +
  25.439 +			"display details about unallocated space");
  25.440 +    System.out.println ("load <filename>     " +
  25.441 +			"load new state from file");
  25.442 +    System.out.println ("save <filename>     " +
  25.443 +			"save state to file");
  25.444 +    System.out.println ("help                " +
  25.445 +			"display this help message");
  25.446 +    System.out.println ("quit                " +
  25.447 +			"exit");
  25.448 +  }
  25.449 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/Partition.java	Fri May 16 09:35:50 2003 +0000
    26.3 @@ -0,0 +1,125 @@
    26.4 +/*
    26.5 + * Partition.java
    26.6 + * 03.03.26 aho creation
    26.7 + */
    26.8 +
    26.9 +package uk.ac.cam.cl.xeno.xenctl;
   26.10 +
   26.11 +import java.io.*;
   26.12 +
   26.13 +public class
   26.14 +Partition
   26.15 +{
   26.16 +  int major;
   26.17 +  int minor;
   26.18 +  long blocks;
   26.19 +  long start_sect;
   26.20 +  long nr_sects;
   26.21 +  String name;
   26.22 +  boolean xeno;
   26.23 +
   26.24 +  boolean 
   26.25 +  identical (Partition p)
   26.26 +  {
   26.27 +    return (major == p.major &&
   26.28 +	    minor == p.minor &&
   26.29 +	    blocks == p.blocks &&
   26.30 +	    start_sect == p.start_sect &&
   26.31 +	    nr_sects == p.nr_sects &&
   26.32 +	    name.equals(p.name));
   26.33 +  }
   26.34 +
   26.35 +  Partition
   26.36 +  duplicate ()
   26.37 +  {
   26.38 +    Partition p = new Partition();
   26.39 +
   26.40 +    p.major = major;
   26.41 +    p.minor = minor;
   26.42 +    p.blocks = blocks;
   26.43 +    p.start_sect = start_sect;
   26.44 +    p.nr_sects = nr_sects;
   26.45 +    p.name = name;
   26.46 +    p.xeno = xeno;
   26.47 +
   26.48 +    return p;
   26.49 +  }
   26.50 +
   26.51 +  String 
   26.52 +  dump (boolean title)
   26.53 +  {
   26.54 +    if (title)
   26.55 +    {
   26.56 +      return ("maj:min " + 
   26.57 +	      "    blocks " +
   26.58 +	      "start sect " +
   26.59 +	      " num sects " +
   26.60 +	      "name");
   26.61 +    }
   26.62 +    else
   26.63 +    {
   26.64 +      return (Library.format(major,3,0) + ":" + 
   26.65 +	      Library.format(minor,3,1) + " " +
   26.66 +	      Library.format(blocks,10,0) + " " +
   26.67 +	      Library.format(start_sect,10,0) + " " +
   26.68 +	      Library.format(nr_sects,10,0) + " " +
   26.69 +	      Library.format(name,7,1));
   26.70 +    }
   26.71 +  }
   26.72 +
   26.73 +  void
   26.74 +  dump_xml(PrintWriter out)
   26.75 +  {
   26.76 +    out.println ("  <partition>\n" +
   26.77 +		 "    <major>" + major + "</major>\n" +
   26.78 +		 "    <minor>" + minor + "</minor>\n" +
   26.79 +		 "    <blocks>" + blocks + "</blocks>\n" +
   26.80 +		 "    <start_sect>" + start_sect + "</start_sect>\n" +
   26.81 +		 "    <nr_sects>" + nr_sects + "</nr_sects>\n" +
   26.82 +		 "    <name>" + name + "</name>\n" +
   26.83 +		 "  </partition>");
   26.84 +  }
   26.85 +
   26.86 +  public int
   26.87 +  getMajor()
   26.88 +  {
   26.89 +    return major;
   26.90 +  }
   26.91 +
   26.92 +  public int
   26.93 +  getMinor()
   26.94 +  {
   26.95 +    return minor;
   26.96 +  }
   26.97 +
   26.98 +  public long
   26.99 +  getBlocks()
  26.100 +  {
  26.101 +    return blocks;
  26.102 +  }
  26.103 +  
  26.104 +  public long
  26.105 +  getStartSect()
  26.106 +  {
  26.107 +    return start_sect;
  26.108 +  }
  26.109 +
  26.110 +  public long
  26.111 +  getNumSects()
  26.112 +  {
  26.113 +    return nr_sects;
  26.114 +  }
  26.115 +  
  26.116 +  public String
  26.117 +  getName()
  26.118 +  {
  26.119 +    return name;
  26.120 +  }
  26.121 +
  26.122 +  public boolean
  26.123 +  getIsXeno()
  26.124 +  {
  26.125 +    return xeno;
  26.126 +  }
  26.127 +
  26.128 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/PartitionManager.java	Fri May 16 09:35:50 2003 +0000
    27.3 @@ -0,0 +1,191 @@
    27.4 +/*
    27.5 + * PartitionManager.java
    27.6 + * 03.03.26 aho creation
    27.7 + */
    27.8 +
    27.9 +package uk.ac.cam.cl.xeno.xenctl;
   27.10 +
   27.11 +import java.io.*;
   27.12 +import java.util.Vector;
   27.13 +import java.util.Enumeration;
   27.14 +
   27.15 +public class
   27.16 +PartitionManager
   27.17 +{
   27.18 +  Vector partition_map;
   27.19 +
   27.20 +  static String proc_template =
   27.21 +    "major minor  #blocks  start_sect   nr_sects name";
   27.22 +
   27.23 +  /*
   27.24 +   * Initialize partition manager with source file.
   27.25 +   * Normally we read from /proc/partitions, but we can
   27.26 +   * specify an alternative file for debugging
   27.27 +   */
   27.28 +  PartitionManager (String filename)
   27.29 +  {
   27.30 +    String str;
   27.31 +    BufferedReader in;
   27.32 +
   27.33 +    partition_map = new Vector(100,10);
   27.34 +
   27.35 +    try
   27.36 +    {
   27.37 +      in = new BufferedReader(new FileReader(filename));
   27.38 +
   27.39 +      str = in.readLine();                                  /* skip headings */
   27.40 +      if (str.length() < proc_template.length() ||
   27.41 +	  !str.substring(0, proc_template.length()).equals(proc_template))
   27.42 +      {
   27.43 +	System.err.println ("Error: Incorrect /proc/partitions.");
   27.44 +	System.err.println ("       Is this Xeno?");
   27.45 +	System.exit (1);
   27.46 +      }
   27.47 +
   27.48 +      str = in.readLine();                                /* skip blank line */
   27.49 +
   27.50 +      str = in.readLine();
   27.51 +      while (str != null)
   27.52 +      {
   27.53 +	Partition partition = new Partition();
   27.54 +
   27.55 +	partition.major = Integer.parseInt(str.substring(0,5).trim());
   27.56 +	partition.minor = Integer.parseInt(str.substring(5,10).trim());
   27.57 +	partition.blocks = Integer.parseInt(str.substring(10,21).trim());
   27.58 +	partition.start_sect = Integer.parseInt(str.substring(21,32).trim());
   27.59 +	partition.nr_sects = Integer.parseInt(str.substring(32,43).trim());
   27.60 +	partition.name = str.substring(43).trim();
   27.61 +	partition.xeno = false;
   27.62 +
   27.63 +	partition_map.add(partition);
   27.64 +	str = in.readLine();
   27.65 +      }
   27.66 +    }
   27.67 +    catch (IOException io)
   27.68 +    {
   27.69 +      System.err.println ("PartitionManager: error reading partition file [" 
   27.70 +			  + filename + "]");
   27.71 +      System.err.println (io);
   27.72 +    }
   27.73 +  }
   27.74 +
   27.75 +  Partition
   27.76 +  get_partition (String name)
   27.77 +  {
   27.78 +    Partition partition = null;
   27.79 +    for (Enumeration e = partition_map.elements() ; e.hasMoreElements() ;) 
   27.80 +    {
   27.81 +      partition = (Partition) e.nextElement();
   27.82 +      if (partition.name.equals(name))
   27.83 +      {
   27.84 +	return partition;
   27.85 +      }
   27.86 +    }
   27.87 +    return null;
   27.88 +  }
   27.89 +
   27.90 +  Partition
   27.91 +  get_partition (int index)
   27.92 +  {
   27.93 +    return (Partition) partition_map.get(index);
   27.94 +  }
   27.95 +
   27.96 +  void
   27.97 +  add_xeno_partition (Partition p)
   27.98 +  {
   27.99 +    for (Enumeration e = partition_map.elements() ; e.hasMoreElements() ;) 
  27.100 +    {
  27.101 +      Partition partition = (Partition) e.nextElement();
  27.102 +      if (partition.identical(p))
  27.103 +      {
  27.104 +	partition.xeno = true;
  27.105 +      }
  27.106 +    }
  27.107 +  }
  27.108 +
  27.109 +  /*
  27.110 +   * dump the xeno partition list as xml
  27.111 +   */
  27.112 +  void
  27.113 +  dump_xml (PrintWriter out)
  27.114 +  {
  27.115 +    int loop;
  27.116 +
  27.117 +    out.println("<partitions>");
  27.118 +    for (Enumeration e = partition_map.elements() ; e.hasMoreElements() ;) 
  27.119 +    {
  27.120 +      Partition partition = (Partition) e.nextElement();
  27.121 +      if (partition.xeno == true)
  27.122 +      {
  27.123 +	partition.dump_xml(out);
  27.124 +      }
  27.125 +    }
  27.126 +
  27.127 +    out.println("</partitions>");
  27.128 +
  27.129 +    return;
  27.130 +  }
  27.131 +
  27.132 +  /*
  27.133 +   * dump the partition map as a string
  27.134 +   * mark: mark the current xeno partitions in the partition map
  27.135 +   */
  27.136 +  String
  27.137 +  dump (boolean mark)
  27.138 +  {
  27.139 +    int loop, idx;
  27.140 +    StringBuffer sb = new StringBuffer();
  27.141 +    Partition partition;
  27.142 +
  27.143 +    for (idx = 0; idx < partition_map.size(); idx++)
  27.144 +    {
  27.145 +      partition = (Partition) partition_map.get(idx);
  27.146 +
  27.147 +      if (idx == 0)
  27.148 +      {
  27.149 +	sb.append(" idx " + partition.dump(true) + "\n");
  27.150 +      }
  27.151 +      if (partition.xeno)
  27.152 +      {
  27.153 +	sb.append("[ ");
  27.154 +      }
  27.155 +      else
  27.156 +      {
  27.157 +	sb.append("  ");
  27.158 +      }
  27.159 +      sb.append(Library.format(idx,2,0) + " " + partition.dump(false));
  27.160 +      if (partition.xeno)
  27.161 +      {
  27.162 +	sb.append("]\n");
  27.163 +      }
  27.164 +      else
  27.165 +      {
  27.166 +	sb.append("\n");
  27.167 +      }
  27.168 +    }
  27.169 +
  27.170 +    return sb.toString();
  27.171 +  }
  27.172 +
  27.173 +  /**
  27.174 +   * get the number of partitions 
  27.175 +   */
  27.176 +
  27.177 +  int
  27.178 +  getPartitionCount ()
  27.179 +  {
  27.180 +    return partition_map.size();
  27.181 +  }
  27.182 +
  27.183 +  /**
  27.184 +   * get the details about a particular partition
  27.185 +   *
  27.186 +   */
  27.187 +  Partition
  27.188 +  getPartition (int index)
  27.189 +  {
  27.190 +    Partition partition = (Partition) partition_map.get(index);
  27.191 +    return partition;
  27.192 +  }
  27.193 +
  27.194 +}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java	Fri May 16 09:35:50 2003 +0000
    28.3 @@ -0,0 +1,223 @@
    28.4 +/*
    28.5 + * RootBean.java
    28.6 + * 03.05.05 aho creation
    28.7 + */
    28.8 +
    28.9 +package uk.ac.cam.cl.xeno.xenctl;
   28.10 +
   28.11 +import java.io.FileWriter;
   28.12 +import java.util.Date;
   28.13 +import java.util.Enumeration;
   28.14 +import javax.servlet.http.HttpSessionBindingEvent;
   28.15 +import javax.servlet.http.HttpSessionBindingListener;
   28.16 +
   28.17 +public class
   28.18 +RootBean
   28.19 +  implements HttpSessionBindingListener
   28.20 +{
   28.21 +  static String state_filename_in  = "/var/lib/xen/vdstate.xml";
   28.22 +  static String state_filename_out = "/var/lib/xen/vdstate.xml";
   28.23 +  static String partition_filename = "/proc/partitions";
   28.24 +  static int    default_sector_size = 512;
   28.25 +
   28.26 +  PartitionManager pm;
   28.27 +  VirtualDiskManager vdm;
   28.28 +
   28.29 +  int counter = 0;
   28.30 +
   28.31 +  public
   28.32 +  RootBean ()
   28.33 +  {
   28.34 +    valueBound(null);
   28.35 +  }
   28.36 +
   28.37 +  public void
   28.38 +  valueBound (HttpSessionBindingEvent event)
   28.39 +  {
   28.40 +    pm = new PartitionManager(partition_filename);
   28.41 +    vdm = new VirtualDiskManager();
   28.42 +    XML.load_state(pm, vdm, state_filename_in);
   28.43 +  }
   28.44 +
   28.45 +  public void
   28.46 +  valueUnbound (HttpSessionBindingEvent event)
   28.47 +  {
   28.48 +    doFlushState();
   28.49 +  }
   28.50 +
   28.51 +  public int
   28.52 +  getDebugCounter()
   28.53 +  {
   28.54 +    return counter++;
   28.55 +  }
   28.56 +
   28.57 +  /*************************************************************************/
   28.58 +
   28.59 +  public int
   28.60 +  getPartitionCount()
   28.61 +  {
   28.62 +    return pm.getPartitionCount();
   28.63 +  }
   28.64 +
   28.65 +  public Partition
   28.66 +  getPartition(int index)
   28.67 +  {
   28.68 +    return pm.getPartition(index);
   28.69 +  }
   28.70 +
   28.71 +  public String
   28.72 +  doAddPartition(String partition, String chunksize )
   28.73 +  {
   28.74 +    Partition p = pm.get_partition(partition);
   28.75 +    String result="done";
   28.76 +    int loop;
   28.77 +
   28.78 +    if (p == null)
   28.79 +    {
   28.80 +      return (" eh? what partition: " + partition);
   28.81 +    }
   28.82 +
   28.83 +    vdm.add_xeno_partition(p, 
   28.84 +			   Library.parse_size(chunksize)/default_sector_size);
   28.85 +    pm.add_xeno_partition(p);
   28.86 +
   28.87 +    /*    return pm.dump(true); */
   28.88 +    return "done";
   28.89 +  }
   28.90 +
   28.91 +  /*************************************************************************/
   28.92 +
   28.93 +  public int
   28.94 +  getVirtualDiskCount ()
   28.95 +  {
   28.96 +    return vdm.getVirtualDiskCount();
   28.97 +  }
   28.98 +
   28.99 +  public VirtualDisk
  28.100 +  getVirtualDisk (int index)
  28.101 +  {
  28.102 +    return vdm.getVirtualDisk(index);
  28.103 +  }
  28.104 +
  28.105 +  public VirtualDisk
  28.106 +  getVirtualDiskKey (String key)
  28.107 +  {
  28.108 +    return vdm.get_virtual_disk_key(key);
  28.109 +  }
  28.110 +
  28.111 +  public String
  28.112 +  doCreateVirtualDisk (String name, String size, long expiry)
  28.113 +  {
  28.114 +    VirtualDisk vd;
  28.115 +    Date date = new Date();
  28.116 +
  28.117 +    vd = vdm.create_virtual_disk(name,
  28.118 +				 Library.parse_size(size)/default_sector_size,
  28.119 +				 new Date(date.getTime() + expiry));
  28.120 +
  28.121 +    return ("Virtual Disk created with key: " + vd.get_key());
  28.122 +
  28.123 +  }
  28.124 +
  28.125 +  public String
  28.126 +  doDeleteVirtualDisk (String key)
  28.127 +  {
  28.128 +    vdm.delete_virtual_disk(key);
  28.129 +
  28.130 +    return ("okay");
  28.131 +  }
  28.132 +
  28.133 +  public String
  28.134 +  doRefreshVirtualDisk (String key, long expiry)
  28.135 +  {
  28.136 +    VirtualDisk vd = vdm.get_virtual_disk_key(key);
  28.137 +    Date date;
  28.138 +    String s = "";
  28.139 +
  28.140 +    if (vd == null) 
  28.141 +    {
  28.142 +      return ("disk not found: " + key);
  28.143 +    }
  28.144 +    s = vd.get_expiry().toString();
  28.145 +    date =  new Date(vd.get_expiry().getTime() + expiry);
  28.146 +    vd.set_expiry(date);
  28.147 +
  28.148 +    return ("okay " + expiry + " " + s + " " + date.toString());
  28.149 +  }
  28.150 +
  28.151 +  /*************************************************************************/
  28.152 +
  28.153 +  public int
  28.154 +  getFreeExtentCount ()
  28.155 +  {
  28.156 +    VirtualDisk free = vdm.getFreeVirtualDisk();
  28.157 +    return free.getExtentCount();
  28.158 +  }
  28.159 +
  28.160 +  public Extent
  28.161 +  getFreeExtent (int index)
  28.162 +  {
  28.163 +    VirtualDisk free = vdm.getFreeVirtualDisk();
  28.164 +    return free.getExtent(index);
  28.165 +  }
  28.166 +
  28.167 +  /*************************************************************************/
  28.168 +
  28.169 +  public Enumeration
  28.170 +  getVirtualBlockDevices ()
  28.171 +  {
  28.172 +    return vdm.getVirtualBlockDevices();
  28.173 +  }
  28.174 +
  28.175 +  public String
  28.176 +  doCreateVirtualBlockDevice (String vd_key, int domain, 
  28.177 +			      int vbd_num, String mode)
  28.178 +  {
  28.179 +    VirtualBlockDevice vbd;
  28.180 +    VirtualDisk vd;
  28.181 +
  28.182 +    vbd = vdm.create_virtual_block_device(vd_key, domain, vbd_num, mode);
  28.183 +    if (vbd != null)
  28.184 +    {
  28.185 +      String command;
  28.186 +      FileWriter fw;
  28.187 +
  28.188 +      vd = vdm.get_virtual_disk_key(vd_key);
  28.189 +      command = vd.dump_xen(vbd);
  28.190 +
  28.191 +      try
  28.192 +      {
  28.193 +	fw = new FileWriter("/proc/xeno/dom0/vhd");
  28.194 +	fw.write(command);
  28.195 +	fw.flush();
  28.196 +	fw.close();
  28.197 +      }
  28.198 +      catch (Exception e)
  28.199 +      {
  28.200 +	return (e.toString());
  28.201 +      }
  28.202 +      return command;
  28.203 +    }
  28.204 +    else
  28.205 +    {
  28.206 +      return "Error encountered";
  28.207 +    }
  28.208 +  }
  28.209 +
  28.210 +  public String
  28.211 +  doFlushVirtualBlockDevices()
  28.212 +  {
  28.213 +    vdm.flush_virtual_block_devices();
  28.214 +    return "done";
  28.215 +  }
  28.216 +
  28.217 +  /*************************************************************************/
  28.218 +
  28.219 +
  28.220 +  public void
  28.221 +  doFlushState ()
  28.222 +  {
  28.223 +    XML.dump_state(pm, vdm, state_filename_out);
  28.224 +  }
  28.225 +
  28.226 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java	Fri May 16 09:35:50 2003 +0000
    29.3 @@ -0,0 +1,30 @@
    29.4 +/*
    29.5 + * SystemConfigurationBean.java
    29.6 + * 03.05.06 aho creation
    29.7 + */
    29.8 +
    29.9 +package uk.ac.cam.cl.xeno.xenctl;
   29.10 +
   29.11 +import java.io.*;
   29.12 +import java.lang.Process;
   29.13 +import java.lang.Runtime;
   29.14 +import uk.ac.cam.cl.xeno.domctl.Defaults;
   29.15 +
   29.16 +public class
   29.17 +SystemConfigurationBean
   29.18 +{
   29.19 +  Defaults defaults;
   29.20 +
   29.21 +  public
   29.22 +  SystemConfigurationBean ()
   29.23 +  {
   29.24 +    defaults = new Defaults();
   29.25 +  }
   29.26 +
   29.27 +  public Defaults
   29.28 +  getDefaults ()
   29.29 +  {
   29.30 +    return defaults;
   29.31 +  }
   29.32 +
   29.33 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualBlockDevice.java	Fri May 16 09:35:50 2003 +0000
    30.3 @@ -0,0 +1,76 @@
    30.4 +/*
    30.5 + * VirtualBlockDevice.java
    30.6 + * 03.03.27 aho creation
    30.7 + */
    30.8 +
    30.9 +package uk.ac.cam.cl.xeno.xenctl;
   30.10 +
   30.11 +import java.io.PrintWriter;
   30.12 +
   30.13 +public class
   30.14 +VirtualBlockDevice
   30.15 +{
   30.16 +  String key;
   30.17 +  int domain;
   30.18 +  int vbdnum;
   30.19 +  Mode mode;                                                     /* rw or ro */
   30.20 +
   30.21 +  String
   30.22 +  dump (boolean title)
   30.23 +  {
   30.24 +    StringBuffer sb = new StringBuffer();
   30.25 +    int loop;
   30.26 +
   30.27 +    if (title)
   30.28 +    {
   30.29 +      sb.append("  key         dom vbd mode\n");
   30.30 +    }
   30.31 +    else
   30.32 +    {
   30.33 +      sb.append("  " + key + "  " +
   30.34 +		Library.format(domain,3,0) + " " + 
   30.35 +		Library.format(vbdnum,3,0) + " " + 
   30.36 +		mode.toString() + "\n");
   30.37 +    }
   30.38 +
   30.39 +    return sb.toString();
   30.40 +  }
   30.41 +
   30.42 +  void
   30.43 +  dump_xml (PrintWriter out)
   30.44 +  {
   30.45 +    out.println("  <virtual_block_device>");
   30.46 +    out.println("    <key>" + key + "</key>");
   30.47 +    out.println("    <domain>" + domain + "</domain>");
   30.48 +    out.println("    <vbdnum>" + vbdnum + "</vbdnum>");
   30.49 +    out.println("    <mode>" + mode + "</mode>");
   30.50 +    out.println("  </virtual_block_device>");
   30.51 +
   30.52 +    return;
   30.53 +  }
   30.54 +
   30.55 +  public String
   30.56 +  getKey()
   30.57 +  {
   30.58 +    return key;
   30.59 +  }
   30.60 +
   30.61 +  public int
   30.62 +  getDomain()
   30.63 +  {
   30.64 +    return domain;
   30.65 +  }
   30.66 +
   30.67 +
   30.68 +  public int
   30.69 +  getVBDNum()
   30.70 +  {
   30.71 +    return vbdnum;
   30.72 +  }
   30.73 +
   30.74 +  public Mode
   30.75 +  getMode()
   30.76 +  {
   30.77 +    return mode;
   30.78 +  }
   30.79 +}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualDisk.java	Fri May 16 09:35:50 2003 +0000
    31.3 @@ -0,0 +1,257 @@
    31.4 +/*
    31.5 + * VirtualDisk.java
    31.6 + * 03.03.26 aho creation
    31.7 + */
    31.8 +
    31.9 +package uk.ac.cam.cl.xeno.xenctl;
   31.10 +
   31.11 +import java.util.Date;
   31.12 +import java.util.Vector;
   31.13 +import java.lang.Math;
   31.14 +import java.io.PrintWriter;
   31.15 +
   31.16 +public class
   31.17 +VirtualDisk
   31.18 +{
   31.19 +  String name;
   31.20 +  String key;
   31.21 +  Date   expiry;
   31.22 +  Vector extents;
   31.23 +
   31.24 +  VirtualDisk (String name, Date expiry, String key)
   31.25 +  {
   31.26 +    this.name = name;
   31.27 +    this.key = key;
   31.28 +    this.expiry = expiry;
   31.29 +    extents = new Vector();
   31.30 +  }
   31.31 +
   31.32 +  VirtualDisk (String name)
   31.33 +  {
   31.34 +    this (name, null, null);
   31.35 +    this.key = generate_key();
   31.36 +    extents = new Vector();
   31.37 +
   31.38 +    return;
   31.39 +  }
   31.40 +
   31.41 +  VirtualDisk (String name, Date expiry)
   31.42 +  {
   31.43 +    this(name, expiry, null);
   31.44 +    this.key = generate_key();
   31.45 +  }
   31.46 +
   31.47 +  /*
   31.48 +   * generate a unique key for this virtual disk.
   31.49 +   * for now, just generate a 10 digit number
   31.50 +   */
   31.51 +  String
   31.52 +  generate_key ()
   31.53 +  {
   31.54 +    return Long.toString(1000000000l + (long)(Math.random() * 8999999999l));
   31.55 +  }
   31.56 +
   31.57 +  String
   31.58 +  get_key ()
   31.59 +  {
   31.60 +    return key;
   31.61 +  }
   31.62 +
   31.63 +  Date
   31.64 +  get_expiry ()
   31.65 +  {
   31.66 +    return expiry;
   31.67 +  }
   31.68 +  
   31.69 +  void
   31.70 +  set_expiry (Date expiry)
   31.71 +  {
   31.72 +    this.expiry = expiry;
   31.73 +  }
   31.74 +
   31.75 +  public void
   31.76 +  add_extent (Extent extent)
   31.77 +  {
   31.78 +    extents.add(extent);
   31.79 +  }
   31.80 +
   31.81 +  public Extent
   31.82 +  remove_extent ()
   31.83 +  {
   31.84 +    Extent e;
   31.85 +
   31.86 +    if (extents.size() > 0)
   31.87 +    {
   31.88 +      e = (Extent) extents.remove(0);
   31.89 +    }
   31.90 +    else
   31.91 +    {
   31.92 +      e = null;
   31.93 +    }
   31.94 +
   31.95 +    return e;
   31.96 +  }
   31.97 +
   31.98 +  String
   31.99 +  dump (boolean details, boolean title)
  31.100 +  {
  31.101 +    StringBuffer sb = new StringBuffer();
  31.102 +    int loop;
  31.103 +
  31.104 +    if (details)
  31.105 +    {
  31.106 +      if (title)
  31.107 +      {
  31.108 +	sb.append("  name: " + name   + "\n");
  31.109 +	sb.append("   key: " + key    + "\n");
  31.110 +	sb.append("expiry: " + expiry + "\n");
  31.111 +	sb.append("\n");
  31.112 +      }
  31.113 +      sb.append("   idx  disk    offset      size \n");
  31.114 +      for (loop = 0; loop < extents.size(); loop++)
  31.115 +      {
  31.116 +	Extent e = (Extent) extents.get(loop);
  31.117 +	sb.append("  " + 
  31.118 +		  Library.format(loop,3,0) + " " +
  31.119 +		  Library.format(e.disk,6,0) +
  31.120 +		  Library.format(e.offset,10,0) +
  31.121 +		  Library.format(e.size,10,0) + "\n");
  31.122 +      }
  31.123 +    }
  31.124 +    else
  31.125 +    {
  31.126 +      if (title)
  31.127 +      {
  31.128 +	sb.append("  key         expiry                        name\n");
  31.129 +      }
  31.130 +      else
  31.131 +      {
  31.132 +	sb.append("  " + key + "  " + expiry.toString() + "  " + name + "\n");
  31.133 +      }
  31.134 +    }
  31.135 +
  31.136 +    return sb.toString();
  31.137 +  }
  31.138 +
  31.139 +  String
  31.140 +  dump_xen ()
  31.141 +  {
  31.142 +    StringBuffer sb = new StringBuffer();
  31.143 +
  31.144 +    sb.append("extents:" + extents.size() + " ");
  31.145 +    for (int loop = 0; loop < extents.size(); loop++)
  31.146 +    {
  31.147 +      Extent e = (Extent) extents.get(loop);
  31.148 +      sb.append("(disk:" + e.disk + " " +
  31.149 +		"offset:" + e.offset + " " +
  31.150 +		"size:" + e.size + ")");
  31.151 +    }
  31.152 +    return sb.toString();
  31.153 +  }
  31.154 +
  31.155 +  String
  31.156 +  dump_xen (VirtualBlockDevice vbd)
  31.157 +  {
  31.158 +    StringBuffer sb = new StringBuffer();
  31.159 +
  31.160 +    sb.append("domain:" + vbd.domain + " " +
  31.161 +	      vbd.mode.toString() + " " +
  31.162 +	      "segment:" + vbd.vbdnum + " " +
  31.163 +	      "extents:" + extents.size() + " ");
  31.164 +    for (int loop = 0; loop < extents.size(); loop++)
  31.165 +    {
  31.166 +      Extent e = (Extent) extents.get(loop);
  31.167 +      sb.append("(disk:" + e.disk + " " +
  31.168 +		"offset:" + e.offset + " " +
  31.169 +		"size:" + e.size + ")");
  31.170 +    }
  31.171 +    return sb.toString();
  31.172 +  }
  31.173 +
  31.174 +  void
  31.175 +  dump_xml (PrintWriter out)
  31.176 +  {
  31.177 +    out.println("  <virtual_disk>");
  31.178 +    out.println("    <name>" + name + "</name>");
  31.179 +    out.println("    <key>" + key + "</key>");
  31.180 +    if (expiry == null)
  31.181 +    {
  31.182 +      out.println("    <expiry>0</expiry>");
  31.183 +    }
  31.184 +    else
  31.185 +    {
  31.186 +      out.println("    <expiry>" + expiry.getTime() + "</expiry>");
  31.187 +    }
  31.188 +    out.println("    <extents>");
  31.189 +    for (int loop = 0; loop < extents.size(); loop++)
  31.190 +    {
  31.191 +      Extent e = (Extent) extents.get(loop);
  31.192 +      out.println("      <extent>");
  31.193 +      out.println("        <disk>" + e.disk + "</disk>");
  31.194 +      out.println("        <size>" + e.size + "</size>");
  31.195 +      out.println("        <offset>" + e.offset + "</offset>");
  31.196 +      out.println("      </extent>");
  31.197 +    }
  31.198 +    out.println("    </extents>");
  31.199 +    out.println("  </virtual_disk>");
  31.200 +
  31.201 +    return;
  31.202 +  }
  31.203 +
  31.204 +  /*
  31.205 +   * Add a partition as a XenoPartition.
  31.206 +   * Chop the partition in to extents and of size "size" sectors
  31.207 +   * and add them to the virtual disk.
  31.208 +   */
  31.209 +
  31.210 +  void
  31.211 +  add_new_partition (Partition partition, long size)
  31.212 +  {
  31.213 +    int loop;
  31.214 +
  31.215 +    for (loop = 0; loop < partition.nr_sects / size; loop++)
  31.216 +    {
  31.217 +      Extent extent = new Extent();
  31.218 +
  31.219 +      extent.disk = partition.major << 8;
  31.220 +      extent.disk = extent.disk | (partition.minor >> 5) << 5;
  31.221 +      extent.size = size;
  31.222 +      extent.offset = partition.start_sect + (size * loop);
  31.223 +
  31.224 +      add_extent(extent);
  31.225 +    }
  31.226 +    
  31.227 +    return;
  31.228 +  }
  31.229 +
  31.230 +  public String
  31.231 +  getName()
  31.232 +  {
  31.233 +    return name;
  31.234 +  }
  31.235 +
  31.236 +  public String
  31.237 +  getKey()
  31.238 +  {
  31.239 +    return key;
  31.240 +  }
  31.241 +
  31.242 +  public String
  31.243 +  getExpiry()
  31.244 +  {
  31.245 +    return expiry.toString();
  31.246 +  }
  31.247 +
  31.248 +  public int
  31.249 +  getExtentCount()
  31.250 +  {
  31.251 +    return extents.size();
  31.252 +  }
  31.253 +
  31.254 +  public Extent
  31.255 +  getExtent(int index)
  31.256 +  {
  31.257 +    return (Extent) extents.get(index);
  31.258 +  }
  31.259 +  
  31.260 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/VirtualDiskManager.java	Fri May 16 09:35:50 2003 +0000
    32.3 @@ -0,0 +1,315 @@
    32.4 +/*
    32.5 + * VirtualDiskManager.java
    32.6 + * 03.03.26 aho creation
    32.7 + */
    32.8 +
    32.9 +package uk.ac.cam.cl.xeno.xenctl;
   32.10 +
   32.11 +import java.util.Enumeration;
   32.12 +import java.util.Vector;
   32.13 +import java.util.Hashtable;
   32.14 +import java.util.Date;
   32.15 +import java.io.PrintWriter;
   32.16 +
   32.17 +public class
   32.18 +VirtualDiskManager
   32.19 +{
   32.20 +  VirtualDisk free_disk;
   32.21 +  Vector virtual_disks;
   32.22 +  Hashtable virtual_block_devices;
   32.23 +  Hashtable key_hash;
   32.24 +
   32.25 +  VirtualDiskManager ()
   32.26 +  {
   32.27 +    free_disk = new VirtualDisk("free");
   32.28 +
   32.29 +    virtual_disks = new Vector(10,5);
   32.30 +    flush_virtual_block_devices();
   32.31 +    key_hash = new Hashtable(100);
   32.32 +  }
   32.33 +
   32.34 +  public VirtualDisk
   32.35 +  get_virtual_disk_key (String key)
   32.36 +  {
   32.37 +    return ((VirtualDisk) key_hash.get(key));
   32.38 +  }
   32.39 +
   32.40 +  public void
   32.41 +  add_xeno_partition (Partition partition, long size)
   32.42 +  {
   32.43 +    free_disk.add_new_partition (partition, size);
   32.44 +    return;
   32.45 +  }
   32.46 +
   32.47 +  /*
   32.48 +   * create a new virtual disk
   32.49 +   */
   32.50 +
   32.51 +  public VirtualDisk
   32.52 +  create_virtual_disk(String name, long size, Date expiry)
   32.53 +  {
   32.54 +    VirtualDisk vd = new VirtualDisk (name, expiry);
   32.55 +
   32.56 +    while (size > 0)
   32.57 +    {
   32.58 +      Extent e;
   32.59 +
   32.60 +      e = free_disk.remove_extent();
   32.61 +      if (e == null)
   32.62 +      {
   32.63 +	return null;
   32.64 +      }
   32.65 +      size -= e.size;
   32.66 +      vd.add_extent(e);
   32.67 +    }
   32.68 +
   32.69 +    add_virtual_disk(vd);
   32.70 +
   32.71 +    return vd;
   32.72 +  }
   32.73 +
   32.74 +  /*
   32.75 +   * delete a new virtual disk.  extents go back into the free pool
   32.76 +   */
   32.77 +
   32.78 +  public void
   32.79 +  delete_virtual_disk (String key)
   32.80 +  {
   32.81 +    VirtualDisk vd;
   32.82 +
   32.83 +    vd = (VirtualDisk) key_hash.get(key);
   32.84 +    if (vd != null)
   32.85 +    {
   32.86 +      Extent e;
   32.87 +
   32.88 +      key_hash.remove(key);
   32.89 +      virtual_disks.remove(vd);
   32.90 +
   32.91 +      e = vd.remove_extent();
   32.92 +      while (e != null)
   32.93 +      {
   32.94 +	free_disk.add_extent(e);
   32.95 +	e = vd.remove_extent();
   32.96 +      }
   32.97 +    }
   32.98 +    return;
   32.99 +  }
  32.100 +
  32.101 +  /*
  32.102 +   * reset the expiry time for a virtual disk
  32.103 +   */
  32.104 +
  32.105 +  public void
  32.106 +  refresh_virtual_disk (String key, Date expiry)
  32.107 +  {
  32.108 +    VirtualDisk vd = (VirtualDisk) key_hash.get(key);
  32.109 +    if (vd != null)
  32.110 +    {
  32.111 +      vd.set_expiry(expiry);
  32.112 +    }
  32.113 +  }
  32.114 +
  32.115 +  /*
  32.116 +   * create a new virtual block device
  32.117 +   */
  32.118 +  public VirtualBlockDevice
  32.119 +  create_virtual_block_device (String key, int domain, int vbd_num, 
  32.120 +			       String mode)
  32.121 +  {
  32.122 +    VirtualBlockDevice vbd = new VirtualBlockDevice();
  32.123 +    VirtualDisk vd = get_virtual_disk_key(key);
  32.124 +
  32.125 +    if (vd == null)
  32.126 +    {
  32.127 +      System.err.println("create virtual block device error: unknown key " +
  32.128 +			 "[" + key + "]");
  32.129 +      return null;
  32.130 +    }
  32.131 +
  32.132 +    vbd.key = key;
  32.133 +    vbd.domain = domain;
  32.134 +    vbd.vbdnum = vbd_num;
  32.135 +
  32.136 +    if (mode.equals(Mode.READ_ONLY.toString()) ||
  32.137 +	mode.equals("RO") ||
  32.138 +	mode.equals("ro"))
  32.139 +    {
  32.140 +      vbd.mode = Mode.READ_ONLY;
  32.141 +    }
  32.142 +    else if (mode.equals(Mode.READ_WRITE.toString()) ||
  32.143 +	     mode.equals("RW") ||
  32.144 +	     mode.equals("rw"))
  32.145 +    {
  32.146 +      vbd.mode = Mode.READ_WRITE;
  32.147 +    }
  32.148 +    else
  32.149 +    {
  32.150 +      System.err.println("create virtual block device error: unknown mode " +
  32.151 +			 "[" + mode + "]");
  32.152 +      return null;
  32.153 +    }
  32.154 +
  32.155 +    add_virtual_block_device(vbd);
  32.156 +
  32.157 +    return vbd;
  32.158 +  }
  32.159 +
  32.160 +  /*
  32.161 +   * delete a virtual block device 
  32.162 +   */
  32.163 +  public void
  32.164 +  delete_virtual_block_device (int domain, int vbd_num)
  32.165 +  {
  32.166 +    Object hash = get_vbd_hash(domain, vbd_num);
  32.167 +    VirtualBlockDevice vbd = (VirtualBlockDevice)virtual_block_devices.remove(hash);
  32.168 +    return;
  32.169 +  }
  32.170 +
  32.171 +  /*
  32.172 +   * flush all virtual block devices
  32.173 +   */
  32.174 +  public void
  32.175 +  flush_virtual_block_devices ()
  32.176 +  {
  32.177 +                            /* isn't automatic garbage collection wonderful? */
  32.178 +    virtual_block_devices = new Hashtable(100);
  32.179 +  }
  32.180 +
  32.181 +  public void
  32.182 +  add_virtual_disk (VirtualDisk vd)
  32.183 +  {
  32.184 +    virtual_disks.add(vd);
  32.185 +    key_hash.put(vd.get_key(), vd);
  32.186 +  }
  32.187 +
  32.188 +  public void
  32.189 +  add_virtual_block_device (VirtualBlockDevice vbd)
  32.190 +  {
  32.191 +    Object hash = get_vbd_hash(vbd.domain, vbd.vbdnum);
  32.192 +    virtual_block_devices.put(hash, vbd);
  32.193 +  }
  32.194 +
  32.195 +  Object
  32.196 +  get_vbd_hash (int domain, int vbd_num)
  32.197 +  {
  32.198 +    return new Integer(domain * 16 + vbd_num);
  32.199 +  }
  32.200 +
  32.201 +  public void
  32.202 +  add_free (VirtualDisk vd)
  32.203 +  {
  32.204 +    free_disk = vd;
  32.205 +  }
  32.206 +
  32.207 +  public String
  32.208 +  dump_virtualdisk (int segment)
  32.209 +  {
  32.210 +    if (segment < 0 || segment >= virtual_disks.size())
  32.211 +    {
  32.212 +      return null;
  32.213 +    }
  32.214 +    else
  32.215 +    {
  32.216 +      VirtualDisk vd = (VirtualDisk) virtual_disks.get(segment);
  32.217 +      return (vd.dump(true, true));
  32.218 +    }
  32.219 +  }
  32.220 +
  32.221 +  public String
  32.222 +  dump_free()
  32.223 +  {
  32.224 +    return(free_disk.dump(true, false));
  32.225 +  }
  32.226 +
  32.227 +  public String
  32.228 +  dump_virtualdisks()
  32.229 +  {
  32.230 +    StringBuffer sb = new StringBuffer();
  32.231 +
  32.232 +    for (int i = 0; i < virtual_disks.size(); i++)
  32.233 +    {
  32.234 +      VirtualDisk vd = (VirtualDisk) virtual_disks.get(i);
  32.235 +      if (i == 0)
  32.236 +      {
  32.237 +	sb.append(vd.dump(false, true));
  32.238 +      }
  32.239 +      sb.append(vd.dump(false, false));
  32.240 +    }
  32.241 +
  32.242 +    return sb.toString();
  32.243 +  }
  32.244 +
  32.245 +  public String
  32.246 +  dump_virtualblockdevices()
  32.247 +  {
  32.248 +    StringBuffer sb = new StringBuffer();
  32.249 +    boolean first = true;
  32.250 +
  32.251 +    for (Enumeration enumeration = virtual_block_devices.elements() ; 
  32.252 +	 enumeration.hasMoreElements() ;) 
  32.253 +    {
  32.254 +      VirtualBlockDevice vbd = (VirtualBlockDevice) enumeration.nextElement();
  32.255 +      if (first)
  32.256 +      {
  32.257 +	sb.append(vbd.dump(true));
  32.258 +	first = false;
  32.259 +      }
  32.260 +
  32.261 +      sb.append(vbd.dump(false));
  32.262 +    }
  32.263 +
  32.264 +    return sb.toString();
  32.265 +  }
  32.266 +
  32.267 +  public void
  32.268 +  dump_xml(PrintWriter out)
  32.269 +  {
  32.270 +    out.println("<free>");
  32.271 +    free_disk.dump_xml(out);
  32.272 +    out.println("</free>");
  32.273 +    out.println("<virtual_disks>");
  32.274 +    for (int i = 0; i < virtual_disks.size(); i++)
  32.275 +    {
  32.276 +      VirtualDisk vd = (VirtualDisk) virtual_disks.get(i);
  32.277 +      vd.dump_xml(out);
  32.278 +    }
  32.279 +    out.println("</virtual_disks>");
  32.280 +    out.println("<virtual_block_devices>");
  32.281 +    for (Enumeration enumeration = virtual_block_devices.elements() ; 
  32.282 +	 enumeration.hasMoreElements() ;) 
  32.283 +    {
  32.284 +      VirtualBlockDevice vbd = (VirtualBlockDevice) enumeration.nextElement();
  32.285 +      vbd.dump_xml(out);
  32.286 +    }
  32.287 + 
  32.288 +    out.println("</virtual_block_devices>");
  32.289 +
  32.290 +    return;
  32.291 +  }
  32.292 +
  32.293 +  /*************************************************************************/
  32.294 +
  32.295 +  public int
  32.296 +  getVirtualDiskCount ()
  32.297 +  {
  32.298 +    return virtual_disks.size();
  32.299 +  }
  32.300 +
  32.301 +  public VirtualDisk
  32.302 +  getVirtualDisk (int index)
  32.303 +  {
  32.304 +    return (VirtualDisk) virtual_disks.get(index);
  32.305 +  }
  32.306 +
  32.307 +  public VirtualDisk
  32.308 +  getFreeVirtualDisk ()
  32.309 +  {
  32.310 +    return free_disk;
  32.311 +  }
  32.312 +
  32.313 +  public Enumeration
  32.314 +  getVirtualBlockDevices ()
  32.315 +  {
  32.316 +    return virtual_block_devices.elements();
  32.317 +  }
  32.318 +}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/XML.java	Fri May 16 09:35:50 2003 +0000
    33.3 @@ -0,0 +1,126 @@
    33.4 +/*
    33.5 + * XML.java
    33.6 + * 03.03.26 aho creation
    33.7 + */
    33.8 +
    33.9 +package uk.ac.cam.cl.xeno.xenctl;
   33.10 +
   33.11 +import java.io.File;
   33.12 +import java.io.IOException;
   33.13 +import java.io.PrintWriter;
   33.14 +import java.io.FileWriter;
   33.15 +import java.io.BufferedWriter;
   33.16 +import java.io.FileNotFoundException;
   33.17 +import javax.xml.parsers.DocumentBuilder; 
   33.18 +import javax.xml.parsers.DocumentBuilderFactory; 
   33.19 +import javax.xml.parsers.FactoryConfigurationError; 
   33.20 +import javax.xml.parsers.ParserConfigurationException;
   33.21 +import org.w3c.dom.Document;
   33.22 +import org.w3c.dom.DOMException;
   33.23 +import org.w3c.dom.NodeList;
   33.24 +import org.xml.sax.SAXException; 
   33.25 +import org.xml.sax.SAXParseException;
   33.26 + 
   33.27 +public class
   33.28 +XML
   33.29 +{
   33.30 +  static Document document = null;
   33.31 +
   33.32 +  /*
   33.33 +   * dump partition manager and virtual disk manager state to filename
   33.34 +   */
   33.35 +
   33.36 +  static void
   33.37 +  dump_state (PartitionManager pm, VirtualDiskManager vdm, String filename)
   33.38 +  {
   33.39 +    PrintWriter out;
   33.40 +
   33.41 +    try
   33.42 +    {
   33.43 +      out = new PrintWriter(new BufferedWriter(new FileWriter(filename)));
   33.44 +    }
   33.45 +    catch (IOException e)
   33.46 +    {
   33.47 +      System.err.println ("XML.dump_state error [" + filename + "]");
   33.48 +      System.err.println (e);
   33.49 +      return;
   33.50 +    }
   33.51 +
   33.52 +    out.println("<?xml version=\"1.0\"?>");
   33.53 +    out.println("<vdmanager>");
   33.54 +    pm.dump_xml(out);
   33.55 +    vdm.dump_xml(out);
   33.56 +    out.println("</vdmanager>");
   33.57 +
   33.58 +    out.close();
   33.59 +    return;
   33.60 +  }
   33.61 +
   33.62 +  /*
   33.63 +   * load partition manager and virtual disk manager state from filename
   33.64 +   */
   33.65 +  static void
   33.66 +  load_state (PartitionManager pm, VirtualDiskManager vdm, String filename)
   33.67 +  {
   33.68 +    if (document == null)
   33.69 +    {
   33.70 +      load_file (filename);
   33.71 +    }
   33.72 +
   33.73 +    XMLHelper.parse(pm, vdm, document);
   33.74 +  }
   33.75 +
   33.76 +  /*
   33.77 +   * load XML from disk
   33.78 +   */
   33.79 +  static void
   33.80 +  load_file (String filename)
   33.81 +  {
   33.82 +    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
   33.83 +    // factory.setNamespaceAware(true);
   33.84 +    // factory.setValidating(true);
   33.85 +
   33.86 +    try
   33.87 +    {
   33.88 +      File file = new File(filename);
   33.89 +
   33.90 +      DocumentBuilder builder = factory.newDocumentBuilder();
   33.91 +      document = builder.parse(file);
   33.92 +    }
   33.93 +    catch (SAXParseException spe)               /* error generated by parser */
   33.94 +    {
   33.95 +      System.err.println ("xml parser exception on line " + 
   33.96 +			  spe.getLineNumber() + 
   33.97 +			  " for uri " + spe.getSystemId());
   33.98 +      System.err.println (spe.getMessage());
   33.99 +
  33.100 +      Exception x = spe;
  33.101 +      if (spe.getException() != null)
  33.102 +	x = spe.getException();
  33.103 +      x.printStackTrace();
  33.104 +      System.exit(1);
  33.105 +    }
  33.106 +    catch (SAXException sxe)
  33.107 +    {
  33.108 +      Exception e = sxe;
  33.109 +      if (sxe.getException() != null)
  33.110 +	e = sxe.getException();
  33.111 +      e.printStackTrace();
  33.112 +      System.exit(1);
  33.113 +    }
  33.114 +    catch (ParserConfigurationException pce)
  33.115 +    {
  33.116 +      pce.printStackTrace();
  33.117 +    }
  33.118 +    catch (FileNotFoundException fnfe)
  33.119 +    {
  33.120 +      System.err.println ("warning: state file not found [" +
  33.121 +			  filename + "]");
  33.122 +    }
  33.123 +    catch (IOException ioe)
  33.124 +    {
  33.125 +      ioe.printStackTrace();
  33.126 +    }
  33.127 +    return;
  33.128 +  }
  33.129 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/XMLHelper.java	Fri May 16 09:35:50 2003 +0000
    34.3 @@ -0,0 +1,205 @@
    34.4 +/*
    34.5 + * XMLHelper.java
    34.6 + * 03.03.27 aho creation
    34.7 + */
    34.8 +
    34.9 +package uk.ac.cam.cl.xeno.xenctl;
   34.10 +
   34.11 +import java.util.Date;
   34.12 +import org.w3c.dom.Document;
   34.13 +import org.w3c.dom.Element;
   34.14 +import org.w3c.dom.Node;
   34.15 +import org.w3c.dom.NodeList;
   34.16 +
   34.17 +public class
   34.18 +XMLHelper
   34.19 +{
   34.20 +  static void
   34.21 +  dump_document (Document document)
   34.22 +  {
   34.23 +    dump_element(document.getDocumentElement(), 0);
   34.24 +  }
   34.25 +
   34.26 +  static void
   34.27 +  dump_element (Element element, int indent)
   34.28 +  {
   34.29 +    NodeList nl = element.getChildNodes();
   34.30 +
   34.31 +    System.out.println ("<" + element.getTagName() + ">");
   34.32 +    dump_nodelist(nl, indent + 1);
   34.33 +    System.out.println("</" + element.getTagName() + ">");
   34.34 +  }
   34.35 +
   34.36 +  static void
   34.37 +  dump_nodelist (NodeList nl, int indent)
   34.38 +  {
   34.39 +    for (int loop = 0; loop < nl.getLength(); loop++)
   34.40 +    {
   34.41 +      Node node = nl.item(loop);
   34.42 +      switch (node.getNodeType())
   34.43 +      {
   34.44 +	case Node.ELEMENT_NODE : 
   34.45 +	{
   34.46 +	  dump_element((Element)node, indent);
   34.47 +	  break;
   34.48 +	}
   34.49 +	case Node.TEXT_NODE :
   34.50 +	{
   34.51 +	  System.out.println("TEXT: " + node.getNodeValue());
   34.52 +	  break;
   34.53 +	}
   34.54 +	default :
   34.55 +	{
   34.56 +	  System.out.println("NODE: " + node.getNodeType());
   34.57 +	}
   34.58 +      }
   34.59 +    }
   34.60 +  }
   34.61 +
   34.62 +  static Node 
   34.63 +  get_subnode (String name, Node node) 
   34.64 +  {
   34.65 +    if (node.getNodeType() != Node.ELEMENT_NODE) 
   34.66 +    {
   34.67 +      System.err.println("Error: Search node not of element type");
   34.68 +      return null;
   34.69 +    }
   34.70 +
   34.71 +    if (!node.hasChildNodes()) return null;
   34.72 +
   34.73 +    NodeList list = node.getChildNodes();
   34.74 +    for (int i=0; i < list.getLength(); i++) 
   34.75 +    {
   34.76 +      Node subnode = list.item(i);
   34.77 +      if (subnode.getNodeType() == Node.ELEMENT_NODE) 
   34.78 +      {
   34.79 +	if (subnode.getNodeName() == name) return subnode;
   34.80 +      }
   34.81 +    }
   34.82 +    return null;
   34.83 +  }
   34.84 +
   34.85 +  static String 
   34.86 +  get_text (Node node) 
   34.87 +  {
   34.88 +    StringBuffer result = new StringBuffer();
   34.89 +    if (node==null || !node.hasChildNodes()) return "";
   34.90 +
   34.91 +    NodeList list = node.getChildNodes();
   34.92 +    for (int i=0; i < list.getLength(); i++) 
   34.93 +    {
   34.94 +      Node subnode = list.item(i);
   34.95 +      if (subnode.getNodeType() == Node.TEXT_NODE) 
   34.96 +      {
   34.97 +	result.append(subnode.getNodeValue());
   34.98 +      }
   34.99 +    }
  34.100 +    return result.toString();
  34.101 +  }
  34.102 +
  34.103 +  static void
  34.104 +  parse (PartitionManager pm, VirtualDiskManager vdm, Document document)
  34.105 +  {
  34.106 +    if (document == null) return;
  34.107 +
  34.108 +    /* parse partitions */
  34.109 +    parse_partitions(pm, document.getElementsByTagName("partition"));
  34.110 +
  34.111 +    /* parse virtual disks */
  34.112 +    NodeList list = document.getElementsByTagName("virtual_disk");
  34.113 +    for (int i = 0; i < list.getLength(); i++)
  34.114 +    {
  34.115 +      Node subnode = list.item(i);
  34.116 +      String parent = subnode.getParentNode().getNodeName();
  34.117 +      VirtualDisk vd =  parse_virtual_disk(subnode);
  34.118 +
  34.119 +      if (parent.equals("free"))
  34.120 +      {
  34.121 +	vdm.add_free(vd);
  34.122 +      }
  34.123 +      else if (parent.equals("virtual_disks"))
  34.124 +      {
  34.125 +	vdm.add_virtual_disk(vd);
  34.126 +      }
  34.127 +      else
  34.128 +      {
  34.129 +	System.out.println ("XML parse error: unknown parent for virtual_disk "
  34.130 +			    + "[" + parent + "]");
  34.131 +      }
  34.132 +    }
  34.133 +
  34.134 +    /* parse virtual block devices */
  34.135 +    parse_virtual_block_devices(vdm, document.getElementsByTagName("virtual_block_device"));
  34.136 +
  34.137 +    return;
  34.138 +  }
  34.139 +
  34.140 +  static VirtualDisk
  34.141 +  parse_virtual_disk(Node node)
  34.142 +  {
  34.143 +    VirtualDisk vd;
  34.144 +    Date date = new Date();
  34.145 +    NodeList list;
  34.146 +
  34.147 +    date.setTime(Long.parseLong(XMLHelper.get_text(XMLHelper.get_subnode("expiry", node))));
  34.148 +    vd = new VirtualDisk(XMLHelper.get_text(XMLHelper.get_subnode("name", node)),
  34.149 +			 date,
  34.150 +			 XMLHelper.get_text(XMLHelper.get_subnode("key", node)));
  34.151 +
  34.152 +    list = XMLHelper.get_subnode("extents", node).getChildNodes();
  34.153 +    for (int i = 0; i < list.getLength(); i++)
  34.154 +    {
  34.155 +      Node enode = list.item(i);
  34.156 +
  34.157 +      if (enode.getNodeType() == Node.ELEMENT_NODE &&
  34.158 +	  enode.getNodeName().equals("extent"))
  34.159 +      {
  34.160 +	Extent extent = new Extent();
  34.161 +
  34.162 +	extent.disk = Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("disk", enode)));
  34.163 +	extent.size = Long.parseLong(XMLHelper.get_text(XMLHelper.get_subnode("size", enode)));
  34.164 +	extent.offset = Long.parseLong(XMLHelper.get_text(XMLHelper.get_subnode("offset", enode)));
  34.165 +	vd.add_extent(extent);
  34.166 +      }
  34.167 +    }
  34.168 +
  34.169 +    return vd;
  34.170 +  }
  34.171 +
  34.172 +  static void
  34.173 +  parse_partitions (PartitionManager pm, NodeList nl)
  34.174 +  {
  34.175 +    Partition partition;
  34.176 +
  34.177 +    for (int loop = 0; loop < nl.getLength(); loop++)
  34.178 +    {
  34.179 +      Node node = nl.item(loop);
  34.180 +
  34.181 +      partition = new Partition();
  34.182 +      partition.major = Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("major", node)));
  34.183 +      partition.minor = Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("minor", node)));
  34.184 +      partition.blocks = Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("blocks", node)));
  34.185 +      partition.start_sect = Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("start_sect", node)));
  34.186 +      partition.nr_sects = Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("nr_sects", node)));
  34.187 +      partition.name = XMLHelper.get_text(XMLHelper.get_subnode("name", node));
  34.188 +
  34.189 +      pm.add_xeno_partition(partition);
  34.190 +    }
  34.191 +  }
  34.192 +
  34.193 +  static void
  34.194 +  parse_virtual_block_devices (VirtualDiskManager vdm, NodeList nl)
  34.195 +  {
  34.196 +    VirtualBlockDevice vbd;
  34.197 +
  34.198 +    for (int loop = 0; loop < nl.getLength(); loop++)
  34.199 +    {
  34.200 +      Node node = nl.item(loop);
  34.201 +
  34.202 +      vdm.create_virtual_block_device(XMLHelper.get_text(XMLHelper.get_subnode("key", node)),
  34.203 +				      Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("domain", node))),
  34.204 +				      Integer.parseInt(XMLHelper.get_text(XMLHelper.get_subnode("vbdnum", node))),
  34.205 +				      XMLHelper.get_text(XMLHelper.get_subnode("mode", node)));
  34.206 +    }
  34.207 +  }
  34.208 +}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/tools/control/web/WEB-INF/web.xml	Fri May 16 09:35:50 2003 +0000
    35.3 @@ -0,0 +1,20 @@
    35.4 +<?xml version="1.0" encoding="ISO-8859-1" ?>
    35.5 +<!DOCTYPE web-app PUBLIC
    35.6 +          "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    35.7 +          "http://java.sun.com/dtd/web-app_2_3.dtd">
    35.8 +
    35.9 +<web-app>
   35.10 +  <display-name>Xen Control</display-name>
   35.11 +  <description>
   35.12 +    Copyright 2003, University of Cambridge Computer Laboratory
   35.13 +    This is version 1.0-beta of the Xen control software.
   35.14 +  </description>
   35.15 +  <welcome-file-list>
   35.16 +    <welcome-file>index.jsp</welcome-file>
   35.17 +  </welcome-file-list>
   35.18 +
   35.19 +  <session-config>
   35.20 +    <session-timeout>30</session-timeout>
   35.21 +  </session-config>
   35.22 +
   35.23 +</web-app>
    36.1 Binary file tools/control/web/img/cambridge.gif has changed
    37.1 Binary file tools/control/web/img/help.gif has changed
    38.1 Binary file tools/control/web/img/home.gif has changed
    39.1 Binary file tools/control/web/img/pixel.gif has changed
    40.1 Binary file tools/control/web/img/search.gif has changed
    41.1 Binary file tools/control/web/img/xeno.gif has changed
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/tools/control/web/tmpl/about.tmpl	Fri May 16 09:35:50 2003 +0000
    42.3 @@ -0,0 +1,71 @@
    42.4 +About
    42.5 +SECTION&XenoServers
    42.6 +
    42.7 +<!-- content -->
    42.8 +<img src="img/pixel.gif" class="block" width="1" height="12" alt="">
    42.9 +<table cellpadding="0" cellspacing="0" border="0" summary="page content">
   42.10 +<tbody><tr>
   42.11 +   <td width="250" valign="top" align="right">
   42.12 +     <a href="http://www.cl.cam.ac.uk/xeno/"><img width="191" heigth="65" src="img/xeno.gif" border="0"></a>
   42.13 +
   42.14 +<table cellpadding="0" cellspacing="0" border="0" align="right">
   42.15 +<tbody><tr>
   42.16 +  <td><img src="img/pixel.gif" class="block" width="20" height="1" alt=""></td>
   42.17 +</tr>
   42.18 +<tr>
   42.19 +  <td colspan="3"><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   42.20 +</tr>
   42.21 +<tr>
   42.22 +  <td align="right">
   42.23 +  <table width="180" ><tbody><tr><td><p align="right">
   42.24 +The XenoServer project aims to build a public infrastructure for wide-area distributed computing.
   42.25 +</p>
   42.26 +  </td></tr></tbody></table></td>
   42.27 +<td><img src="img/pixel.gif" class="block" width="10" height="1" alt=""></td>
   42.28 +</tr>
   42.29 +</tbody></table>
   42.30 +</td>
   42.31 +<td bgcolor="#666666" width="2"><img src="img/pixel.gif" class="block" width="2" height="50" alt=""></td>
   42.32 +<td width="20"><img src="img/pixel.gif" class="block" width="20" height="1" alt=""></td>
   42.33 +<td valign="top">
   42.34 +
   42.35 +<!-- main navigation -->
   42.36 +<table cellpadding="0" cellspacing="0" border="0">
   42.37 +
   42.38 +<tbody><tr><td><b>Overview</b><td></tr>
   42.39 +<tr>
   42.40 +  <td>
   42.41 +The Xenoserver project is building a public infrastructure for wide-area distributed computing. We envisage a world in which Xenoserver execution platforms will be scattered across the globe and available for any member of the public to submit code for execution. Crucially, the sponsor of the code will be billed for all the resources used or reserved during the course of execution. This will serve to encourage load balancing, limit congestion, and hopefully even make the platform self-financing.
   42.42 +<p>
   42.43 +A global infrastructure such as we propose is essential to address the fundamental problem of communication latency. By enabling principles to run programs at points throughout the network they can ensure that their code executes close to the entities with which it needs to interact. As well as reducing latency this can be used to avoid network bottlenecks, to reduce long-haul network charges and to provide a platform over which code provided by transiently-connected mobile devices can maintain a network presence.
   42.44 +<p>
   42.45 +Our approach is distinguished from existing work on mobile agents, execution platforms, code hosting and the like by two principles:
   42.46 +<p>
   42.47 +<b>Tackling difficult problems at the same time.</b> Acceptable designs for execution environments, resource management, resource discovery, authentication, privacy, charging, billing, payment and auditing are all crucial to the success of our platform as an infrastructure service open to and accepted by the public. Existing work has tackled individual subsets of these problems, but tensions between the issues concerned mean that solutions proficient in some dimension are lacking in another.
   42.48 +<p>
   42.49 +<b>No brave new world.</b> Our platform will host applications written in today's programming languages against existing APIs -- and, we believe, those written with tomorrow's languages and libraries. We do not want to mandate a particular code distribution format or a particular middleware toolkit for distributed programming.
   42.50 +</td>
   42.51 +</tr>
   42.52 +
   42.53 +<tr> <!-- blank white space -->
   42.54 +  <td><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   42.55 +</tr>
   42.56 +
   42.57 +<tr> <!-- grey line -->
   42.58 +  <td bgcolor="#cccccc"><img src="img/pixel.gif" class="block" width="1" height="2" alt=""></td>
   42.59 +</tr>
   42.60 +
   42.61 +<tr> <!-- blank white space -->
   42.62 +  <td><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   42.63 +</tr>
   42.64 +
   42.65 +<tr> <!-- list of menu items -->
   42.66 +  <td nowrap="nowrap">
   42.67 +   <a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xeno/general-xeno.pdf" class="homemenu">Project Overview Document</a><br>
   42.68 +   </td>
   42.69 +</tr>
   42.70 +</tbody></table>
   42.71 +</td>
   42.72 +</tr>
   42.73 +</tbody></table>
   42.74 +<!-- end content -->
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/tools/control/web/tmpl/dom-del.tmpl	Fri May 16 09:35:50 2003 +0000
    43.3 @@ -0,0 +1,86 @@
    43.4 +Delete Domain
    43.5 +SECTION&XenoServers
    43.6 +BREADCRUMB&Domain Manager&dom.jsp
    43.7 +
    43.8 +<!-- content -->
    43.9 +<img src="pixel.gif" class="block" width="1" height="12">
   43.10 +
   43.11 +<table cellpadding="0" cellspacing="0" border="0">
   43.12 +<tbody>
   43.13 +INCLUDE&dommenu.tmpl
   43.14 +<td valign="top">
   43.15 +
   43.16 +<form method="post" action="dom-delr.jsp">
   43.17 +<table cellpadding="0" cellspacing="0" border="0">
   43.18 +<tbody>
   43.19 +<tr><td>
   43.20 +<%
   43.21 +  CommandList command_list = new CommandList();
   43.22 +  Defaults d = sc.getDefaults(); 
   43.23 +  Domain domains[] = command_list.executeCommand(d);
   43.24 +%>
   43.25 +
   43.26 +<table cellpadding="2" cellspacing="0" border="0">
   43.27 +<tbody>
   43.28 +  <tr class="vdh"><td></td><td>domain<br>id</td><td>processor</td><td>has<br>cpu</td><td>state</td><td>mcu<br>advance</td><td>total<br>pages</td><td>name</td></tr>
   43.29 +  <%
   43.30 +    for (int loop = 0; loop < domains.length; loop++)
   43.31 +    {
   43.32 +  %>
   43.33 +  <tr class="vdt">
   43.34 +    <td><input type="checkbox" name="dom" value="<%= domains[loop].id %>"></td>
   43.35 +    <td align="center"><%= domains[loop].id %></td>
   43.36 +    <td align="center"><%= domains[loop].processor %></td>
   43.37 +    <td align="center"><%= domains[loop].cpu %> </td>
   43.38 +    <td><%= domains[loop].state %> </td>
   43.39 +    <td align="center"><%= domains[loop].mcu %> </td>
   43.40 +    <td align="center"><%= domains[loop].pages %> </td>
   43.41 +    <td><%= domains[loop].name %> </td>
   43.42 +  </tr>
   43.43 +  <%
   43.44 +    }
   43.45 +  %>
   43.46 +
   43.47 +</tbody>
   43.48 +</table>
   43.49 +</td></tr>
   43.50 +
   43.51 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   43.52 +
   43.53 +<tr><td>
   43.54 +<table cellpadding="0" cellspacing="0" border="0">
   43.55 +<tbody>
   43.56 +
   43.57 +<tr>
   43.58 +  <td></td>
   43.59 +  <td class="menuheader">force immediate destruction?</td>
   43.60 +</tr>
   43.61 +<tr>
   43.62 +  <td> <input type="radio" name="force" value="false" checked></td>
   43.63 +  <td> don't force </td>
   43.64 +</tr>
   43.65 +<tr>
   43.66 +  <td> <input type="radio" name="force" value="true"></td>
   43.67 +  <td> force </td>
   43.68 +</tr>
   43.69 +</tbody>
   43.70 +</table>
   43.71 +</td></tr>
   43.72 +
   43.73 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   43.74 +
   43.75 +<tr>
   43.76 +  <td><input type="submit" name="action" value="delete domain"></td>
   43.77 +</tr>
   43.78 +</tbody>
   43.79 +</table>
   43.80 +</form>
   43.81 +
   43.82 +</td>
   43.83 +</tbody>
   43.84 +</table>
   43.85 +
   43.86 +
   43.87 +
   43.88 +
   43.89 +<!-- end content -->
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/tools/control/web/tmpl/dom-delr.tmpl	Fri May 16 09:35:50 2003 +0000
    44.3 @@ -0,0 +1,42 @@
    44.4 +Delete Domain
    44.5 +SECTION&XenoServers
    44.6 +BREADCRUMB&Domain Manager&dom.jsp
    44.7 +
    44.8 +<!-- content -->
    44.9 +<img src="pixel.gif" class="block" width="1" height="12">
   44.10 +
   44.11 +<table cellpadding="0" cellspacing="0" border="0">
   44.12 +<tbody>
   44.13 +INCLUDE&dommenu.tmpl
   44.14 +<td valign="top">
   44.15 +
   44.16 +
   44.17 +<b>Delete Domain Results</b>
   44.18 +<br>
   44.19 +
   44.20 +<%
   44.21 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   44.22 +  Defaults d = sc.getDefaults(); 
   44.23 +  CommandDestroy command_destroy = new CommandDestroy();
   44.24 +
   44.25 +  String domains[] = hsrw.getParameterValues("dom");
   44.26 +  boolean force = hsrw.getParameter("force").equals("true");
   44.27 +
   44.28 +  for (int i = 0; i < domains.length; i++)
   44.29 +  {
   44.30 +%>
   44.31 +result <%= domains[i] %> =
   44.32 + <%= command_destroy.executeCommand(d, Integer.parseInt(domains[i]),
   44.33 +                                    force) %> <br>
   44.34 +<%
   44.35 +  }
   44.36 +%>
   44.37 +
   44.38 +</td>
   44.39 +</tbody>
   44.40 +</table>
   44.41 +
   44.42 +
   44.43 +
   44.44 +
   44.45 +<!-- end content -->
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/tools/control/web/tmpl/dom-lis.tmpl	Fri May 16 09:35:50 2003 +0000
    45.3 @@ -0,0 +1,50 @@
    45.4 +Domain List
    45.5 +SECTION&XenoServers
    45.6 +BREADCRUMB&Domain Manager&dom.jsp
    45.7 +
    45.8 +<!-- content -->
    45.9 +<img src="pixel.gif" class="block" width="1" height="12">
   45.10 +
   45.11 +<table cellpadding="0" cellspacing="0" border="0">
   45.12 +<tbody>
   45.13 +INCLUDE&dommenu.tmpl
   45.14 +<td valign="top">
   45.15 +
   45.16 +<%
   45.17 +  CommandList command_list = new CommandList();
   45.18 +  Defaults d = sc.getDefaults(); 
   45.19 +  Domain domains[] = command_list.executeCommand(d);
   45.20 +%>
   45.21 +
   45.22 +<table cellpadding="2" cellspacing="0" border="0">
   45.23 +<tbody>
   45.24 +  <tr class="vdh"><td>domain<br>id</td><td>processor</td><td>has<br>cpu</td><td>state</td><td>mcu<br>advance</td><td>total<br>pages</td><td>name</td></tr>
   45.25 +  <%
   45.26 +    /* assert: domains != null, otherwise, where is the servlet engine? */
   45.27 +    for (int loop = 0; loop < domains.length; loop++)
   45.28 +    {
   45.29 +  %>
   45.30 +  <tr>
   45.31 +    <td align="center"><%= domains[loop].id %></td>
   45.32 +    <td align="center"><%= domains[loop].processor %></td>
   45.33 +    <td align="center"><%= domains[loop].cpu %> </td>
   45.34 +    <td><%= domains[loop].state %> </td>
   45.35 +    <td align="center"><%= domains[loop].mcu %> </td>
   45.36 +    <td align="center"><%= domains[loop].pages %> </td>
   45.37 +    <td><%= domains[loop].name %> </td>
   45.38 +  </tr>
   45.39 +  <%
   45.40 +    }
   45.41 +  %>
   45.42 +</tbody>
   45.43 +</table>
   45.44 +
   45.45 +
   45.46 +</td>
   45.47 +</tbody>
   45.48 +</table>
   45.49 +
   45.50 +
   45.51 +
   45.52 +
   45.53 +<!-- end content -->
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/tools/control/web/tmpl/dom-new.tmpl	Fri May 16 09:35:50 2003 +0000
    46.3 @@ -0,0 +1,197 @@
    46.4 +Create New Domain
    46.5 +SECTION&XenoServers
    46.6 +BREADCRUMB&Domain Manager&dom.jsp
    46.7 +
    46.8 +<!-- content -->
    46.9 +<img src="pixel.gif" class="block" width="1" height="12">
   46.10 +
   46.11 +<table cellpadding="0" cellspacing="0" border="0">
   46.12 +<tbody>
   46.13 +INCLUDE&dommenu.tmpl
   46.14 +<td valign="top">
   46.15 +
   46.16 +<form method="post" action="dom-newr.jsp">
   46.17 +<table cellpadding="0" cellspacing="0" border="0">
   46.18 +<tbody>
   46.19 +<tr>
   46.20 +  <td width="10"></td>
   46.21 +  <td></td>
   46.22 +  <td></td>
   46.23 +  <td width="7"></td>
   46.24 +  <td></td>
   46.25 +</tr>
   46.26 +
   46.27 +<tr>
   46.28 +  <td></td>
   46.29 +  <td class="block" colspan=4><b>Create A New Domain</b></td>
   46.30 +</tr>
   46.31 +
   46.32 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   46.33 +
   46.34 +<%
   46.35 +  Defaults d = sc.getDefaults(); 
   46.36 +
   46.37 +  if (d == null)
   46.38 +  {
   46.39 +%>
   46.40 +  <b>ACK Defaults IS NULL</b>
   46.41 +<%
   46.42 +  }
   46.43 +%>
   46.44 +
   46.45 +<tr>
   46.46 +  <td></td>
   46.47 +  <td class="block" colspan=4>Domain Name</td>
   46.48 +</tr>
   46.49 +<tr>
   46.50 +  <td></td>  <td></td>  <td></td>  <td></td>
   46.51 +  <td> <input type="text" size="16" name="name" value="<%= d.domainName %>"> 
   46.52 +  </td>
   46.53 +</tr>
   46.54 +
   46.55 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   46.56 +
   46.57 +<tr>
   46.58 +  <td></td>
   46.59 +  <td class="block" colspan=4>Memory Size</td>
   46.60 +</tr>
   46.61 +<tr>
   46.62 +  <td></td>  <td></td>  <td></td>  <td></td>
   46.63 +  <td> 
   46.64 +    <input type="text" size="5" name="size" value="<%= d.domainSizeKB %>"> KB 
   46.65 +  </td>
   46.66 +</tr>
   46.67 +
   46.68 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   46.69 +
   46.70 +<tr>
   46.71 +  <td></td>
   46.72 +  <td class="block" colspan=4>Kernel Image</td>
   46.73 +</tr>
   46.74 +<tr>
   46.75 +  <td></td> 
   46.76 +  <td colspan=2 align="right">path</td>
   46.77 +  <td></td>
   46.78 +  <td> 
   46.79 +    <input type="text" size="40" name="image" value="<%= d.domainImage %>"> 
   46.80 +  </td>
   46.81 +</tr>
   46.82 +
   46.83 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   46.84 +
   46.85 +<tr>
   46.86 +  <td></td>
   46.87 +  <td class="block" colspan=4>IP Config</td>
   46.88 +</tr>
   46.89 +<tr>
   46.90 +  <td></td> <td></td>
   46.91 +  <td class="block" align="right">VIFs</td>
   46.92 +  <td></td>
   46.93 +  <td> 
   46.94 +    <input type="text" size="4" name="vifs" value="<%= d.domainVIFs %>"> 
   46.95 +  </td>
   46.96 +</tr>
   46.97 +<tr>
   46.98 +  <td></td> <td></td>
   46.99 +  <td class="block" align="right">IP address</td>
  46.100 +  <td></td>
  46.101 +  <td> <input type="text" size="15" name="ip" value="<%= d.NWIP %>"> </td>
  46.102 +</tr>
  46.103 +<tr>
  46.104 +  <td></td>   <td></td> 
  46.105 +  <td class="block" align="right">Gateway</td>
  46.106 +  <td></td>
  46.107 +  <td> <input type="text" size="15" name="gw" value="<%= d.NWGW %>"> </td>
  46.108 +</tr>
  46.109 +<tr>
  46.110 +  <td></td>   <td></td> 
  46.111 +  <td class="block" align="right">Netmask</td>
  46.112 +  <td></td>
  46.113 +  <td> <input type="text" size="15" name="mask" value="<%= d.NWMask %>"> </td>
  46.114 +</tr>
  46.115 +
  46.116 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
  46.117 +
  46.118 +<tr>
  46.119 +  <td></td>
  46.120 +  <td class="block" colspan=2>Root File System</td>
  46.121 +</tr>
  46.122 +
  46.123 +##WHITESPACE##
  46.124 +
  46.125 +<tr>
  46.126 +  <td></td>
  46.127 +  <td align="right">NFS<input type="radio" name="root" value="nfs"></td>
  46.128 +  <td align="right">path</td>
  46.129 +  <td></td>
  46.130 +  <td>
  46.131 +    <input type="text" size="40" name="nfsroot" value="<%= d.NWNFSRoot %>">
  46.132 +  </td>
  46.133 +</tr>
  46.134 +<tr>
  46.135 +  <td></td>  <td></td>
  46.136 +  <td align="right">server</td>
  46.137 +  <td></td>
  46.138 +  <td>
  46.139 +    <input type="text" size="15" name="nfsserver" value="<%= d.NWNFSServer%>">
  46.140 +  </td>
  46.141 +</tr>
  46.142 + ##WHITESPACE##
  46.143 +<tr>
  46.144 +  <td></td>
  46.145 +  <td align="right">ramdisk<input type="radio" name="root" value="ram"></td>
  46.146 +  <td align="right">path</td>
  46.147 +  <td></td>
  46.148 +  <td>
  46.149 +    <input type="text" size="40" name="rd" value="/usr/isolinux/initrd.gz">
  46.150 +  </td>
  46.151 +</tr>
  46.152 + ##WHITESPACE##
  46.153 +<tr>
  46.154 +  <td></td>
  46.155 +  <td align="right">physical disk<input type="radio" checked name="root" value="pdisk"></td>
  46.156 +  <td align="right">path</td>
  46.157 +  <td></td>
  46.158 +  <td><input type="text" size="40" name="pdisk" value="/dev/sda8"></td>
  46.159 +</tr>
  46.160 +<tr>
  46.161 +  <td></td>
  46.162 +  <td align="right">virtual disk<input type="radio" checked name="root" value="vdisk"></td>
  46.163 +  <td align="right">path</td>
  46.164 +  <td></td>
  46.165 +  <td><input type="text" size="40" name="vdisk" value="/dev/xvda1"></td>
  46.166 +</tr>
  46.167 +
  46.168 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
  46.169 +
  46.170 +<tr>
  46.171 +  <td></td>
  46.172 +  <td class="block" colspan=4>Extra Arguments</td>
  46.173 +</tr>
  46.174 +<tr>
  46.175 +  <td></td> 
  46.176 +  <td colspan=2 align="right"></td>
  46.177 +  <td></td>
  46.178 +  <td> <input type="text" size="40" name="args" value="ro"> </td>
  46.179 +</tr>
  46.180 +
  46.181 +
  46.182 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
  46.183 +
  46.184 +<tr>
  46.185 +  <td></td>
  46.186 +  <td><input type="submit" value="create domain"></td>
  46.187 +</tr>
  46.188 +
  46.189 +</tbody>
  46.190 +</table>
  46.191 +</form>
  46.192 +
  46.193 +</td>
  46.194 +</tbody>
  46.195 +</table>
  46.196 +
  46.197 +
  46.198 +
  46.199 +
  46.200 +<!-- end content -->
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/tools/control/web/tmpl/dom-newr.tmpl	Fri May 16 09:35:50 2003 +0000
    47.3 @@ -0,0 +1,100 @@
    47.4 +Create New Domain
    47.5 +SECTION&XenoServers
    47.6 +BREADCRUMB&Domain Manager&dom.jsp
    47.7 +
    47.8 +<!-- content -->
    47.9 +<img src="pixel.gif" class="block" width="1" height="12">
   47.10 +
   47.11 +<table cellpadding="0" cellspacing="0" border="0">
   47.12 +<tbody>
   47.13 +INCLUDE&dommenu.tmpl
   47.14 +<td valign="top">
   47.15 +
   47.16 +<b>Create Domain Results</b>
   47.17 +<br>
   47.18 +
   47.19 +<%
   47.20 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   47.21 +  Defaults d = sc.getDefaults(); 
   47.22 +  CommandNew command_new = new CommandNew();
   47.23 +  String root_device = hsrw.getParameter("root");
   47.24 +
   47.25 +  String nfsroot = null;
   47.26 +  String nfsserver = null;
   47.27 +  String rd = null;
   47.28 +  String disk = null;
   47.29 +
   47.30 +  if (root_device.equals("nfs"))
   47.31 +  {
   47.32 +    nfsroot = hsrw.getParameter("nfsroot");
   47.33 +    nfsserver = hsrw.getParameter("nfsserver");
   47.34 +    disk = "/dev/nfs";
   47.35 +  }
   47.36 +  else if (root_device.equals("ram"))
   47.37 +  {
   47.38 +    nfsserver = hsrw.getParameter("nfsserver");
   47.39 +    rd = hsrw.getParameter("rd");
   47.40 +  }
   47.41 +  else if (root_device.equals("pdisk"))
   47.42 +  {
   47.43 +    nfsserver = hsrw.getParameter("nfsserver");
   47.44 +    disk = hsrw.getParameter("pdisk");
   47.45 +  }
   47.46 +  else if (root_device.equals("vdisk"))
   47.47 +  {
   47.48 +    nfsserver = hsrw.getParameter("nfsserver");
   47.49 +    disk = hsrw.getParameter("vdisk");
   47.50 +  }
   47.51 +
   47.52 +%>
   47.53 +name = <%= hsrw.getParameter("name") %>
   47.54 +<br>
   47.55 +size = <%= hsrw.getParameter("size") %>
   47.56 +<br>
   47.57 +image = <%= hsrw.getParameter("image") %>
   47.58 +<br>
   47.59 +initrd = <%= rd %>
   47.60 +<br>
   47.61 +vifs = <%= hsrw.getParameter("vifs") %>
   47.62 +<br>
   47.63 +bargs = <%= hsrw.getParameter("args") %>
   47.64 +<br>
   47.65 +nfs_root_path = <%= nfsroot %>
   47.66 +<br>
   47.67 +nw_ip = <%= hsrw.getParameter("ip") %>
   47.68 +<br>
   47.69 +nw_gw = <%= hsrw.getParameter("gw") %>
   47.70 +<br>
   47.71 +nw_mask = <%= hsrw.getParameter("mask") %>
   47.72 +<br>
   47.73 +nw_nfs_server = <%= nfsserver %>
   47.74 +<br>
   47.75 +nw_host = <%= hsrw.getParameter("hostname") %>
   47.76 +<br>
   47.77 +root = <%= disk %>
   47.78 +<br>
   47.79 +output = <br><%=
   47.80 +  command_new.executeCommand(d,
   47.81 +                             hsrw.getParameter("name"),
   47.82 +                             Integer.parseInt(hsrw.getParameter("size")),
   47.83 +                             hsrw.getParameter("image"),
   47.84 +                             rd,
   47.85 +                             Integer.parseInt(hsrw.getParameter("vifs")),
   47.86 +                             hsrw.getParameter("args"),
   47.87 +                             disk,
   47.88 +                             nfsroot,
   47.89 +                             hsrw.getParameter("ip"),
   47.90 +                             hsrw.getParameter("gw"),
   47.91 +                             hsrw.getParameter("mask"),
   47.92 +                             nfsserver,
   47.93 +                             hsrw.getParameter("hostname"))
   47.94 +%>
   47.95 +
   47.96 +</td>
   47.97 +</tbody>
   47.98 +</table>
   47.99 +
  47.100 +
  47.101 +
  47.102 +
  47.103 +<!-- end content -->
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/tools/control/web/tmpl/dom-sta.tmpl	Fri May 16 09:35:50 2003 +0000
    48.3 @@ -0,0 +1,64 @@
    48.4 +Start Domain
    48.5 +SECTION&XenoServers
    48.6 +BREADCRUMB&Domain Manager&dom.jsp
    48.7 +
    48.8 +<!-- content -->
    48.9 +<img src="pixel.gif" class="block" width="1" height="12">
   48.10 +
   48.11 +<table cellpadding="0" cellspacing="0" border="0">
   48.12 +<tbody>
   48.13 +INCLUDE&dommenu.tmpl
   48.14 +<td valign="top">
   48.15 +
   48.16 +<form method="post" action="dom-star.jsp">
   48.17 +<table cellpadding="0" cellspacing="0" border="0">
   48.18 +<tbody>
   48.19 +<tr><td>
   48.20 +<%
   48.21 +  CommandList command_list = new CommandList();
   48.22 +  Defaults d = sc.getDefaults(); 
   48.23 +  Domain domains[] = command_list.executeCommand(d);
   48.24 +%>
   48.25 +
   48.26 +<table cellpadding="2" cellspacing="0" border="0">
   48.27 +<tbody>
   48.28 +  <tr class="vdh"><td></td><td>domain<br>id</td><td>processor</td><td>has<br>cpu</td><td>state</td><td>mcu<br>advance</td><td>total<br>pages</td><td>name</td></tr>
   48.29 +  <%
   48.30 +    for (int loop = 0; loop < domains.length; loop++)
   48.31 +    {
   48.32 +  %>
   48.33 +  <tr class="vdt">
   48.34 +    <td><input type="checkbox" name="dom" value="<%= domains[loop].id %>"></td>
   48.35 +    <td align="center"><%= domains[loop].id %></td>
   48.36 +    <td align="center"><%= domains[loop].processor %></td>
   48.37 +    <td align="center"><%= domains[loop].cpu %> </td>
   48.38 +    <td><%= domains[loop].state %> </td>
   48.39 +    <td align="center"><%= domains[loop].mcu %> </td>
   48.40 +    <td align="center"><%= domains[loop].pages %> </td>
   48.41 +    <td><%= domains[loop].name %> </td>
   48.42 +  </tr>
   48.43 +  <%
   48.44 +    }
   48.45 +  %>
   48.46 +
   48.47 +</tbody>
   48.48 +</table>
   48.49 +</td></tr>
   48.50 +
   48.51 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   48.52 +
   48.53 +<tr>
   48.54 +  <td><input type="submit" name="action" value="start domain"></td>
   48.55 +</tr>
   48.56 +</tbody>
   48.57 +</table>
   48.58 +</form>
   48.59 +
   48.60 +</td>
   48.61 +</tbody>
   48.62 +</table>
   48.63 +
   48.64 +
   48.65 +
   48.66 +
   48.67 +<!-- end content -->
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/tools/control/web/tmpl/dom-star.tmpl	Fri May 16 09:35:50 2003 +0000
    49.3 @@ -0,0 +1,40 @@
    49.4 +Start Domain
    49.5 +SECTION&XenoServers
    49.6 +BREADCRUMB&Domain Manager&dom.jsp
    49.7 +
    49.8 +<!-- content -->
    49.9 +<img src="pixel.gif" class="block" width="1" height="12">
   49.10 +
   49.11 +<table cellpadding="0" cellspacing="0" border="0">
   49.12 +<tbody>
   49.13 +INCLUDE&dommenu.tmpl
   49.14 +<td valign="top">
   49.15 +
   49.16 +
   49.17 +<b>Start Domain Results</b>
   49.18 +<br>
   49.19 +
   49.20 +<%
   49.21 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   49.22 +  Defaults d = sc.getDefaults(); 
   49.23 +  CommandStart command_start = new CommandStart();
   49.24 +
   49.25 +  String domains[] = hsrw.getParameterValues("dom");
   49.26 +
   49.27 +  for (int i = 0; i < domains.length; i++)
   49.28 +  {
   49.29 +%>
   49.30 +result <%= domains[i] %> =
   49.31 + <%= command_start.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
   49.32 +<%
   49.33 +  }
   49.34 +%>
   49.35 +
   49.36 +</td>
   49.37 +</tbody>
   49.38 +</table>
   49.39 +
   49.40 +
   49.41 +
   49.42 +
   49.43 +<!-- end content -->
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/tools/control/web/tmpl/dom-stp.tmpl	Fri May 16 09:35:50 2003 +0000
    50.3 @@ -0,0 +1,64 @@
    50.4 +Stop Domain
    50.5 +SECTION&XenoServers
    50.6 +BREADCRUMB&Domain Manager&dom.jsp
    50.7 +
    50.8 +<!-- content -->
    50.9 +<img src="pixel.gif" class="block" width="1" height="12">
   50.10 +
   50.11 +<table cellpadding="0" cellspacing="0" border="0">
   50.12 +<tbody>
   50.13 +INCLUDE&dommenu.tmpl
   50.14 +<td valign="top">
   50.15 +
   50.16 +<form method="post" action="dom-stpr.jsp">
   50.17 +<table cellpadding="0" cellspacing="0" border="0">
   50.18 +<tbody>
   50.19 +<tr><td>
   50.20 +<%
   50.21 +  CommandList command_list = new CommandList();
   50.22 +  Defaults d = sc.getDefaults(); 
   50.23 +  Domain domains[] = command_list.executeCommand(d);
   50.24 +%>
   50.25 +
   50.26 +<table cellpadding="2" cellspacing="0" border="0">
   50.27 +<tbody>
   50.28 +  <tr class="vdh"><td></td><td>domain<br>id</td><td>processor</td><td>has<br>cpu</td><td>state</td><td>mcu<br>advance</td><td>total<br>pages</td><td>name</td></tr>
   50.29 +  <%
   50.30 +    for (int loop = 0; loop < domains.length; loop++)
   50.31 +    {
   50.32 +  %>
   50.33 +  <tr class="vdt">
   50.34 +    <td><input type="checkbox" name="dom" value="<%= domains[loop].id %>"></td>
   50.35 +    <td align="center"><%= domains[loop].id %></td>
   50.36 +    <td align="center"><%= domains[loop].processor %></td>
   50.37 +    <td align="center"><%= domains[loop].cpu %> </td>
   50.38 +    <td><%= domains[loop].state %> </td>
   50.39 +    <td align="center"><%= domains[loop].mcu %> </td>
   50.40 +    <td align="center"><%= domains[loop].pages %> </td>
   50.41 +    <td><%= domains[loop].name %> </td>
   50.42 +  </tr>
   50.43 +  <%
   50.44 +    }
   50.45 +  %>
   50.46 +
   50.47 +</tbody>
   50.48 +</table>
   50.49 +</td></tr>
   50.50 +
   50.51 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   50.52 +
   50.53 +<tr>
   50.54 +  <td><input type="submit" name="action" value="stop domain"></td>
   50.55 +</tr>
   50.56 +</tbody>
   50.57 +</table>
   50.58 +</form>
   50.59 +
   50.60 +</td>
   50.61 +</tbody>
   50.62 +</table>
   50.63 +
   50.64 +
   50.65 +
   50.66 +
   50.67 +<!-- end content -->
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/tools/control/web/tmpl/dom-stpr.tmpl	Fri May 16 09:35:50 2003 +0000
    51.3 @@ -0,0 +1,40 @@
    51.4 +Stop Domain
    51.5 +SECTION&XenoServers
    51.6 +BREADCRUMB&Domain Manager&dom.jsp
    51.7 +
    51.8 +<!-- content -->
    51.9 +<img src="pixel.gif" class="block" width="1" height="12">
   51.10 +
   51.11 +<table cellpadding="0" cellspacing="0" border="0">
   51.12 +<tbody>
   51.13 +INCLUDE&dommenu.tmpl
   51.14 +<td valign="top">
   51.15 +
   51.16 +
   51.17 +<b>Stop Domain Results</b>
   51.18 +<br>
   51.19 +
   51.20 +<%
   51.21 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   51.22 +  Defaults d = sc.getDefaults(); 
   51.23 +  CommandStop command_stop = new CommandStop();
   51.24 +
   51.25 +  String domains[] = hsrw.getParameterValues("dom");
   51.26 +
   51.27 +  for (int i = 0; i < domains.length; i++)
   51.28 +  {
   51.29 +%>
   51.30 +result <%= domains[i] %> =
   51.31 + <%= command_stop.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
   51.32 +<%
   51.33 +  }
   51.34 +%>
   51.35 +
   51.36 +</td>
   51.37 +</tbody>
   51.38 +</table>
   51.39 +
   51.40 +
   51.41 +
   51.42 +
   51.43 +<!-- end content -->
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/tools/control/web/tmpl/dom.tmpl	Fri May 16 09:35:50 2003 +0000
    52.3 @@ -0,0 +1,30 @@
    52.4 +Domain Manager
    52.5 +SECTION&XenoServers
    52.6 +
    52.7 +<!-- content -->
    52.8 +<img src="pixel.gif" class="block" width="1" height="12">
    52.9 +
   52.10 +<table cellpadding="0" cellspacing="0" border="0">
   52.11 +<tbody>
   52.12 +INCLUDE&dommenu.tmpl
   52.13 +<td valign="top">
   52.14 +<table cellpadding="0" cellspacing="0" border="0">
   52.15 +<tbody>
   52.16 +<%
   52.17 +  Defaults d = sc.getDefaults(); 
   52.18 +%>
   52.19 +  <tr><td nowrap="nowrap">Domain Manager</td></tr>
   52.20 +  <tr><td></td></tr>
   52.21 +<!--
   52.22 +  <tr><td><%= d.XIToolsDir %></td></tr>
   52.23 +-->
   52.24 +</tbody>
   52.25 +</table>
   52.26 +</td>
   52.27 +</tbody>
   52.28 +</table>
   52.29 +
   52.30 +
   52.31 +
   52.32 +
   52.33 +<!-- end content -->
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/tools/control/web/tmpl/dommenu.tmpl	Fri May 16 09:35:50 2003 +0000
    53.3 @@ -0,0 +1,33 @@
    53.4 +<td width="10" valign="top" align="right"></td>
    53.5 +
    53.6 +<td valign="top">
    53.7 +<table cellpadding="0" cellspacing="0" border="0">
    53.8 +<tbody>
    53.9 +<tr>
   53.10 +  <td class="menuheader" width="100">Domains</td>
   53.11 +</tr>
   53.12 +<tr>
   53.13 +  <td class="sidemenu" width="100"><a href="dom-lis.jsp">List</a></td>
   53.14 +</tr>
   53.15 +<tr>
   53.16 +  <td class="sidemenu" width="100"><a href="dom-new.jsp">New</a></td>
   53.17 +</tr>
   53.18 +<tr>
   53.19 +  <td class="sidemenu" width="100"><a href="dom-sta.jsp">Start</a></td>
   53.20 +</tr>
   53.21 +<tr>
   53.22 +  <td class="sidemenu" width="100"><a href="dom-stp.jsp">Stop</a></td>
   53.23 +</tr>
   53.24 +<tr>
   53.25 +  <td class="sidemenu" width="100"><a href="dom-del.jsp">Delete</a></td>
   53.26 +</tr>
   53.27 +
   53.28 +</tbody>
   53.29 +</table>
   53.30 +</td>
   53.31 +
   53.32 +<td width="5" valign="top" align="right"></td>
   53.33 +
   53.34 +<td bgcolor="#666666" width="2"><img src="img/pixel.gif" class="block" width="2" height="50"></td>
   53.35 +
   53.36 +<td width="15" valign="top" align="right"></td>
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/tools/control/web/tmpl/help.tmpl	Fri May 16 09:35:50 2003 +0000
    54.3 @@ -0,0 +1,61 @@
    54.4 +Help
    54.5 +SECTION&XenoServers
    54.6 +
    54.7 +<!-- content -->
    54.8 +<img src="img/pixel.gif" class="block" width="1" height="12" alt="">
    54.9 +<table cellpadding="0" cellspacing="0" border="0" summary="page content">
   54.10 +<tbody><tr>
   54.11 +   <td width="250" valign="top" align="right">
   54.12 +     <a href="http://www.cl.cam.ac.uk/newlabphotos/"><img width="191" heigth="65" src="img/xeno.gif" border="0"></a>
   54.13 +
   54.14 +<table cellpadding="0" cellspacing="0" border="0" align="right">
   54.15 +<tbody><tr>
   54.16 +  <td><img src="img/pixel.gif" class="block" width="20" height="1" alt=""></td>
   54.17 +</tr>
   54.18 +<tr>
   54.19 +  <td colspan="3"><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   54.20 +</tr>
   54.21 +<tr>
   54.22 +  <td align="right">
   54.23 +  <table width="180" ><tbody><tr><td><p align="right">
   54.24 +The XenoServer project aims to build a public infrastructure for wide-area distributed computing.
   54.25 +</p>
   54.26 +  </td></tr></tbody></table></td>
   54.27 +<td><img src="img/pixel.gif" class="block" width="10" height="1" alt=""></td>
   54.28 +</tr>
   54.29 +</tbody></table>
   54.30 +</td>
   54.31 +<td bgcolor="#666666" width="2"><img src="img/pixel.gif" class="block" width="2" height="50" alt=""></td>
   54.32 +<td width="20"><img src="img/pixel.gif" class="block" width="20" height="1" alt=""></td>
   54.33 +<td valign="top">
   54.34 +
   54.35 +<!-- main navigation -->
   54.36 +<table cellpadding="0" cellspacing="0" border="0">
   54.37 +
   54.38 +<tbody><tr> <!-- list of menu items -->
   54.39 +  <td nowrap="nowrap">
   54.40 +    <b>Help</b>
   54.41 +</td>
   54.42 +</tr>
   54.43 +
   54.44 +<tr> <!-- blank white space -->
   54.45 +  <td><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   54.46 +</tr>
   54.47 +
   54.48 +<tr> <!-- grey line -->
   54.49 +  <td bgcolor="#cccccc"><img src="img/pixel.gif" class="block" width="1" height="2" alt=""></td>
   54.50 +</tr>
   54.51 +
   54.52 +<tr> <!-- blank white space -->
   54.53 +  <td><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   54.54 +</tr>
   54.55 +
   54.56 +<tr> <!-- list of menu items -->
   54.57 +  <td nowrap="nowrap">Some help text will go here.
   54.58 +   </td>
   54.59 +</tr>
   54.60 +</tbody></table>
   54.61 +</td>
   54.62 +</tr>
   54.63 +</tbody></table>
   54.64 +<!-- end content -->
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/tools/control/web/tmpl/index.tmpl	Fri May 16 09:35:50 2003 +0000
    55.3 @@ -0,0 +1,66 @@
    55.4 +XenoServers
    55.5 +COPYRIGHT&Computer Laboratory, University of Cambridge
    55.6 +
    55.7 +<!-- content -->
    55.8 +<img src="img/pixel.gif" class="block" width="1" height="12" alt="">
    55.9 +<table cellpadding="0" cellspacing="0" border="0" summary="page content">
   55.10 +<tbody><tr>
   55.11 +   <td width="250" valign="top" align="right">
   55.12 +     <a href="http://www.cl.cam.ac.uk/xeno"><img width="191" heigth="65" src="img/xeno.gif" border="0"></a>
   55.13 +
   55.14 +<table cellpadding="0" cellspacing="0" border="0" align="right">
   55.15 +<tbody>
   55.16 +<tr>
   55.17 +  <td><img src="img/pixel.gif" class="block" width="20" height="1" alt=""></td>
   55.18 +</tr>
   55.19 +<tr>
   55.20 +  <td colspan="2"><img src="img/pixel.gif" class="block" width="1" height="10" alt=""></td>
   55.21 +</tr>
   55.22 +<tr>
   55.23 +  <td align="right">
   55.24 +  <table width="180" ><tbody><tr><td><p align="right">
   55.25 +    The XenoServer project aims to build a public infrastructure 
   55.26 +    for wide-area distributed computing.
   55.27 +  </td></tr></tbody></table></td>
   55.28 +<td><img src="img/pixel.gif" class="block" width="10" height="1" alt=""></td>
   55.29 +</tr>
   55.30 +</tbody></table>
   55.31 +</td>
   55.32 +<td bgcolor="#666666" width="2"><img src="img/pixel.gif" class="block" width="2" height="50" alt=""></td>
   55.33 +<td width="20"><img src="img/pixel.gif" class="block" width="20" height="1" alt=""></td>
   55.34 +<td valign="top">
   55.35 +
   55.36 +<!-- main navigation -->
   55.37 +<table cellpadding="0" cellspacing="0" border="0">
   55.38 +
   55.39 +<tbody><tr> <!-- list of menu items -->
   55.40 +  <td nowrap="nowrap">
   55.41 +   <a href="about.jsp" class="homemenu">About the XenoServers Project</a><br>
   55.42 +</td>
   55.43 +</tr>
   55.44 +
   55.45 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   55.46 +
   55.47 +<tr>
   55.48 +  <td nowrap="nowrap">
   55.49 +   <a href="dom.jsp" class="homemenu">Domain Manager</a><br>
   55.50 +   <a href="vd.jsp" class="homemenu">Virtual Disk Manager</a><br>
   55.51 +   </td>
   55.52 +</tr>
   55.53 +
   55.54 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   55.55 +
   55.56 +<tr>
   55.57 +  <td nowrap="nowrap">
   55.58 +    For additional information, click 
   55.59 +    <a href="http://www.xenoserver.org">here</a>
   55.60 +  </td>
   55.61 +</tr>
   55.62 +
   55.63 +
   55.64 +##WHITESPACE##
   55.65 +</tbody></table>
   55.66 +</td>
   55.67 +</tr>
   55.68 +</tbody></table>
   55.69 +<!-- end content -->
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/tools/control/web/tmpl/install.pl	Fri May 16 09:35:50 2003 +0000
    56.3 @@ -0,0 +1,236 @@
    56.4 +#!/usr/bin/perl5
    56.5 +if($#ARGV<0) {
    56.6 +    &usage();
    56.7 +} else {
    56.8 +
    56.9 +    $headerfile = "xenohead.def" ;
   56.10 +    $footerfile = "xenofoot.def" ;
   56.11 +
   56.12 +    $sectionbreak = "-" ;
   56.13 +    $supress_section = 0 ;
   56.14 +    $homepage = 0 ;
   56.15 +    $navigationwidth = 106;
   56.16 +    $navigationstring = "<td><a href=\"index.jsp\"><img src=\"img/home.gif\" width=\"53\" height=\"18\" border=\"0\" alt=\"XenoServers Home Page\" class=\"block\" /></a></td>";
   56.17 +    $whitespace = "<tr><td><img src=\"img/pixel.gif\" class=\"block\" width=\"1\" height=\"10\"></td></tr>";
   56.18 +    $greyline1 = "<tr><td bgcolor=\"#cccccc\"><img src=\"img/pixel.gif\" class=\"block\" width=\"1\" height=\"2\"></td></tr>";
   56.19 +    $greyline2 = "<tr><td bgcolor=\"#cccccc\" colspan=\"2\"><img src=\"img/pixel.gif\" class=\"block\" width=\"1\" height=\"2\"></td></tr>";
   56.20 +    $greyline3 = "<tr><td bgcolor=\"#cccccc\" colspan=\"3\"><img src=\"img/pixel.gif\" class=\"block\" width=\"1\" height=\"2\"></td></tr>";
   56.21 +    $greyline4 = "<tr><td bgcolor=\"#cccccc\" colspan=\"4\"><img src=\"img/pixel.gif\" class=\"block\" width=\"1\" height=\"2\"></td></tr>";
   56.22 +    $greyline14 = "<tr><td></td><td bgcolor=\"#cccccc\" colspan=\"4\"><img src=\"img/pixel.gif\" class=\"block\" width=\"1\" height=\"2\"></td></tr>";
   56.23 +
   56.24 +
   56.25 +    $login = getlogin || (getpwuid($<))[0] || "an unidentified user" ;
   56.26 +
   56.27 +    $name =`finger $login | sed -n "s/Login.*:.*: //p"` ;
   56.28 +    if( $name eq "" ) { $name = $login ; }
   56.29 +
   56.30 +    $date =  `date +"on %-e-%b-%Y at %H:%M"` ;
   56.31 +
   56.32 +    $year =  `date +"%Y"` ;
   56.33 +
   56.34 +    foreach $ag (@ARGV) {
   56.35 +
   56.36 +	if( $ag =~ "^-s" ) {
   56.37 +	    $supress_section = 1 ;
   56.38 +	}
   56.39 +	elsif( $ag =~ "^-home" ) {
   56.40 +	    $homepage = 1 ;
   56.41 +	}
   56.42 +	else {
   56.43 +
   56.44 +	    $preagtmp = $ag . ".tmpl~$$";
   56.45 +            $agtmp    = $ag . ".jsp~$$";
   56.46 +
   56.47 +	    open(PRETMPL,">$preagtmp") or die "Unable to write $preagtmp\n";
   56.48 +	    print PRETMPL &doIncludes("$ag.tmpl");
   56.49 +	    close(PRETMPL);
   56.50 +
   56.51 +	    open(TMPL,"<$preagtmp") or die "Unable to read $preagtmp\n";
   56.52 +
   56.53 +	    open(HTML,">$agtmp") or die "Unable to open $agtmp\n" ;
   56.54 +
   56.55 +	    $title=<TMPL> ;
   56.56 +
   56.57 +	    $sectionhead = "XenoServers" ;
   56.58 +	    $copyright = "Computer Laboratory, University of Cambridge" ;
   56.59 +	    $breadcrumbline = "" ;
   56.60 +	    $commentcontact="<a href=\"mailto:pagemaster\@cl.cam.ac.uk\">pagemaster\@cl.cam.ac.uk</a>" ;
   56.61 +
   56.62 +	    $process_headings = 1 ;
   56.63 +	    $tmp=<TMPL> ;
   56.64 +	    while( $process_headings ) {
   56.65 +		$process_headings = 0 ;
   56.66 +
   56.67 +		if( $tmp =~ /^SECTION&(.*)$/ ) {
   56.68 +		    $sectionhead=$1 ;
   56.69 +		    $process_headings = 1 ;
   56.70 +		}
   56.71 +
   56.72 +		if( $tmp =~ /^COMMENTS&(.*)$/ ) {
   56.73 +		    $commentcontact=$1 ;
   56.74 +		    $process_headings = 1 ;
   56.75 +		}
   56.76 +
   56.77 +		if( $tmp =~ /^COPYRIGHT&(.*)$/ ) {
   56.78 +		    $copyright=$1 ;
   56.79 +		    $process_headings = 1 ;
   56.80 +		}
   56.81 +
   56.82 +		if( $tmp =~ /^HEADERFILE&(.*)$/ ) {
   56.83 +		    $headerfile=$1 ;
   56.84 +		    $process_headings = 1 ;
   56.85 +		}
   56.86 +
   56.87 +		if( $tmp =~ /^FOOTERFILE&(.*)$/ ) {
   56.88 +		    $footerfile=$1 ;
   56.89 +		    $process_headings = 1 ;
   56.90 +		}
   56.91 +
   56.92 +		if( $tmp =~ /BREADCRUMB&.*/ ) {
   56.93 +		    @bread=split(/&/,$tmp) ;
   56.94 +		    @bwords=split(/ /, @bread[1]) ;
   56.95 +		    $bname=@bwords[0] ;
   56.96 +		    for( $i=1 ; $i <= $#bwords ; $i++ ){
   56.97 +			$bname = $bname . "&nbsp;" . @bwords[$i] ;
   56.98 +		    }
   56.99 +		    $breadcrumbline = $breadcrumbline . "&nbsp;&gt;&nbsp;<a href=\"" . @bread[2] . "\"class=\"bread\">" . $bname . "</a>" ; 
  56.100 +		    $process_headings = 1 ;
  56.101 +		}
  56.102 +
  56.103 +		if( $process_headings ) {
  56.104 +		    $tmp=<TMPL> ;
  56.105 +		}
  56.106 +	    }
  56.107 +
  56.108 +#### generate the final breadcrumb which is the current file itself
  56.109 +	    @path=split(/\//, $ag) ;
  56.110 +	    $localfilename=@path[$#path] . ".jsp" ;
  56.111 +	    @bwords=split(/ /, $title) ;
  56.112 +	    $bname=@bwords[0] ;
  56.113 +	    for( $i=1 ; $i <= $#bwords ; $i++ ){
  56.114 +		$bname = $bname . "&nbsp;" . @bwords[$i] ;
  56.115 +	    }
  56.116 +	    $breadcrumbline = $breadcrumbline . "&nbsp;&gt;&nbsp;<a href=\"" . $localfilename . "\" class=\"bread\">" . $bname . "</a>" ; 
  56.117 +
  56.118 +
  56.119 +#### if suppressing the section header then do so now
  56.120 +	    if( $supress_section ) {
  56.121 +		$sectionhead = "" ;
  56.122 +		$sectionbreak = "" ;
  56.123 +	    }
  56.124 +
  56.125 +#### if homepage then do so now
  56.126 +	    if( $homepage ) {
  56.127 +		$breadcrumbline = "" ;
  56.128 +                $navigationwidth = 53;
  56.129 +                $navigationstring = "";
  56.130 +	    }
  56.131 +
  56.132 +
  56.133 +	    open(HEADER,"<$headerfile") or die "Unable to open $headerfile\n" ;
  56.134 +	    while(<HEADER>) {
  56.135 +		s/##TITLE##/$title/g ;
  56.136 +		s/##SECTION##/$sectionhead/g ;
  56.137 +		s/##SECTIONBREAK##/$sectionbreak/g ;
  56.138 +		s/##BREADCRUMBS##/$breadcrumbline/g ;
  56.139 +		s/##FILENAME##/$ag.jsp/g ;
  56.140 +		s/##DATE##/$date/g ;
  56.141 +		s/##OWNERNAME##/$name/g ;
  56.142 +		s/##OWNERUSERID##/$login/g ;
  56.143 +		s/##OWNEREMAIL##/$login\@cl.cam.ac.uk/g ;
  56.144 +		s/##COMMENTCONTACT##/$commentcontact/g ;
  56.145 +		s/##COPYRIGHT##/$copyright/g ;
  56.146 +		s/##YEAR##/$year/g ;
  56.147 +		s/##NAVIGATIONWIDTH##/$navigationwidth/g ;
  56.148 +		s/##NAVIGATIONSTRING##/$navigationstring/g ;
  56.149 +		print HTML $_ ;
  56.150 +	    }
  56.151 +	    close(HEADER) ;
  56.152 +
  56.153 +	    $_ = $tmp ;
  56.154 +	    while(defined($_)) {
  56.155 +		s/##LISTSTART##/<ul>/g ;
  56.156 +		s/##ITEMHEAD##/<li>/g ;
  56.157 +		s/##ITEMBODY##/<br \/>/g ;
  56.158 +		s|##LISTEND##|</ul>|g ;
  56.159 +		s/##TITLE##/$title/g ;
  56.160 +		s/##SECTION##/$sectionhead/g ;
  56.161 +		s/##BREADCRUMBS##/$breadcrumbline/g ;
  56.162 +		s/##FILENAME##/$ag.jsp/g ;
  56.163 +		s/##DATE##/$date/g ;
  56.164 +		s/##OWNERNAME##/$name/g ;
  56.165 +		s/##OWNERUSERID##/$login/g ;
  56.166 +		s/##OWNEREMAIL##/$login\@cl.cam.ac.uk/g ;
  56.167 +		s/##COMMENTCONTACT##/$commentcontact/g ;
  56.168 +		s/##COPYRIGHT##/$copyright/g ;
  56.169 +		s/##YEAR##/$year/g ;
  56.170 +		s/##WHITESPACE##/$whitespace/g ;
  56.171 +		s/##GREYLINE1##/$greyline1/g ;
  56.172 +		s/##GREYLINE2##/$greyline2/g ;
  56.173 +		s/##GREYLINE3##/$greyline3/g ;
  56.174 +		s/##GREYLINE4##/$greyline4/g ;
  56.175 +		s/##GREYLINE14##/$greyline14/g ;
  56.176 +		print HTML $_ ;
  56.177 +		$_ = <TMPL>
  56.178 +		}
  56.179 +	    open(FOOTER,"<$footerfile") or die "Unable to open $footerfile\n" ;
  56.180 +	    while(<FOOTER>) {
  56.181 +		s/##TITLE##/$title/g ;
  56.182 +		s/##SECTION##/$sectionhead/g ;
  56.183 +		s/##BREADCRUMBS##/$breadcrumbline/g ;
  56.184 +		s/##FILENAME##/$ag.jsp/g ;
  56.185 +		s/##DATE##/$date/g ;
  56.186 +		s/##OWNERNAME##/$name/g ;
  56.187 +		s/##OWNERUSERID##/$login/g ;
  56.188 +		s/##OWNEREMAIL##/$login\@cl.cam.ac.uk/g ;
  56.189 +		s/##COMMENTCONTACT##/$commentcontact/g ;
  56.190 +		s/##COPYRIGHT##/$copyright/g ;
  56.191 +		s/##YEAR##/$year/g ;
  56.192 +		print HTML $_ ;
  56.193 +	    }
  56.194 +	    close(FOOTER) ;
  56.195 +	    close(HTML);
  56.196 +	    close(TMPL);
  56.197 +
  56.198 +	    if( system "mv $agtmp $ag.jsp" ) {
  56.199 +		die "Unable to rename $agtmp to $ag.jsp\n" ; ;
  56.200 +	    }
  56.201 +	    if( system "rm $preagtmp" ) {
  56.202 +		die "Unable to remove $preagtmp\n" ; ;
  56.203 +	    }
  56.204 +	}
  56.205 +    }
  56.206 +}
  56.207 +
  56.208 +sub usage
  56.209 +{
  56.210 +    print "Usage: install.pl [-s] <name>\n";
  56.211 +    print "       Installs web page <name>.jsp based on <name>.tmpl\n";
  56.212 +    print "       -s supresses the generation of any section title";
  56.213 +    print "          which says `Computer Laboratory' in the default" ;
  56.214 +    print "          case or is specified by SECTION& in the .tmpl file" ;
  56.215 +    exit;
  56.216 +}
  56.217 +
  56.218 +sub doIncludes
  56.219 +{
  56.220 +    my $infile=$_[0];
  56.221 +    my $out="";
  56.222 +    my $tmp;
  56.223 +    my $incfile;
  56.224 +    my @lines;
  56.225 +    my $line;
  56.226 +
  56.227 +    open(FIN,"<$infile") or die "doIncludes unable to read from $infile\n";
  56.228 +    @lines=<FIN>;
  56.229 +    close(FIN);
  56.230 +    foreach $line (@lines) {
  56.231 +	if( $line =~ /^INCLUDE&.*/ ) {
  56.232 +	    ($tmp,$incfile) = split(/&/,$line);
  56.233 +	    $out=$out.&doIncludes($incfile);
  56.234 +	} else {
  56.235 +	    $out=$out.$line;
  56.236 +	}
  56.237 +    }
  56.238 +    return $out;
  56.239 +}
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/tools/control/web/tmpl/makefile	Fri May 16 09:35:50 2003 +0000
    57.3 @@ -0,0 +1,35 @@
    57.4 +src0 = xenostyle.css
    57.5 +src1 = index.jsp newdom.jsp about.jsp help.jsp vd.jsp \
    57.6 +       vd-pv.jsp vd-pa.jsp vd-vdv.jsp vd-vdc.jsp vd-vdd.jsp vd-vdr.jsp \
    57.7 +       vd-fv.jsp vd-vbdv.jsp vd-vbdc.jsp vd-vbdd.jsp vd-vbdf.jsp \
    57.8 +       vd-par.jsp vd-vdcr.jsp vd-vddr.jsp vd-vdrr.jsp \
    57.9 +       vd-vbdcr.jsp vd-vbdfr.jsp \
   57.10 +       dom.jsp dom-lis.jsp dom-new.jsp dom-newr.jsp dom-sta.jsp dom-star.jsp \
   57.11 +       dom-stp.jsp dom-stpr.jsp dom-del.jsp dom-delr.jsp
   57.12 +target = ..
   57.13 +target1 = $(target)/index.jsp $(target)/newdom.jsp $(target)/vd.jsp \
   57.14 +          $(target)/vd-pv.jsp $(target)/vd-pa.jsp $(target)/vd-vdv.jsp \
   57.15 +          $(target)/vd-vdc.jsp $(target)/vd-vdd.jsp $(target)/vd-vdr.jsp \
   57.16 +          $(target)/vd-fv.jsp $(target)/vd-vbdv.jsp $(target)/vd-vbdc.jsp \
   57.17 +          $(target)/vd-vbdd.jsp $(target)/vd-vbdf.jsp \
   57.18 +          $(target)/about.jsp $(target)/help.jsp \
   57.19 +          $(target)/vd-par.jsp $(target)/vd-vdcr.jsp $(target)/vd-vddr.jsp \
   57.20 +          $(target)/vd-vdrr.jsp $(target)/vd-vbdcr.jsp $(target)/vd-vbdfr.jsp \
   57.21 +          $(target)/dom.jsp $(target)/dom-lis.jsp $(target)/dom-new.jsp \
   57.22 +          $(target)/dom-newr.jsp $(target)/dom-sta.jsp $(target)/dom-star.jsp \
   57.23 +          $(target)/dom-stp.jsp $(target)/dom-stpr.jsp \
   57.24 +          $(target)/dom-del.jsp $(target)/dom-delr.jsp
   57.25 +
   57.26 +.SUFFIXES: .tmpl .jsp
   57.27 +
   57.28 +.tmpl.jsp:
   57.29 +	./install.pl $*
   57.30 +
   57.31 +all: $(src0) $(src1)
   57.32 +	./install.pl -s -home index
   57.33 +	mv *.jsp  $(target)
   57.34 +	cp $(src0) $(target)
   57.35 +
   57.36 +clean:
   57.37 +	rm -f $(target1)
   57.38 +	rm -f $(target)/$(src0)
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/tools/control/web/tmpl/newdom.tmpl	Fri May 16 09:35:50 2003 +0000
    58.3 @@ -0,0 +1,172 @@
    58.4 +New Domain
    58.5 +SECTION&XenoServers
    58.6 +
    58.7 +<!-- content -->
    58.8 +<img src="pixel.gif" class="block" width="1" height="12">
    58.9 +
   58.10 +<form>
   58.11 +<table cellpadding="0" cellspacing="0" border="0">
   58.12 +<tbody>
   58.13 +<tr>
   58.14 +  <td width="50"></td>
   58.15 +  <td></td>
   58.16 +  <td></td>
   58.17 +  <td width="7"></td>
   58.18 +  <td></td>
   58.19 +</tr>
   58.20 +
   58.21 +<tr>
   58.22 +  <td></td>
   58.23 +  <td class="block" colspan=4><b>Create A New Domain</b></td>
   58.24 +</tr>
   58.25 +
   58.26 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   58.27 +
   58.28 +<tr>
   58.29 +  <td></td>
   58.30 +  <td class="block" colspan=4>Memory Size</td>
   58.31 +</tr>
   58.32 +<tr>
   58.33 +  <td></td>  <td></td>  <td></td>  <td></td>
   58.34 +  <td> <input type="text" size="5" value="64"> MB </td>
   58.35 +</tr>
   58.36 +
   58.37 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   58.38 +
   58.39 +<tr>
   58.40 +  <td></td>
   58.41 +  <td class="block" colspan=4>Kernel Image</td>
   58.42 +</tr>
   58.43 +<tr>
   58.44 +  <td></td> 
   58.45 +  <td colspan=2 align="right">path</td>
   58.46 +  <td></td>
   58.47 +  <td> <input type="text" size="40" value="/usr/src/xeno/install/xenolinux.gz"> </td>
   58.48 +</tr>
   58.49 +
   58.50 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   58.51 +
   58.52 +<tr>
   58.53 +  <td></td>
   58.54 +  <td class="block" colspan=4>IP Config</td>
   58.55 +</tr>
   58.56 +<tr>
   58.57 +  <td></td> <td></td>
   58.58 +  <td class="block" align="right">IP address</td>
   58.59 +  <td></td>
   58.60 +  <td> <input type="text" size="15" value="128.232.35.202"> </td>
   58.61 +</tr>
   58.62 +<tr>
   58.63 +  <td></td>   <td></td> 
   58.64 +  <td class="block" align="right">Gateway</td>
   58.65 +  <td></td>
   58.66 +  <td> <input type="text" size="15" value="128.232.32.1"> </td>
   58.67 +</tr>
   58.68 +<tr>
   58.69 +  <td></td>   <td></td> 
   58.70 +  <td class="block" align="right">Netmask</td>
   58.71 +  <td></td>
   58.72 +  <td> <input type="text" size="15" value="255.255.240.0"> </td>
   58.73 +</tr>
   58.74 +<tr>
   58.75 +  <td></td>   <td></td> 
   58.76 +  <td class="block" align="right">New Name</td>
   58.77 +  <td></td>
   58.78 +  <td> <input type="text" size="15"> </td>
   58.79 +</tr>
   58.80 +
   58.81 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
   58.82 +
   58.83 +<tr>
   58.84 +  <td></td>
   58.85 +  <td class="block" colspan=2>Root File System</td>
   58.86 +</tr>
   58.87 +
   58.88 +##WHITESPACE##
   58.89 +
   58.90 +<tr>
   58.91 +  <td></td>
   58.92 +  <td align="right">NFS<input type="radio" name="root" value="nfs"></td>
   58.93 +  <td align="right">path</td>
   58.94 +  <td></td>
   58.95 +  <td><input type="text" size="40" value="/usr/groups/xeno/srgboot/mousetrap/root0"></td>
   58.96 +</tr>
   58.97 +<tr>
   58.98 +  <td></td>  <td></td>
   58.99 +  <td align="right">server</td>
  58.100 +  <td></td>
  58.101 +  <td><input type="text" size="15" value="128.232.32.20"></td>
  58.102 +</tr>
  58.103 + ##WHITESPACE##
  58.104 +<tr>
  58.105 +  <td></td>
  58.106 +  <td align="right">ramdisk<input type="radio" name="root" value="ram"></td>
  58.107 +  <td align="right">path</td>
  58.108 +  <td></td>
  58.109 +  <td><input type="text" size="40" value="/usr/isolinux/initrd.gz"></td>
  58.110 +</tr>
  58.111 + ##WHITESPACE##
  58.112 +<tr>
  58.113 +  <td></td>
  58.114 +  <td align="right">raw partition<input type="radio" name="root" value="raw"></td>
  58.115 +  <td align="right">path</td>
  58.116 +  <td></td>
  58.117 +  <td><input type="text" size="40" value="/dev/xsda8"></td>
  58.118 +</tr>
  58.119 + ##WHITESPACE##
  58.120 +<tr>
  58.121 +  <td></td>
  58.122 +  <td align="right">virtual disk<input type="radio" checked name="root" value="virtual"></td>
  58.123 +  <td align="right">path</td>
  58.124 +  <td></td>
  58.125 +  <td><input type="text" size="40" value="/dev/xvda0"></td>
  58.126 +</tr>
  58.127 +
  58.128 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
  58.129 +
  58.130 +<tr>
  58.131 +  <td></td>
  58.132 +  <td class="block" colspan=4>Extra Arguments</td>
  58.133 +</tr>
  58.134 +<tr>
  58.135 +  <td></td> 
  58.136 +  <td colspan=2 align="right"></td>
  58.137 +  <td></td>
  58.138 +  <td> <input type="text" size="40"> </td>
  58.139 +</tr>
  58.140 +
  58.141 +
  58.142 +##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
  58.143 +
  58.144 +<tr>
  58.145 +  <td></td>
  58.146 +  <td><input type="submit" value="refresh"></td>
  58.147 +</tr>
  58.148 +
  58.149 +##WHITESPACE## 
  58.150 +
  58.151 +<tr>
  58.152 +  <td></td>
  58.153 +  <td colspan=4>
  58.154 +  <textarea cols="60" rows="5" name="commandline">
  58.155 +When you press refresh, the sample command line shows
  58.156 +up here. The user has the option of editing it before
  58.157 +pressing execute below.  e.g.
  58.158 +./newdom 16000 image 128.232.35.202 ip=128.232.35.202:128.232.32.20:128.232.32.1:255.255.240.0::eth0:off root=/dev/xsda9 ro
  58.159 +</textarea>
  58.160 +</td></tr>
  58.161 +
  58.162 +##WHITESPACE## 
  58.163 +
  58.164 +<tr>
  58.165 +  <td></td>
  58.166 +  <td><input type="submit" value="execute"></td>
  58.167 +</tr>
  58.168 +
  58.169 +</tbody>
  58.170 +</table>
  58.171 +</form>
  58.172 +
  58.173 +
  58.174 +
  58.175 +<!-- end content -->
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/tools/control/web/tmpl/vd-fv.tmpl	Fri May 16 09:35:50 2003 +0000
    59.3 @@ -0,0 +1,60 @@
    59.4 +View Free Space
    59.5 +SECTION&XenoServers
    59.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    59.7 +
    59.8 +<!-- content -->
    59.9 +<img src="pixel.gif" class="block" width="1" height="12">
   59.10 +
   59.11 +<table cellpadding="0" cellspacing="0" border="0">
   59.12 +<tbody>
   59.13 +INCLUDE&vdmenu.tmpl
   59.14 +<td valign="top">
   59.15 +
   59.16 +
   59.17 +<table cellpadding="0" cellspacing="0" border="0">
   59.18 +<tbody>
   59.19 +
   59.20 +<tr><td>
   59.21 +<table cellpadding="2" cellspacing="0" border="0">
   59.22 +<tbody>
   59.23 +  <tr class="vdh"><td>idx</td><td>disk</td><td>offset</td><td>size </td></tr>
   59.24 +
   59.25 +  <%
   59.26 +    long space = 0;
   59.27 +    int count = root.getFreeExtentCount();
   59.28 +    for (int loop = 0; loop < count; loop++)
   59.29 +    {
   59.30 +      Extent e = root.getFreeExtent(loop);
   59.31 +      space += e.getSize();
   59.32 +  %>
   59.33 +  <tr class="vdt">
   59.34 +  <td              ><%= loop %></td>
   59.35 +  <td              ><%= e.getDisk() %></td>
   59.36 +  <td align="right"><%= e.getOffset() %> </td>
   59.37 +  <td align="right"><%= e.getSize() %> </td>
   59.38 +  </tr>
   59.39 +  <%
   59.40 +    }
   59.41 +  %>
   59.42 +</tbody>
   59.43 +</table>
   59.44 +</td></tr>
   59.45 +
   59.46 +
   59.47 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   59.48 +
   59.49 +<tr><td>
   59.50 +Total available freespace: <%= space * 512 / (1024 * 1024) %> MB
   59.51 +</td></tr>
   59.52 +
   59.53 +</tbody>
   59.54 +</table>
   59.55 +
   59.56 +</td>
   59.57 +</tbody>
   59.58 +</table>
   59.59 +
   59.60 +
   59.61 +
   59.62 +
   59.63 +<!-- end content -->
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/tools/control/web/tmpl/vd-pa.tmpl	Fri May 16 09:35:50 2003 +0000
    60.3 @@ -0,0 +1,97 @@
    60.4 +Add Partition
    60.5 +SECTION&XenoServers
    60.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    60.7 +
    60.8 +<!-- content -->
    60.9 +<img src="pixel.gif" class="block" width="1" height="12">
   60.10 +
   60.11 +<table cellpadding="0" cellspacing="0" border="0">
   60.12 +<tbody>
   60.13 +INCLUDE&vdmenu.tmpl
   60.14 +<td valign="top">
   60.15 +
   60.16 +<form method="post" action="vd-par.jsp">
   60.17 +<table cellpadding="0" cellspacing="0" border="0">
   60.18 +<tbody>
   60.19 +
   60.20 +<tr><td>
   60.21 +
   60.22 +<table cellpadding="2" cellspacing="0" border="0">
   60.23 +<tbody>
   60.24 +  <tr class="vdh"><td></td><td>maj:min</td><td>blocks</td><td>start sect</td><td>num sects</td><td>name</td></tr>
   60.25 +  <%
   60.26 +    int count = root.getPartitionCount();
   60.27 +    for (int loop = 0; loop < count; loop++)
   60.28 +    {
   60.29 +	Partition p = root.getPartition(loop);
   60.30 +	if (p.getIsXeno() == true)
   60.31 +        {
   60.32 +  %>
   60.33 +  <tr class="vds"><td></td>
   60.34 +  <%
   60.35 +        }
   60.36 +        else
   60.37 +        {
   60.38 +  %>
   60.39 +  <tr class="vdt">
   60.40 +    <td><input type="checkbox" name="p" value="<%= p.getName() %>"></td>
   60.41 +  <%
   60.42 +        }
   60.43 +  %>
   60.44 +    <td><%= p.getMajor() %>:<%= p.getMinor() %></td>
   60.45 +    <td align="right"><%= p.getBlocks() %></td>
   60.46 +    <td align="right"><%= p.getStartSect() %> </td>
   60.47 +    <td align="right"><%= p.getNumSects() %> </td>
   60.48 +    <td><%= p.getName() %> </td>
   60.49 +  </tr>
   60.50 +  <%
   60.51 +    }
   60.52 +  %>
   60.53 +</tbody>
   60.54 +</table>
   60.55 +
   60.56 +</td></tr>
   60.57 +
   60.58 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   60.59 +
   60.60 +
   60.61 +<tr><td>
   60.62 +<table cellpadding="0" cellspacing="0" border="0">
   60.63 +<tbody>
   60.64 +
   60.65 +<tr>
   60.66 +  <td width="50"></td>
   60.67 +  <td width="7"></td>
   60.68 +  <td></td>
   60.69 +</tr>
   60.70 +
   60.71 +<tr>
   60.72 +  <td align="right">chunksize</td>
   60.73 +  <td></td>
   60.74 +  <td> <input type="text" size="5" name="chunk" value="256">
   60.75 +       <input type="radio" name="chunkunits" value="m" checked>MB
   60.76 +       <input type="radio" name="chunkunits" value="g">GB
   60.77 +  </td>
   60.78 +</tr>
   60.79 +</tbody>
   60.80 +</table>
   60.81 +</td></tr>
   60.82 +
   60.83 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   60.84 +
   60.85 +<tr>
   60.86 +  <td><input type="submit" name="action" value="add partition"></td>
   60.87 +</tr>
   60.88 +
   60.89 +</tbody>
   60.90 +</table>
   60.91 +</form>
   60.92 +
   60.93 +</td>
   60.94 +</tbody>
   60.95 +</table>
   60.96 +
   60.97 +
   60.98 +
   60.99 +
  60.100 +<!-- end content -->
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/tools/control/web/tmpl/vd-par.tmpl	Fri May 16 09:35:50 2003 +0000
    61.3 @@ -0,0 +1,49 @@
    61.4 +Add Partition Results
    61.5 +SECTION&XenoServers
    61.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    61.7 +
    61.8 +<!-- content -->
    61.9 +<img src="pixel.gif" class="block" width="1" height="12">
   61.10 +
   61.11 +<table cellpadding="0" cellspacing="0" border="0">
   61.12 +<tbody>
   61.13 +INCLUDE&vdmenu.tmpl
   61.14 +<td valign="top">
   61.15 +
   61.16 +<b>Add Partition Results</b>
   61.17 +<br>
   61.18 +
   61.19 +<%
   61.20 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   61.21 +
   61.22 +  String partitions[] = hsrw.getParameterValues("p");
   61.23 +  String size = hsrw.getParameter("chunk").trim() +
   61.24 +                hsrw.getParameter("chunkunits").trim();
   61.25 +
   61.26 +  for (int i = 0; i < partitions.length; i++)
   61.27 +  {
   61.28 +%>
   61.29 +p = <%= root.doAddPartition(partitions[i], size) %> <br>
   61.30 +<%
   61.31 +  }
   61.32 +%>
   61.33 +chunk = <%= hsrw.getParameter("chunk") %>
   61.34 +<br>
   61.35 +chunkunits = <%= hsrw.getParameter("chunkunits") %>
   61.36 +<br>
   61.37 +size = <%= size %>
   61.38 +<br>
   61.39 +
   61.40 +
   61.41 +<%
   61.42 +  root.doFlushState();
   61.43 +%>
   61.44 +
   61.45 +
   61.46 +</td>
   61.47 +</tbody>
   61.48 +</table>
   61.49 +
   61.50 +
   61.51 +
   61.52 +<!-- end content -->
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/tools/control/web/tmpl/vd-pv.tmpl	Fri May 16 09:35:50 2003 +0000
    62.3 @@ -0,0 +1,54 @@
    62.4 +View Partitions
    62.5 +SECTION&XenoServers
    62.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    62.7 +
    62.8 +<!-- content -->
    62.9 +<img src="pixel.gif" class="block" width="1" height="12">
   62.10 +
   62.11 +<table cellpadding="0" cellspacing="0" border="0">
   62.12 +<tbody>
   62.13 +INCLUDE&vdmenu.tmpl
   62.14 +<td valign="top">
   62.15 +note: highlighted entries are currently being used as xeno partitions.
   62.16 +<br><br>
   62.17 +
   62.18 +<table cellpadding="2" cellspacing="0" border="0">
   62.19 +<tbody>
   62.20 +  <tr class="vdh"><td>maj:min</td><td>blocks</td><td>start sect</td><td>num sects</td><td>name</td></tr>
   62.21 +  <%
   62.22 +    int count = root.getPartitionCount();
   62.23 +    for (int loop = 0; loop < count; loop++)
   62.24 +    {
   62.25 +      Partition p = root.getPartition(loop);
   62.26 +      if (p.getIsXeno() == true)
   62.27 +      {
   62.28 +  %>
   62.29 +  <tr class="vds">
   62.30 +  <%
   62.31 +      }
   62.32 +      else
   62.33 +      {
   62.34 +  %>
   62.35 +  <tr class="vdt">
   62.36 +  <%
   62.37 +     }
   62.38 +  %>
   62.39 +  <td><%= p.getMajor() %>:<%= p.getMinor() %></td>
   62.40 +  <td align="right"><%= p.getBlocks() %></td>
   62.41 +  <td align="right"><%= p.getStartSect() %> </td>
   62.42 +  <td align="right"><%= p.getNumSects() %> </td>
   62.43 +  <td><%= p.getName() %> </td>
   62.44 +  <%
   62.45 +    }
   62.46 +  %>
   62.47 +</tbody>
   62.48 +</table>
   62.49 +
   62.50 +</td>
   62.51 +</tbody>
   62.52 +</table>
   62.53 +
   62.54 +
   62.55 +
   62.56 +
   62.57 +<!-- end content -->
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/tools/control/web/tmpl/vd-vbdc.tmpl	Fri May 16 09:35:50 2003 +0000
    63.3 @@ -0,0 +1,94 @@
    63.4 +Create Virtual Block Device
    63.5 +SECTION&XenoServers
    63.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    63.7 +
    63.8 +<!-- content -->
    63.9 +<img src="pixel.gif" class="block" width="1" height="12">
   63.10 +
   63.11 +<table cellpadding="0" cellspacing="0" border="0">
   63.12 +<tbody>
   63.13 +INCLUDE&vdmenu.tmpl
   63.14 +<td valign="top">
   63.15 +
   63.16 +<form method="post" action="vd-vbdcr.jsp">
   63.17 +<table cellpadding="0" cellspacing="0" border="0">
   63.18 +<tbody>
   63.19 +<tr><td>
   63.20 +<table cellpadding="2" cellspacing="0" border="0">
   63.21 +<tbody>
   63.22 +  <tr class="vdh"><td></td><td>vd key</td><td width="5"></td><td>name</td><td width="5"></td><td>expiry</td></tr>
   63.23 +
   63.24 +  <%
   63.25 +    int count = root.getVirtualDiskCount();
   63.26 +    for (int loop = 0; loop < count; loop++)
   63.27 +    {
   63.28 +      VirtualDisk vd = root.getVirtualDisk(loop);
   63.29 +  %>
   63.30 +    <tr class="vdt">
   63.31 +      <td>
   63.32 +        <input type="radio" name="vd" 
   63.33 +               <% if (loop == 0) { %> checked <% } %>
   63.34 +               value="<%= vd.getKey() %>">
   63.35 +      </td>
   63.36 +      <td><%= vd.getKey() %></td>
   63.37 +      <td></td>
   63.38 +      <td><%= vd.getName() %></td>
   63.39 +      <td></td>
   63.40 +      <td><%= vd.getExpiry() %></td>
   63.41 +    </tr>
   63.42 +  <%
   63.43 +    }
   63.44 +  %>
   63.45 +
   63.46 +</tbody>
   63.47 +</table>
   63.48 +</td></tr>
   63.49 +
   63.50 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   63.51 +
   63.52 +<tr><td>
   63.53 +<table cellpadding="0" cellspacing="0" border="0">
   63.54 +<tbody>
   63.55 +
   63.56 +<tr>
   63.57 +  <td width="100"></td>
   63.58 +  <td width="7"></td>
   63.59 +  <td></td>
   63.60 +</tr>
   63.61 +
   63.62 +<tr>
   63.63 +  <td align="right">domain</td>
   63.64 +  <td></td>
   63.65 +  <td> <input type="text" size="3" name="domain"> </td>
   63.66 +</tr>
   63.67 +<tr>
   63.68 +  <td align="right">vbd number</td>
   63.69 +  <td></td>
   63.70 +  <td> <input type="text" size="3" name="vbd"> </td>
   63.71 +</tr>
   63.72 +<tr>
   63.73 +  <td align="right"></td>
   63.74 +  <td></td>
   63.75 +  <td> <input type="radio" name="mode" value="ro" checked>RO
   63.76 +       <input type="radio" name="mode" value="rw">RW</td>
   63.77 +</tr>
   63.78 +</tbody>
   63.79 +</table>
   63.80 +</td></tr>
   63.81 +
   63.82 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   63.83 +
   63.84 +<tr>
   63.85 +  <td><input type="submit" name="action" value="create virtual block device"></td>
   63.86 +</tr>
   63.87 +</table>
   63.88 +</form>
   63.89 +
   63.90 +</td>
   63.91 +</tbody>
   63.92 +</table>
   63.93 +
   63.94 +
   63.95 +
   63.96 +
   63.97 +<!-- end content -->
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/tools/control/web/tmpl/vd-vbdcr.tmpl	Fri May 16 09:35:50 2003 +0000
    64.3 @@ -0,0 +1,44 @@
    64.4 +Create Virtual Block Device
    64.5 +SECTION&XenoServers
    64.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    64.7 +
    64.8 +<!-- content -->
    64.9 +<img src="pixel.gif" class="block" width="1" height="12">
   64.10 +
   64.11 +<table cellpadding="0" cellspacing="0" border="0">
   64.12 +<tbody>
   64.13 +INCLUDE&vdmenu.tmpl
   64.14 +<td valign="top">
   64.15 +
   64.16 +<b>Create Virtual Block Device Results</b>
   64.17 +<br>
   64.18 +
   64.19 +<%
   64.20 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   64.21 +%>
   64.22 +output = <%= root.doCreateVirtualBlockDevice(hsrw.getParameter("vd"),
   64.23 +                    Integer.decode(hsrw.getParameter("domain")).intValue(),
   64.24 +                    Integer.decode(hsrw.getParameter("vbd")).intValue(),
   64.25 +                                             hsrw.getParameter("mode"))
   64.26 +         %>
   64.27 +<br>
   64.28 +vd = <%= hsrw.getParameter("vd") %>
   64.29 +<br>
   64.30 +domain = <%= hsrw.getParameter("domain") %>
   64.31 +<br>
   64.32 +vbd = <%= hsrw.getParameter("vbd") %>
   64.33 +<br>
   64.34 +mode = <%= hsrw.getParameter("mode") %>
   64.35 +
   64.36 +<%
   64.37 +  root.doFlushState();
   64.38 +%>
   64.39 +
   64.40 +</td>
   64.41 +</tbody>
   64.42 +</table>
   64.43 +
   64.44 +
   64.45 +
   64.46 +
   64.47 +<!-- end content -->
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/tools/control/web/tmpl/vd-vbdd.tmpl	Fri May 16 09:35:50 2003 +0000
    65.3 @@ -0,0 +1,29 @@
    65.4 +Delete Virtual Block Devices
    65.5 +SECTION&XenoServers
    65.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    65.7 +
    65.8 +<!-- content -->
    65.9 +<img src="pixel.gif" class="block" width="1" height="12">
   65.10 +
   65.11 +<table cellpadding="0" cellspacing="0" border="0">
   65.12 +<tbody>
   65.13 +INCLUDE&vdmenu.tmpl
   65.14 +<td valign="top">
   65.15 +
   65.16 +<table cellpadding="0" cellspacing="0" border="0">
   65.17 +<tbody>
   65.18 +
   65.19 +<tr><td>
   65.20 +Not currently implemented.
   65.21 +</td></tr>
   65.22 +
   65.23 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   65.24 +
   65.25 +</td>
   65.26 +</tbody>
   65.27 +</table>
   65.28 +
   65.29 +
   65.30 +
   65.31 +
   65.32 +<!-- end content -->
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/tools/control/web/tmpl/vd-vbdf.tmpl	Fri May 16 09:35:50 2003 +0000
    66.3 @@ -0,0 +1,59 @@
    66.4 +Flush Virtual Block Devices
    66.5 +SECTION&XenoServers
    66.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    66.7 +
    66.8 +<!-- content -->
    66.9 +<img src="pixel.gif" class="block" width="1" height="12">
   66.10 +
   66.11 +<table cellpadding="0" cellspacing="0" border="0">
   66.12 +<tbody>
   66.13 +INCLUDE&vdmenu.tmpl
   66.14 +<td valign="top">
   66.15 +
   66.16 +<form method="post" action="vd-vbdfr.jsp">
   66.17 +<table cellpadding="0" cellspacing="0" border="0">
   66.18 +<tbody>
   66.19 +
   66.20 +<tr><td>
   66.21 +<table cellpadding="2" cellspacing="0" border="0">
   66.22 +<tbody>
   66.23 +  <tr class="vdh"><td>vd key</td><td>dom</td><td>vbd</td><td>mode</td></tr>
   66.24 +
   66.25 +  <%
   66.26 +    for (Enumeration e = root.getVirtualBlockDevices(); e.hasMoreElements();)
   66.27 +    {
   66.28 +      VirtualBlockDevice vbd = (VirtualBlockDevice) e.nextElement();
   66.29 +  %>
   66.30 +    <tr class="vdt">
   66.31 +      <td><%= vbd.getKey() %></td>
   66.32 +      <td><%= vbd.getDomain() %></td>
   66.33 +      <td><%= vbd.getVBDNum() %></td>
   66.34 +      <td><%= vbd.getMode().toString() %></td>
   66.35 +    </tr>
   66.36 +  <%
   66.37 +    }
   66.38 +  %>
   66.39 +
   66.40 +</tbody>
   66.41 +</table>
   66.42 +</td></tr>
   66.43 +
   66.44 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   66.45 +
   66.46 +<tr>
   66.47 +  <td><font color="red">Warning, this will remove all virtual block devices</font></td>
   66.48 +</tr>
   66.49 +
   66.50 +<tr>
   66.51 +  <td><input type="submit" value="flush all vbds"></td>
   66.52 +</tr>
   66.53 +</form>
   66.54 +
   66.55 +</td>
   66.56 +</tbody>
   66.57 +</table>
   66.58 +
   66.59 +
   66.60 +
   66.61 +
   66.62 +<!-- end content -->
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/tools/control/web/tmpl/vd-vbdfr.tmpl	Fri May 16 09:35:50 2003 +0000
    67.3 @@ -0,0 +1,32 @@
    67.4 +Flush Virtual Block Devices
    67.5 +SECTION&XenoServers
    67.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    67.7 +
    67.8 +<!-- content -->
    67.9 +<img src="pixel.gif" class="block" width="1" height="12">
   67.10 +
   67.11 +<table cellpadding="0" cellspacing="0" border="0">
   67.12 +<tbody>
   67.13 +INCLUDE&vdmenu.tmpl
   67.14 +<td valign="top">
   67.15 +
   67.16 +<b>Flush Virtual Block Device Results</b>
   67.17 +<br>
   67.18 +
   67.19 +
   67.20 +<%
   67.21 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   67.22 +%>
   67.23 +output = <%= root.doFlushVirtualBlockDevices()  %>
   67.24 +<%
   67.25 +  root.doFlushState();
   67.26 +%>
   67.27 +
   67.28 +</td>
   67.29 +</tbody>
   67.30 +</table>
   67.31 +
   67.32 +
   67.33 +
   67.34 +
   67.35 +<!-- end content -->
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/tools/control/web/tmpl/vd-vbdv.tmpl	Fri May 16 09:35:50 2003 +0000
    68.3 @@ -0,0 +1,44 @@
    68.4 +View Virtual Block Devices
    68.5 +SECTION&XenoServers
    68.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    68.7 +
    68.8 +<!-- content -->
    68.9 +<img src="pixel.gif" class="block" width="1" height="12">
   68.10 +
   68.11 +<table cellpadding="0" cellspacing="0" border="0">
   68.12 +<tbody>
   68.13 +INCLUDE&vdmenu.tmpl
   68.14 +<td valign="top">
   68.15 +
   68.16 +<table cellpadding="2" cellspacing="0" border="0">
   68.17 +<tbody>
   68.18 +  <tr class="vdh"><td>dom</td><td>vbd</td><td>mode</td><td>vd key</td><td>vd name</td></tr>
   68.19 +
   68.20 +
   68.21 +  <%
   68.22 +    for (Enumeration e = root.getVirtualBlockDevices(); e.hasMoreElements();)
   68.23 +    {
   68.24 +      VirtualBlockDevice vbd = (VirtualBlockDevice) e.nextElement();
   68.25 +      VirtualDisk vd = root.getVirtualDiskKey(vbd.getKey()); 
   68.26 +  %>
   68.27 +    <tr class="vdt">
   68.28 +      <td><%= vbd.getDomain() %></td>
   68.29 +      <td><%= vbd.getVBDNum() %></td>
   68.30 +      <td><%= vbd.getMode().toString() %></td>
   68.31 +      <td><%= vbd.getKey() %></td>
   68.32 +      <td><%= vd.getName() %></td>
   68.33 +    </tr>
   68.34 +  <%
   68.35 +    }
   68.36 +  %>
   68.37 +</tbody>
   68.38 +</table>
   68.39 +
   68.40 +</td>
   68.41 +</tbody>
   68.42 +</table>
   68.43 +
   68.44 +
   68.45 +
   68.46 +
   68.47 +<!-- end content -->
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/tools/control/web/tmpl/vd-vdc.tmpl	Fri May 16 09:35:50 2003 +0000
    69.3 @@ -0,0 +1,67 @@
    69.4 +Create New Virtual Disk
    69.5 +SECTION&XenoServers
    69.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    69.7 +
    69.8 +<!-- content -->
    69.9 +<img src="pixel.gif" class="block" width="1" height="12">
   69.10 +
   69.11 +<table cellpadding="0" cellspacing="0" border="0">
   69.12 +<tbody>
   69.13 +INCLUDE&vdmenu.tmpl
   69.14 +<td valign="top">
   69.15 +
   69.16 +<form method="post" action="vd-vdcr.jsp">
   69.17 +<table cellpadding="0" cellspacing="0" border="0">
   69.18 +<tbody>
   69.19 +
   69.20 +<tr>
   69.21 +  <td width="50"></td>
   69.22 +  <td width="7"></td>
   69.23 +  <td></td>
   69.24 +</tr>
   69.25 +
   69.26 +<tr>
   69.27 +  <td align="right">name</td>
   69.28 +  <td></td>
   69.29 +  <td> <input type="text" size="40" name="name" value="name of disk"> </td>
   69.30 +</tr>
   69.31 +
   69.32 +<tr>
   69.33 +  <td align="right">size</td>
   69.34 +  <td></td>
   69.35 +  <td> <input type="text" size="10" name="size">
   69.36 +       <input type="radio" name="sizeunits" value="mb" checked>MB
   69.37 +       <input type="radio" name="sizeunits" value="gb">GB
   69.38 +  </td>
   69.39 +</tr>
   69.40 +
   69.41 +<tr>
   69.42 +  <td align="right">expiry</td>
   69.43 +  <td></td>
   69.44 +  <td> <input type="text" size="3" name="expiry">
   69.45 +       <input type="radio" name="expiryunits" value="d" checked>days 
   69.46 +       <input type="radio" name="expiryunits" value="w">weeks
   69.47 +       <input type="radio" name="expiryunits" value="m">months
   69.48 +       <input type="radio" name="expiryunits" value="y">years
   69.49 +  </td>
   69.50 +</tr>
   69.51 +
   69.52 +##WHITESPACE## ##GREYLINE3## ##WHITESPACE##
   69.53 +
   69.54 +<tr>
   69.55 +  <td></td>
   69.56 +  <td></td>
   69.57 +  <td><input type="submit" name="action" value="create virtual disk"></td>
   69.58 +</tr>
   69.59 +
   69.60 +</tbody>
   69.61 +</table>
   69.62 +</form>
   69.63 +</td>
   69.64 +</tbody>
   69.65 +</table>
   69.66 +
   69.67 +
   69.68 +
   69.69 +
   69.70 +<!-- end content -->
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/tools/control/web/tmpl/vd-vdcr.tmpl	Fri May 16 09:35:50 2003 +0000
    70.3 @@ -0,0 +1,64 @@
    70.4 +Create New Virtual Disk
    70.5 +SECTION&XenoServers
    70.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    70.7 +
    70.8 +<!-- content -->
    70.9 +<img src="pixel.gif" class="block" width="1" height="12">
   70.10 +
   70.11 +<table cellpadding="0" cellspacing="0" border="0">
   70.12 +<tbody>
   70.13 +INCLUDE&vdmenu.tmpl
   70.14 +<td valign="top">
   70.15 +
   70.16 +
   70.17 +<b>Create Virtual Disk Results</b>
   70.18 +<br>
   70.19 +
   70.20 +<%
   70.21 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   70.22 +  String size = hsrw.getParameter("size").trim() +
   70.23 +                hsrw.getParameter("sizeunits").trim();
   70.24 +  long expiry = Long.decode(hsrw.getParameter("expiry")).longValue(); 
   70.25 +
   70.26 +  /* not perfect, but good enough for now... */
   70.27 +    if ( hsrw.getParameter("expiryunits").equals("d"))
   70.28 +  {
   70.29 +    expiry *= 24 * 60 * 60 * 1000;
   70.30 +  }
   70.31 +  else if ( hsrw.getParameter("expiryunits").equals("w"))
   70.32 +  {
   70.33 +    expiry *= 24 * 60 * 60 * 1000 * 7;
   70.34 +  }
   70.35 +  else if ( hsrw.getParameter("expiryunits").equals("m"))
   70.36 +  {
   70.37 +    expiry *= 24 * 60 * 60 * 1000 * 30;
   70.38 +  }
   70.39 +  else if ( hsrw.getParameter("expiryunits").equals("y"))
   70.40 +  {
   70.41 +    expiry *= 24 * 60 * 60 * 1000 * 365;
   70.42 +  }
   70.43 +
   70.44 +%>
   70.45 +output = <%= root.doCreateVirtualDisk( hsrw.getParameter("name"),
   70.46 +                                       size, expiry)
   70.47 +         %>
   70.48 +<br>
   70.49 +size = <%= size %>
   70.50 +<br>
   70.51 +expiry = <%= hsrw.getParameter("expiry") %>
   70.52 +<br>
   70.53 +expiryunits = <%= hsrw.getParameter("expiryunits") %>
   70.54 +<br>
   70.55 +
   70.56 +<%
   70.57 +  root.doFlushState();
   70.58 +%>
   70.59 +
   70.60 +</td>
   70.61 +</tbody>
   70.62 +</table>
   70.63 +
   70.64 +
   70.65 +
   70.66 +
   70.67 +<!-- end content -->
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/tools/control/web/tmpl/vd-vdd.tmpl	Fri May 16 09:35:50 2003 +0000
    71.3 @@ -0,0 +1,58 @@
    71.4 +Delete Virtual Disk
    71.5 +SECTION&XenoServers
    71.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    71.7 +
    71.8 +<!-- content -->
    71.9 +<img src="pixel.gif" class="block" width="1" height="12">
   71.10 +
   71.11 +<table cellpadding="0" cellspacing="0" border="0">
   71.12 +<tbody>
   71.13 +INCLUDE&vdmenu.tmpl
   71.14 +<td valign="top">
   71.15 +
   71.16 +<form method="post" action="vd-vddr.jsp">
   71.17 +<table cellpadding="0" cellspacing="0" border="0">
   71.18 +<tbody>
   71.19 +<tr><td>
   71.20 +<table cellpadding="2" cellspacing="0" border="0">
   71.21 +<tbody>
   71.22 +  <tr class="vdh"><td></td><td>key</td><td width="5"></td><td>name</td><td width="5"></td><td>expiry</td></tr>
   71.23 +
   71.24 +  <%
   71.25 +    int count = root.getVirtualDiskCount();
   71.26 +    for (int loop = 0; loop < count; loop++)
   71.27 +    {
   71.28 +      VirtualDisk vd = root.getVirtualDisk(loop);
   71.29 +  %>
   71.30 +    <tr class="vdt">
   71.31 +      <td><input type="checkbox" name="vd" value="<%= vd.getKey() %>"></td>
   71.32 +      <td><%= vd.getKey() %></td>
   71.33 +      <td></td>
   71.34 +      <td><%= vd.getName() %></td>
   71.35 +      <td></td>
   71.36 +      <td><%= vd.getExpiry() %></td>
   71.37 +    </tr>
   71.38 +  <%
   71.39 +    }
   71.40 +  %>
   71.41 +
   71.42 +
   71.43 +</tbody>
   71.44 +</table>
   71.45 +</td></tr>
   71.46 +
   71.47 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   71.48 +
   71.49 +<tr>
   71.50 +  <td><input type="submit" name="action" value="delete virtual disk"></td>
   71.51 +</tr>
   71.52 +</table>
   71.53 +</form>
   71.54 +</td>
   71.55 +</tbody>
   71.56 +</table>
   71.57 +
   71.58 +
   71.59 +
   71.60 +
   71.61 +<!-- end content -->
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/tools/control/web/tmpl/vd-vddr.tmpl	Fri May 16 09:35:50 2003 +0000
    72.3 @@ -0,0 +1,34 @@
    72.4 +Delete Virtual Disk
    72.5 +SECTION&XenoServers
    72.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    72.7 +
    72.8 +<!-- content -->
    72.9 +<img src="pixel.gif" class="block" width="1" height="12">
   72.10 +
   72.11 +<table cellpadding="0" cellspacing="0" border="0">
   72.12 +<tbody>
   72.13 +INCLUDE&vdmenu.tmpl
   72.14 +<td valign="top">
   72.15 +
   72.16 +<b>Delete Virtual Disk Results</b>
   72.17 +<br>
   72.18 +<%
   72.19 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   72.20 +%>
   72.21 +
   72.22 +vd= <%= hsrw.getParameter("vd") %>
   72.23 +
   72.24 +vd= <%= root.doDeleteVirtualDisk(hsrw.getParameter("vd")) %>
   72.25 +
   72.26 +<%
   72.27 +  root.doFlushState();
   72.28 +%>
   72.29 +
   72.30 +</td>
   72.31 +</tbody>
   72.32 +</table>
   72.33 +
   72.34 +
   72.35 +
   72.36 +
   72.37 +<!-- end content -->
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/tools/control/web/tmpl/vd-vdr.tmpl	Fri May 16 09:35:50 2003 +0000
    73.3 @@ -0,0 +1,83 @@
    73.4 +Refresh Virtual Disk
    73.5 +SECTION&XenoServers
    73.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    73.7 +
    73.8 +<!-- content -->
    73.9 +<img src="pixel.gif" class="block" width="1" height="12">
   73.10 +
   73.11 +<table cellpadding="0" cellspacing="0" border="0">
   73.12 +<tbody>
   73.13 +INCLUDE&vdmenu.tmpl
   73.14 +<td valign="top">
   73.15 +
   73.16 +<form method="post" action="vd-vdrr.jsp">
   73.17 +<table cellpadding="0" cellspacing="0" border="0">
   73.18 +<tbody>
   73.19 +<tr><td>
   73.20 +<table cellpadding="2" cellspacing="0" border="0">
   73.21 +<tbody>
   73.22 +  <tr class="vdh"><td></td><td>key</td><td width="5"></td><td>name</td><td width="5"></td><td>expiry</td></tr>
   73.23 +
   73.24 +  <%
   73.25 +    int count = root.getVirtualDiskCount();
   73.26 +    for (int loop = 0; loop < count; loop++)
   73.27 +    {
   73.28 +      VirtualDisk vd = root.getVirtualDisk(loop);
   73.29 +  %>
   73.30 +    <tr class="vdt">
   73.31 +      <td><input type="checkbox" name="vd" value="<%= vd.getKey() %>"></td>
   73.32 +      <td><%= vd.getKey() %></td>
   73.33 +      <td></td>
   73.34 +      <td><%= vd.getName() %></td>
   73.35 +      <td></td>
   73.36 +      <td><%= vd.getExpiry() %></td>
   73.37 +    </tr>
   73.38 +  <%
   73.39 +    }
   73.40 +  %>
   73.41 +
   73.42 +</tbody>
   73.43 +</table>
   73.44 +</td></tr>
   73.45 +
   73.46 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   73.47 +
   73.48 +<tr><td>
   73.49 +<table cellpadding="0" cellspacing="0" border="0">
   73.50 +<tbody>
   73.51 +
   73.52 +<tr>
   73.53 +  <td width="50"></td>
   73.54 +  <td width="7"></td>
   73.55 +  <td></td>
   73.56 +</tr>
   73.57 +
   73.58 +<tr>
   73.59 +  <td align="right">new<br>expiry</td>
   73.60 +  <td></td>
   73.61 +  <td> <input type="text" size="3" name="expiry">
   73.62 +       <input type="radio" name="expiryunits" value="d" checked>days 
   73.63 +       <input type="radio" name="expiryunits" value="w">weeks
   73.64 +       <input type="radio" name="expiryunits" value="m">months
   73.65 +       <input type="radio" name="expiryunits" value="y">years
   73.66 +  </td>
   73.67 +</tr>
   73.68 +</tbody>
   73.69 +</table>
   73.70 +</td></tr>
   73.71 +
   73.72 +##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
   73.73 +
   73.74 +<tr>
   73.75 +  <td><input type="submit" name="action" value="refresh expiry time"></td>
   73.76 +</tr>
   73.77 +</table>
   73.78 +</form>
   73.79 +</td>
   73.80 +</tbody>
   73.81 +</table>
   73.82 +
   73.83 +
   73.84 +
   73.85 +
   73.86 +<!-- end content -->
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/tools/control/web/tmpl/vd-vdrr.tmpl	Fri May 16 09:35:50 2003 +0000
    74.3 @@ -0,0 +1,72 @@
    74.4 +Refresh Virtual Disk Results
    74.5 +SECTION&XenoServers
    74.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    74.7 +
    74.8 +<!-- content -->
    74.9 +<img src="pixel.gif" class="block" width="1" height="12">
   74.10 +
   74.11 +<table cellpadding="0" cellspacing="0" border="0">
   74.12 +<tbody>
   74.13 +INCLUDE&vdmenu.tmpl
   74.14 +<td valign="top">
   74.15 +
   74.16 +<%
   74.17 +  HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   74.18 +
   74.19 +  String vds[] = hsrw.getParameterValues("vd");
   74.20 +  long expiry = Long.decode(hsrw.getParameter("expiry")).longValue(); 
   74.21 +
   74.22 +  /* not perfect, but good enough for now... */
   74.23 +    if ( hsrw.getParameter("expiryunits").equals("d"))
   74.24 +  {
   74.25 +    expiry *= 24 * 60 * 60 * 1000;
   74.26 +  }
   74.27 +  else if ( hsrw.getParameter("expiryunits").equals("w"))
   74.28 +  {
   74.29 +    expiry *= 24 * 60 * 60 * 1000 * 7;
   74.30 +  }
   74.31 +  else if ( hsrw.getParameter("expiryunits").equals("m"))
   74.32 +  {
   74.33 +    expiry *= 24 * 60 * 60 * 1000 * 30;
   74.34 +  }
   74.35 +  else if ( hsrw.getParameter("expiryunits").equals("y"))
   74.36 +  {
   74.37 +    expiry *= 24 * 60 * 60 * 1000 * 365;
   74.38 +  }
   74.39 +
   74.40 +  if (vds == null)
   74.41 +  { 
   74.42 +%>
   74.43 +no virtual disks selected.
   74.44 +<%
   74.45 +  }
   74.46 +  else
   74.47 +  {
   74.48 +    for (int i = 0; i < vds.length; i++)
   74.49 +    {
   74.50 +%>
   74.51 +vd = <%= root.doRefreshVirtualDisk(vds[i], expiry) %> <br>
   74.52 +<%
   74.53 +    }
   74.54 +  }
   74.55 +%>
   74.56 +
   74.57 +<br>
   74.58 +expiry = <%= hsrw.getParameter("expiry") %>
   74.59 +<br>
   74.60 +expiryunits = <%= hsrw.getParameter("expiryunits") %>
   74.61 +<br>
   74.62 +
   74.63 +<%
   74.64 +  root.doFlushState();
   74.65 +%>
   74.66 +
   74.67 +
   74.68 +</td>
   74.69 +</tbody>
   74.70 +</table>
   74.71 +
   74.72 +
   74.73 +
   74.74 +
   74.75 +<!-- end content -->
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/tools/control/web/tmpl/vd-vdv.tmpl	Fri May 16 09:35:50 2003 +0000
    75.3 @@ -0,0 +1,43 @@
    75.4 +View Virtual Disks
    75.5 +SECTION&XenoServers
    75.6 +BREADCRUMB&Virtual Disk Manager&vd.jsp
    75.7 +
    75.8 +<!-- content -->
    75.9 +<img src="pixel.gif" class="block" width="1" height="12">
   75.10 +
   75.11 +<table cellpadding="0" cellspacing="0" border="0">
   75.12 +<tbody>
   75.13 +INCLUDE&vdmenu.tmpl
   75.14 +<td valign="top">
   75.15 +
   75.16 +<table cellpadding="2" cellspacing="0" border="0">
   75.17 +<tbody>
   75.18 +  <tr class="vdh"><td>key</td><td width="5"></td><td>name</td><td width="5"></td><td>expiry</td></tr>
   75.19 +
   75.20 +  <%
   75.21 +    int count = root.getVirtualDiskCount();
   75.22 +    for (int loop = 0; loop < count; loop++)
   75.23 +    {
   75.24 +      VirtualDisk vd = root.getVirtualDisk(loop);
   75.25 +  %>
   75.26 +    <tr class="vdt">
   75.27 +      <td><%= vd.getKey() %></td>
   75.28 +      <td></td>
   75.29 +      <td><%= vd.getName() %></td>
   75.30 +      <td></td>
   75.31 +      <td><%= vd.getExpiry() %></td>
   75.32 +    </tr>
   75.33 +  <%
   75.34 +    }
   75.35 +  %>
   75.36 +
   75.37 +</tbody>
   75.38 +</table>
   75.39 +</td>
   75.40 +</tbody>
   75.41 +</table>
   75.42 +
   75.43 +
   75.44 +
   75.45 +
   75.46 +<!-- end content -->
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/tools/control/web/tmpl/vd.tmpl	Fri May 16 09:35:50 2003 +0000
    76.3 @@ -0,0 +1,24 @@
    76.4 +Virtual Disk Manager
    76.5 +SECTION&XenoServers
    76.6 +
    76.7 +<!-- content -->
    76.8 +<img src="pixel.gif" class="block" width="1" height="12">
    76.9 +
   76.10 +<table cellpadding="0" cellspacing="0" border="0">
   76.11 +<tbody>
   76.12 +INCLUDE&vdmenu.tmpl
   76.13 +<td valign="top">
   76.14 +<table cellpadding="0" cellspacing="0" border="0">
   76.15 +<tbody>
   76.16 +  <tr><td nowrap="nowrap">Virtual Disk Manager</td></tr>
   76.17 +
   76.18 +</tbody>
   76.19 +</table>
   76.20 +</td>
   76.21 +</tbody>
   76.22 +</table>
   76.23 +
   76.24 +
   76.25 +
   76.26 +
   76.27 +<!-- end content -->
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/tools/control/web/tmpl/vdmenu.tmpl	Fri May 16 09:35:50 2003 +0000
    77.3 @@ -0,0 +1,63 @@
    77.4 +<td width="10" valign="top" align="right"></td>
    77.5 +
    77.6 +<td valign="top">
    77.7 +<table cellpadding="0" cellspacing="0" border="0">
    77.8 +<tbody>
    77.9 +<tr>
   77.10 +  <td class="menuheader" width="100">Partitions</td>
   77.11 +</tr>
   77.12 +<tr>
   77.13 +  <td class="sidemenu" width="100"><a href="vd-pv.jsp">View</a></td>
   77.14 +</tr>
   77.15 +<tr>
   77.16 +  <td class="sidemenu" width="100"><a href="vd-pa.jsp">Add</a></td>
   77.17 +</tr>
   77.18 +##WHITESPACE##
   77.19 +<tr>
   77.20 +  <td class="menuheader" width="100">Virtual Disk</td>
   77.21 +</tr>
   77.22 +<tr>
   77.23 +  <td class="sidemenu" width="100"><a href="vd-vdv.jsp">View</a></td>
   77.24 +</tr>
   77.25 +<tr>
   77.26 +  <td class="sidemenu" width="100"><a href="vd-vdc.jsp">Create</a></td>
   77.27 +</tr>
   77.28 +<tr>
   77.29 +  <td class="sidemenu" width="100"><a href="vd-vdd.jsp">Delete</a></td>
   77.30 +</tr>
   77.31 +<tr>
   77.32 +  <td class="sidemenu" width="100"><a href="vd-vdr.jsp">Refresh</a></td>
   77.33 +</tr>
   77.34 +##WHITESPACE##
   77.35 +<tr>
   77.36 +  <td class="menuheader" width="100">Free Space</td>
   77.37 +</tr>
   77.38 +<tr>
   77.39 +  <td class="sidemenu" width="100"><a href="vd-fv.jsp">View</a></td>
   77.40 +</tr>
   77.41 +##WHITESPACE##
   77.42 +<tr>
   77.43 +  <td class="menuheader" width="100">Virtual Block Device</td>
   77.44 +</tr>
   77.45 +<tr>
   77.46 +  <td class="sidemenu" width="100"><a href="vd-vbdv.jsp">View</a></td>
   77.47 +</tr>
   77.48 +<tr>
   77.49 +  <td class="sidemenu" width="100"><a href="vd-vbdc.jsp">Create</a></td>
   77.50 +</tr>
   77.51 +<tr>
   77.52 +  <td class="sidemenu" width="100"><a href="vd-vbdd.jsp">Delete</a></td>
   77.53 +</tr>
   77.54 +<tr>
   77.55 +  <td class="sidemenu" width="100"><a href="vd-vbdf.jsp">Flush</a></td>
   77.56 +</tr>
   77.57 +
   77.58 +</tbody>
   77.59 +</table>
   77.60 +</td>
   77.61 +
   77.62 +<td width="5" valign="top" align="right"></td>
   77.63 +
   77.64 +<td bgcolor="#666666" width="2"><img src="img/pixel.gif" class="block" width="2" height="50"></td>
   77.65 +
   77.66 +<td width="15" valign="top" align="right"></td>
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/tools/control/web/tmpl/xenofoot.def	Fri May 16 09:35:50 2003 +0000
    78.3 @@ -0,0 +1,28 @@
    78.4 +<!-- START OF STANDARD FOOTER-->
    78.5 +</td>
    78.6 +</tr></table>
    78.7 +<!-- end body text -->
    78.8 +
    78.9 +<!-- footer -->
   78.10 +<br />
   78.11 +<table cellpadding="0" cellspacing="0" border="0" width="98%" summary="footer">
   78.12 +<tr><td bgcolor="#0099cc" colspan="2"><img
   78.13 +src="http://www.cl.cam.ac.uk/UoCCL/images/pixel.gif" class="block" width="1" height="4" border="0" alt="" /></td>
   78.14 +</tr>
   78.15 +<tr><td bgcolor="#cccccc" colspan="2"><img
   78.16 +src="http://www.cl.cam.ac.uk/UoCCL/images/pixel.gif" class="block" width="1" height="2" border="0" alt="" /></td>
   78.17 +</tr>
   78.18 +
   78.19 +<tr><td>
   78.20 +<div class="footer">
   78.21 +<!--Add Department name and email contact here-->
   78.22 +<p>&copy; ##YEAR## ##COPYRIGHT##<br />
   78.23 +<!-- Page last updated ##DATE## by ##OWNERNAME##</p> -->
   78.24 +</div>
   78.25 +</td>
   78.26 +</tr>
   78.27 +</table>
   78.28 +
   78.29 +<!--  end footer -->
   78.30 +</body>
   78.31 +</html>
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/tools/control/web/tmpl/xenohead.def	Fri May 16 09:35:50 2003 +0000
    79.3 @@ -0,0 +1,82 @@
    79.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    79.5 +
    79.6 +<jsp:useBean id="root" scope="application"
    79.7 +             class="uk.ac.cam.cl.xeno.xenctl.RootBean" />
    79.8 +<jsp:useBean id="sc" scope="application"
    79.9 +             class="uk.ac.cam.cl.xeno.xenctl.SystemConfigurationBean" />
   79.10 +<%@ page session="false" %>
   79.11 +<%@ page import="uk.ac.cam.cl.xeno.xenctl.*" %>
   79.12 +<%@ page import="uk.ac.cam.cl.xeno.domctl.*" %>
   79.13 +<%@ page import="java.util.Enumeration" %>
   79.14 +<%@ page import="javax.servlet.http.HttpServletRequestWrapper" %>
   79.15 +
   79.16 +<html lang="en">
   79.17 +
   79.18 +<!-- 
   79.19 +     THIS FILE HAS BEEN AUTOMATICALLY GENERATED BY A PERL SCRIPT
   79.20 +     THE SOURCE FILE HAS THE EXTENSION .tmpl
   79.21 +-->
   79.22 +
   79.23 +
   79.24 +<head>
   79.25 +
   79.26 +<title>##SECTION## ##SECTIONBREAK## ##TITLE## <%= root.getDebugCounter() %></title>
   79.27 +
   79.28 +<link rel="stylesheet" type="text/css" href="xenostyle.css">
   79.29 +
   79.30 +</head>
   79.31 +
   79.32 +<body bgcolor="#ffffff" text="#000000" link="#003399"
   79.33 +      alink="#cc0000"vlink="#cc3333">
   79.34 +
   79.35 +<!-- header -->
   79.36 +<table cellpadding="0" cellspacing="0" border="0" width="98%" summary="navigation bar">
   79.37 +<tr>
   79.38 +<td bgcolor="#0099cc" width="98%" ><img src="img/pixel.gif" class="block" width="1" height="16" alt="" border="0" /></td>
   79.39 +<td align="right" width="212" rowspan="2" >
   79.40 +<table cellpadding="0" cellspacing="0" border="0" width="##NAVIGATIONWIDTH##" summary="navigation bar insert">
   79.41 +<tr>
   79.42 +  ##NAVIGATIONSTRING##
   79.43 +  <td><a href="help.jsp"><img src="img/help.gif" width="53" height="18" border="0" alt="Help" class="block" /></a></td>
   79.44 +</tr>
   79.45 +</table>
   79.46 +</td>
   79.47 +</tr>
   79.48 +<tr>
   79.49 +<td bgcolor="#cccccc" ><img src="img/pixel.gif" class="block"
   79.50 +width="1" height="2" alt="" border="0" /></td>
   79.51 +</tr>
   79.52 +</table>
   79.53 +<table cellpadding="0" cellspacing="0" border="0" width="98%" summary="departmental header">
   79.54 +<tr>
   79.55 +<td><a href="http://www.cam.ac.uk/"><img src="img/cambridge.gif" width="192"
   79.56 +height="46" border="0" alt="University of Cambridge Home" /></a></td>
   79.57 +
   79.58 +<!--Departmental name in next cell-->
   79.59 +<td align="right" valign="bottom" class="title">##SECTION##<br />##TITLE##</td>
   79.60 +</tr>
   79.61 +
   79.62 +<tr><td bgcolor="#0099cc" colspan="3"><img
   79.63 +src="img/pixel.gif" class="block" width="1" height="4" alt="" /></td>
   79.64 +</tr>
   79.65 +<tr><td bgcolor="#cccccc" colspan="3"><img
   79.66 +src="img/pixel.gif" class="block" width="1" height="2" alt="" /></td>
   79.67 +</tr>
   79.68 +</table>
   79.69 +<!-- end header -->
   79.70 +
   79.71 +<!-- breadcrumbs start -->
   79.72 +<table cellpadding="0" cellspacing="0" border="0" width="98%" summary="breadcrumb navigation">
   79.73 +<tr>
   79.74 +<td><a href="index.jsp"class="bread">XenoServers</a>##BREADCRUMBS##</td>
   79.75 +</tr>
   79.76 +</table>
   79.77 +<!-- end breadcrumbs -->
   79.78 +
   79.79 +<!-- body text -->
   79.80 +<br />
   79.81 +<!-- <h1>##TITLE##</h1> -->
   79.82 +<table cellpadding="0" cellspacing="0" border="0" width="98%" summary="content panel">
   79.83 +<tr>
   79.84 +<td valign="top">
   79.85 +<!-- END OF STANDARD HEADER-->
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/tools/control/web/tmpl/xenostyle.css	Fri May 16 09:35:50 2003 +0000
    80.3 @@ -0,0 +1,91 @@
    80.4 +body {background-color: #ffffff; color: #000000;}
    80.5 +
    80.6 +p, ul, ol, li, table, td {font-family: Arial, Helvetica, sans-serif; }
    80.7 +
    80.8 +a {text-decoration:none;}
    80.9 +a:link {color: #003399; font-family: Arial, Helvetica, sans-serif;}
   80.10 +a:visited {color: #cc3333; font-family: Arial, Helvetica, sans-serif;}
   80.11 +a:hover {text-decoration: underline; font-family: Arial, Helvetica, sans-serif;}
   80.12 +a:active {color: #cc0000; font-family: Arial, Helvetica, sans-serif;}
   80.13 +
   80.14 +a.bread {font-size: 80%; font-weight: bold;}
   80.15 +a.univbread {font-size: 90%; font-weight: bold;}
   80.16 +p.small {font-size: 90%;}
   80.17 +p.smallc {font-size: 90%; text-align:center; font-weight: bold;}
   80.18 +p.foot {font-size: 110%; text-align:center;}
   80.19 +p.nav {font-size: 80%;}
   80.20 +span.activenav {font-size: 80%; color: #000000}
   80.21 +
   80.22 +.bigb {font-size: 110%; font-weight: bold;} 
   80.23 +.small {font-size: 90%;}
   80.24 +.deptitle {font-size: 140%; color: #000000; font-weight: bold;}
   80.25 +.deptitle {font-size: 120%; color: #000000; font-weight: bold;}
   80.26 +.title {font-size: 130%; color: #990000; font-weight: bold;}
   80.27 +.center {text-align:center;}
   80.28 +div.footer {font-size: 80%;}
   80.29 +
   80.30 +h1 {font-weight: bold; font-size: 120%; color: #990000; font-family: Arial, Helvetica, sans-serif;}
   80.31 +h2 {font-weight: bold; font-size: 110%; color: #333333; font-family: Arial, Helvetica, sans-serif;}
   80.32 +h3 {font-weight: bold; font-style: italic; font-size: 100%; color: #333333; font-family: Arial, Helvetica, sans-serif;}
   80.33 +h4 {font-weight: bold; font-size: 90%; color: #333333; font-family: Arial, Helvetica, sans-serif;}
   80.34 +h5 {font-weight: bold; font-size: 80%; color: #333333; font-family: Arial, Helvetica, sans-serif;}
   80.35 +
   80.36 +
   80.37 +/* netscape 6 correction */
   80.38 +.null {font-size: 1px;}
   80.39 +
   80.40 +/* linux correction */
   80.41 +.block {display: block;}
   80.42 +
   80.43 +
   80.44 +/* home page */
   80.45 +.homeheading {font-weight: bold; font-size: 80%; font-family: arial, helvetica, sans-serif;  color: #990000;}
   80.46 +
   80.47 +a.homemenu  {font-weight: bold; font-family: arial, helvetica, sans-serif;}
   80.48 +a.homemenu2 {font-size: 80%; font-family: arial, helvetica, sans-serif;}
   80.49 +
   80.50 +p.homealert {font-size: 80%; color: #990000; font-family: arial, helvetica, sans-serif;}
   80.51 +p.homenews {font-size: 80%; font-family: arial, helvetica, sans-serif;}
   80.52 +
   80.53 +
   80.54 +<!--from admin styles-->
   80.55 +.linkcell { background: #003399; color: #ffffff }
   80.56 +a.cell { font-family: sans-serif; text-decoration:none }
   80.57 +a.cell:link { color: #ffffff } 
   80.58 +a.cell:visited { color: #ffffff } 
   80.59 +a.cell:active { color: #ffff33 }
   80.60 +
   80.61 +
   80.62 +.sidemenu {
   80.63 +   /*font-weight : 400; */
   80.64 +   /*font-size : 13px; */
   80.65 +   /*line-height : 12px; */
   80.66 +   /*font-family : Verdana, Arial, Helvetica, sans-serif, "MS sans serif"; */
   80.67 +   /*letter-spacing : 0px; */
   80.68 +   /*text-decoration : none; */
   80.69 +   text-align : left; 
   80.70 +}
   80.71 +
   80.72 +.menuheader {
   80.73 +   color : #003366;
   80.74 +   font-weight : bold; 
   80.75 +   /*font-size : 13px; */
   80.76 +   /*line-height : 15px; */
   80.77 +   /*font-family : Verdana, Arial, Helvetica, sans-serif, "MS sans serif"; */
   80.78 +   /*letter-spacing : -1px; */
   80.79 +   text-decoration : none; 
   80.80 +   text-align : left; 
   80.81 +}
   80.82 +
   80.83 +.vdh {
   80.84 +   background-color: #003366;
   80.85 +   color : #ffffff;
   80.86 +   font-weight : bold; 
   80.87 +   text-align : center; 
   80.88 +}
   80.89 +.vdt {
   80.90 +   background-color: #f0f0f0;
   80.91 +}
   80.92 +.vds {
   80.93 +   background-color: #aaaaaa;
   80.94 +}
    81.1 --- a/tools/domctl/Makefile	Thu May 15 17:57:46 2003 +0000
    81.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.3 @@ -1,9 +0,0 @@
    81.4 -default:
    81.5 -	ant dist
    81.6 -
    81.7 -install: default
    81.8 -	cp domctl.jar domctl ../../../install/bin
    81.9 -	chmod 755 ../../../install/bin/domctl
   81.10 -clean:
   81.11 -	ant clean
   81.12 -	rm -f domctl.jar
    82.1 --- a/tools/domctl/build.xml	Thu May 15 17:57:46 2003 +0000
    82.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.3 @@ -1,45 +0,0 @@
    82.4 -<project name="domctl project" default="compile">
    82.5 -  <property name="src" location="src"/>
    82.6 -  <property name="build" location="build"/>
    82.7 -  <property name="dist" location="dist"/>
    82.8 -  <property name="lib" location="lib"/>
    82.9 -
   82.10 -  <target name="init">
   82.11 -    <tstamp/>
   82.12 -    <mkdir dir="${build}"/>     
   82.13 -  </target>
   82.14 -
   82.15 -  <target name="compile" depends="init">
   82.16 -    <javac srcdir="${src}" destdir="${build}" debug="on"/>
   82.17 -  </target>
   82.18 -
   82.19 -  <target name="dist" depends="compile">
   82.20 -    <jar jarfile="domctl.jar"
   82.21 -         excludes="*~"
   82.22 -	 basedir="${build}">
   82.23 -      <fileset dir="${src}" />
   82.24 -      <fileset dir=".">
   82.25 -        <include name="build.xml"/>
   82.26 -        <include name="domctl"/>
   82.27 -      </fileset>
   82.28 -      <manifest>
   82.29 -        <attribute name="Built-By" value="${user.name}"/>
   82.30 -	<attribute name="Main-Class" value="uk.ac.cam.cl.xeno.domctl.Main"/>
   82.31 -	<attribute name="Sealed" value="true"/>
   82.32 -      </manifest>
   82.33 -    </jar>
   82.34 -  </target>
   82.35 -
   82.36 -  <target name="test" depends="compile">
   82.37 -    <java fork="true" classname="uk.ac.cam.cl.xeno.domctl.Main">
   82.38 -      <classpath>
   82.39 -        <pathelement path="${build}"/>
   82.40 -      </classpath>
   82.41 -    </java>
   82.42 -  </target>
   82.43 -
   82.44 -  <target name="clean">
   82.45 -    <delete dir="${build}"/>
   82.46 -    <delete dir="${lib}"/>
   82.47 -  </target>
   82.48 -</project>
   82.49 \ No newline at end of file
    83.1 --- a/tools/domctl/domctl	Thu May 15 17:57:46 2003 +0000
    83.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.3 @@ -1,33 +0,0 @@
    83.4 -#!/bin/bash 
    83.5 -
    83.6 -if [ -z "$DEFAULTS_FILE" ] ; then DEFAULTS_FILE=domctl.xml ; fi
    83.7 -if [ -z "$DEFAULTS_PATH" ] ; then DEFAULTS_PATH=.:/etc ; fi
    83.8 -if [ -z "$QUERY_DEV" ] ; then QUERY_DEV=eth0 ; fi
    83.9 -if [ -z "$IFCONFIG" ] ; then IFCONFIG=/sbin/ifconfig ; fi
   83.10 -if [ -z "$ROUTE" ] ; then ROUTE=/sbin/route ; fi
   83.11 -if [ -z "$JAVA" ] ; then JAVA=java ; fi
   83.12 -
   83.13 -if [ "$1" = "new" ] ; then
   83.14 -  if [ ! -x "$IFCONFIG" ]; then  
   83.15 -    echo Could not find executable $IFCONFIG
   83.16 -    exit 1
   83.17 -  fi
   83.18 -
   83.19 -  if [ ! -x "$ROUTE" ]; then
   83.20 -    echo Could not find executable $ROUTE
   83.21 -    exit 1
   83.22 -  fi
   83.23 -
   83.24 -  # Try to determine dom0 network settings to avoid hard-coding
   83.25 -  # particular machines in the defaults file
   83.26 -  LOCAL_IP=$(/sbin/ifconfig $QUERY_DEV | grep 'inet addr' | tr ':' '\t' | awk '{print $3}')
   83.27 -  LOCAL_MASK=$(/sbin/ifconfig $QUERY_DEV | grep 'Mask' | tr ':' '\t' | awk '{print $7}')
   83.28 -  LOCAL_ROUTE=$(/sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}')
   83.29 -fi
   83.30 -
   83.31 -
   83.32 -#ARGS="-DTEST -DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH -DLOCAL_IP=$LOCAL_IP -DLOCAL_MASK=$LOCAL_MASK -DLOCAL_ROUTE=$LOCAL_ROUTE"
   83.33 -ARGS="-DDEFAULTS_FILE=$DEFAULTS_FILE -DDEFAULTS_PATH=$DEFAULTS_PATH -DLOCAL_IP=$LOCAL_IP -DLOCAL_MASK=$LOCAL_MASK -DLOCAL_ROUTE=$LOCAL_ROUTE"
   83.34 -
   83.35 -
   83.36 -$JAVA $ARGS -jar $(dirname $0)/domctl.jar $*
    84.1 --- a/tools/domctl/domctl.xml	Thu May 15 17:57:46 2003 +0000
    84.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.3 @@ -1,15 +0,0 @@
    84.4 -<?xml version="1.0"?>
    84.5 -<domctl_defaults>
    84.6 -<domain_name>XenoLinux</domain_name>
    84.7 -<domain_size_kb>16000</domain_size_kb>
    84.8 -<domain_image>./image</domain_image>
    84.9 -<domain_vifs>1</domain_vifs>
   84.10 -<root_device>/dev/nfs</root_device>
   84.11 -<nw_ip>=+</nw_ip>
   84.12 -<nw_gw>=</nw_gw>
   84.13 -<nw_mask>=</nw_mask>
   84.14 -<nw_nfs_server>128.232.32.20</nw_nfs_server>
   84.15 -<nw_nfs_root>/usr/groups/srgboot/moonraider/roots/root+</nw_nfs_root>
   84.16 -<max_domain_number>10</max_domain_number>
   84.17 -<xi_tools_dir>/tools/internal/</xi_tools_dir>
   84.18 -</domctl_defaults>
    85.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Command.java	Thu May 15 17:57:46 2003 +0000
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,74 +0,0 @@
    85.4 -package uk.ac.cam.cl.xeno.domctl;
    85.5 -
    85.6 -public abstract class Command
    85.7 -{
    85.8 -  public abstract int doCommand(Defaults d, String args[]);
    85.9 -  public abstract String getName();			
   85.10 -  public abstract String getUsage();
   85.11 -  public abstract String getHelpText();
   85.12 -
   85.13 -  public String getStringParameter(String args[], char key, String def)
   85.14 -  {
   85.15 -    String r = getParameter (args, key);
   85.16 -    return (r == null) ? def : r;
   85.17 -  }
   85.18 -
   85.19 -  public int getIntParameter(String args[], char key, int def)
   85.20 -  {
   85.21 -    String r = getParameter (args, key);
   85.22 -    return (r == null) ? def : (Integer.parseInt (r));
   85.23 -  }
   85.24 -
   85.25 -  public boolean getFlagParameter(String args[], char key)
   85.26 -  {
   85.27 -    String r = getParameter (args, key);
   85.28 -    return (r == null) ? false : true;
   85.29 -  }
   85.30 -
   85.31 -  public String getParameter (String args[], char key)
   85.32 -  {
   85.33 -    int i;
   85.34 -    String result = null;
   85.35 -    for (i = 0; i < args.length; i ++)
   85.36 -      {
   85.37 -	if (args[i].startsWith("-" + key)) 
   85.38 -	  {
   85.39 -	    if (args[i].length() > 2)
   85.40 -	      {
   85.41 -		result = args[i].substring(2, args[i].length());
   85.42 -	      }
   85.43 -	    else
   85.44 -	      {
   85.45 -		result = "";
   85.46 -	      }
   85.47 -	  }
   85.48 -      }
   85.49 -    return result;
   85.50 -  }
   85.51 -
   85.52 -  public int reportXIError (String message, String cmd_array[])
   85.53 -  {
   85.54 -    int i;
   85.55 -    System.err.print (message + " using: ");
   85.56 -    for (i = 0; i < cmd_array.length; i ++) {
   85.57 -      System.err.print (cmd_array[i] + " ");
   85.58 -    }
   85.59 -    System.err.println();
   85.60 -    return -1;
   85.61 -  }
   85.62 -
   85.63 -  public int reportError (String message)
   85.64 -  {
   85.65 -    System.err.println (message);
   85.66 -    return -1;
   85.67 -  }
   85.68 -
   85.69 -  public void reportCommand (String cmd_array[])
   85.70 -  {
   85.71 -    int i;
   85.72 -    for (i = 0; i < cmd_array.length; i ++) {
   85.73 -      System.out.print (cmd_array[i] + " ");
   85.74 -    }
   85.75 -    System.out.println();
   85.76 -  }
   85.77 -}
    86.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandDestroy.java	Thu May 15 17:57:46 2003 +0000
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,69 +0,0 @@
    86.4 -package uk.ac.cam.cl.xeno.domctl;
    86.5 -
    86.6 -import java.io.*;
    86.7 -import java.net.*;
    86.8 -
    86.9 -public class CommandDestroy extends Command
   86.10 -{
   86.11 -  public int doCommand(Defaults d, String args[])
   86.12 -  {
   86.13 -    Runtime r = Runtime.getRuntime ();
   86.14 -    int domain_id = getIntParameter(args, 'n', 0);
   86.15 -    boolean force = getFlagParameter(args, 'f');
   86.16 -    int rc = 0;
   86.17 -
   86.18 -    if (domain_id == 0) {
   86.19 -      System.err.println ("Expected -n<domain_id>");
   86.20 -      rc = -1;
   86.21 -      return rc;
   86.22 -    }
   86.23 -
   86.24 -    try
   86.25 -      {
   86.26 -	Process destroy_p;
   86.27 -	String destroy_cmdarray[] = force ? new String[3] : new String[2];
   86.28 -	int destroy_rc;
   86.29 -	int idx = 0;
   86.30 -	destroy_cmdarray[idx++] = d.XIToolsDir + "xi_destroy";
   86.31 -	if (force) {
   86.32 -	  destroy_cmdarray[idx++] = "-f";
   86.33 -	}
   86.34 -	destroy_cmdarray[idx++] = "" + domain_id;
   86.35 -
   86.36 -	if (Settings.TEST) {
   86.37 -	  reportCommand (destroy_cmdarray);
   86.38 -	} else {
   86.39 -	  destroy_p = r.exec (destroy_cmdarray);
   86.40 -	  destroy_rc = destroy_p.waitFor ();
   86.41 -	  
   86.42 -	  if (destroy_rc != 0) {
   86.43 -	    return reportXIError ("Could not destroy domain", destroy_cmdarray);
   86.44 -	  }
   86.45 -	}
   86.46 -      }
   86.47 -    catch (Exception e) 
   86.48 -      {
   86.49 -	System.err.println ("Could not destroy domain (" + e + ")");
   86.50 -	e.printStackTrace ();
   86.51 -	rc = -1;
   86.52 -      }
   86.53 -
   86.54 -    return rc;
   86.55 -  }
   86.56 -
   86.57 -  public String getName()
   86.58 -  {
   86.59 -    return "destroy";
   86.60 -  }
   86.61 -
   86.62 -  public String getUsage()
   86.63 -  {
   86.64 -    return "[-f] [-n<domain_id>]";
   86.65 -  }
   86.66 -
   86.67 -  public String getHelpText()
   86.68 -  {
   86.69 -    return
   86.70 -      "Destory the specified domain.  -f forcibly destroys it.";
   86.71 -  }
   86.72 -}
    87.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandHelp.java	Thu May 15 17:57:46 2003 +0000
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,58 +0,0 @@
    87.4 -package uk.ac.cam.cl.xeno.domctl;
    87.5 -
    87.6 -public class CommandHelp extends Command
    87.7 -{
    87.8 -  public int doCommand(Defaults d, String args[])
    87.9 -  {
   87.10 -    if (args.length <= 1)
   87.11 -      {
   87.12 -	System.out.println ("Usage:");
   87.13 -	for (int i = 0; i < Main.commands.length; i ++) 
   87.14 -	  {
   87.15 -	    String name = Main.commands[i].getName ();
   87.16 -	    String usage = Main.commands[i].getUsage ();
   87.17 -	    while (name.length() < 12) name = name + " ";
   87.18 -	    System.out.println ("   " + name + usage);
   87.19 -	  }
   87.20 -      }
   87.21 -    else 
   87.22 -      {
   87.23 -	for (int i = 0; i < Main.commands.length; i ++) 
   87.24 -	  {
   87.25 -	    String name = Main.commands[i].getName ();
   87.26 -	    String usage = Main.commands[i].getUsage ();
   87.27 -	    if (name.equals (args[1]))
   87.28 -	      {
   87.29 -		doHelpFor (Main.commands[i]);
   87.30 -		break;
   87.31 -	      }
   87.32 -	  }
   87.33 -      }
   87.34 -
   87.35 -    System.out.println ("");
   87.36 -    return 0;
   87.37 -  }
   87.38 -
   87.39 -  public int doHelpFor (Command c)
   87.40 -  {
   87.41 -    System.out.println ("domctl " + c.getName() + " " + c.getUsage());
   87.42 -    System.out.println ();
   87.43 -    System.out.println (c.getHelpText ());
   87.44 -    return 0;
   87.45 -  }
   87.46 -
   87.47 -  public String getName()
   87.48 -  {
   87.49 -    return "help";
   87.50 -  }
   87.51 -
   87.52 -  public String getUsage()
   87.53 -  {
   87.54 -    return "";
   87.55 -  }
   87.56 -
   87.57 -  public String getHelpText()
   87.58 -  {
   87.59 -    return "This message";
   87.60 -  }  
   87.61 -}
    88.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandNew.java	Thu May 15 17:57:46 2003 +0000
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,255 +0,0 @@
    88.4 -package uk.ac.cam.cl.xeno.domctl;
    88.5 -
    88.6 -import java.io.*;
    88.7 -import java.util.zip.*;
    88.8 -import java.net.*;
    88.9 -
   88.10 -public class CommandNew extends Command
   88.11 -{
   88.12 -  public int doCommand(Defaults d, String args[])
   88.13 -  {
   88.14 -    Runtime r = Runtime.getRuntime ();
   88.15 -    String name = getStringParameter(args, 'n', d.domainName);
   88.16 -    int size = getIntParameter(args, 'k', d.domainSizeKB);
   88.17 -    String image = getStringParameter(args, 'i', d.domainImage);
   88.18 -    String initrd = getStringParameter (args, 'r', d.domainInitRD);
   88.19 -    int vifs = getIntParameter(args, 'v', d.domainVIFs);
   88.20 -    String bargs = getStringParameter (args, 'a', d.args) + " ";
   88.21 -    String root_dev = getStringParameter (args, 'd', d.rootDevice);
   88.22 -    String nfs_root_path = getStringParameter (args, 'f', d.NWNFSRoot);
   88.23 -    String nw_ip = getStringParameter (args, '4', d.NWIP);
   88.24 -    String nw_gw = getStringParameter (args, 'g', d.NWGW);
   88.25 -    String nw_mask = getStringParameter (args, 'm', d.NWMask);
   88.26 -    String nw_nfs_server = getStringParameter (args, 's', d.NWNFSServer);
   88.27 -    String nw_host = getStringParameter (args, 'h', d.NWHost);
   88.28 -    String domain_ip = "";
   88.29 -    int rc = 0;
   88.30 -    int domain_id = -1;
   88.31 -    DataInputStream dis;
   88.32 -    int idx;
   88.33 -    int i;
   88.34 -    File image_tmp = null;
   88.35 -    File initrd_tmp = null;
   88.36 -
   88.37 -    d.describe ();
   88.38 -
   88.39 -    try
   88.40 -      {
   88.41 -	try
   88.42 -	  {
   88.43 -	    /* Some initial sanity checks */
   88.44 -	    if (root_dev.equals ("/dev/nfs") && (vifs == 0)) {
   88.45 -	      return reportError ("Cannot use NFS root without VIFs configured");
   88.46 -	    }
   88.47 -	    
   88.48 -	    /* Uncompress the image and initrd */
   88.49 -	    if (image.endsWith (".gz")) {
   88.50 -	      image_tmp = getUncompressed ("xen-image-", image);
   88.51 -	      image = image_tmp.getPath ();
   88.52 -	    }
   88.53 -	    
   88.54 -	    if (initrd != null && initrd.endsWith (".gz")) {
   88.55 -	      initrd_tmp = getUncompressed ("xen-initrd-", initrd);
   88.56 -	      initrd = initrd_tmp.getPath ();
   88.57 -	    }
   88.58 -	    
   88.59 -	    /* Create a new empty domain */
   88.60 -	    Process create_p;
   88.61 -	    String create_cmdarray[] = new String[3];
   88.62 -	    int create_rc;
   88.63 -	    create_cmdarray[0] = d.XIToolsDir + "xi_create";
   88.64 -	    create_cmdarray[1] = "" + size;
   88.65 -	    create_cmdarray[2] = name;
   88.66 -	    if (Settings.TEST) {
   88.67 -	      reportCommand (create_cmdarray);
   88.68 -	      domain_id=1;
   88.69 -	      create_rc=0;
   88.70 -	    } else {
   88.71 -	      create_p = r.exec (create_cmdarray);
   88.72 -	      dis = new DataInputStream (new BufferedInputStream (create_p.getInputStream ()));
   88.73 -	      domain_id = Integer.parseInt (dis.readLine ());
   88.74 -	      create_rc = create_p.waitFor ();
   88.75 -	    }
   88.76 -	    
   88.77 -	    if (create_rc != 0) {
   88.78 -	      return reportXIError ("Failed to create domain", create_cmdarray);
   88.79 -	    } else if (domain_id > d.MaxDomainNumber) {
   88.80 -	      return reportError ("Cannot configure more than " + 
   88.81 -				  d.MaxDomainNumber + " domains");
   88.82 -	    }
   88.83 -	    
   88.84 -	    /* Set up boot parameters to pass to xi_build. */
   88.85 -	    if (root_dev.equals ("/dev/nfs")) {
   88.86 -	      if (vifs == 0) {
   88.87 -		return reportError ("Cannot use NFS root without VIFs configured");
   88.88 -	      }
   88.89 -	      if (nfs_root_path == null) {
   88.90 -		return reportError ("No NFS root specified");
   88.91 -	      }
   88.92 -	      if (nw_nfs_server == null) {
   88.93 -		return reportError ("No NFS server specified");
   88.94 -	      }
   88.95 -	      bargs = (bargs + 
   88.96 -		       "root=/dev/nfs " +
   88.97 -		       "nfsroot=" + StringPattern.parse(nfs_root_path).resolve(domain_id) +
   88.98 -		       " ");
   88.99 -	    } else {
  88.100 -	      bargs = (bargs + 
  88.101 -		       "root=" + StringPattern.parse(root_dev).resolve(domain_id) +
  88.102 -		       " ");
  88.103 -	      
  88.104 -	    }
  88.105 -	    
  88.106 -	    if (vifs > 0) {
  88.107 -	      domain_ip = InetAddressPattern.parse(nw_ip).resolve(domain_id);
  88.108 -	      if (nw_host == null) {
  88.109 -		try {
  88.110 -		  nw_host = InetAddress.getByName(domain_ip).getHostName();
  88.111 -		} catch (UnknownHostException uhe) {
  88.112 -		  nw_host = "" + nw_ip;
  88.113 -		}
  88.114 -		
  88.115 -	      }
  88.116 -	      bargs = ("ip=" + domain_ip +
  88.117 -		       ":" + ((nw_nfs_server == null) ? "" : (InetAddressPattern.parse(nw_nfs_server).resolve(domain_id))) +
  88.118 -		       ":" + ((nw_gw == null) ? "" : (InetAddressPattern.parse(nw_gw).resolve(domain_id))) + 
  88.119 -		       ":" + ((nw_mask == null) ? "" : InetAddressPattern.parse(nw_mask).resolve(domain_id)) +
  88.120 -		       ":" + ((nw_host == null) ? "" : nw_host) + 
  88.121 -		       ":eth0:off " + bargs);
  88.122 -	    }
  88.123 -	    
  88.124 -	    /* Build the domain */
  88.125 -	    Process build_p;
  88.126 -	    String build_cmdarray[] = new String[6];
  88.127 -	    int build_rc;
  88.128 -	    idx = 0;
  88.129 -	    for (i = 0; i < build_cmdarray.length; i ++) 
  88.130 -	      build_cmdarray[i] = "";
  88.131 -	    build_cmdarray[idx ++] = d.XIToolsDir + "xi_build";
  88.132 -	    build_cmdarray[idx ++] = "" + domain_id;
  88.133 -	    build_cmdarray[idx ++] = "" + image;
  88.134 -	    build_cmdarray[idx ++] = "" + vifs;
  88.135 -	    if (initrd != null) build_cmdarray[idx ++] = "initrd=" + initrd;
  88.136 -	    build_cmdarray[idx ++] = "" + bargs;
  88.137 -	    System.out.println ("Build args: " + bargs);
  88.138 -	    if (Settings.TEST) {
  88.139 -	      reportCommand (build_cmdarray);
  88.140 -	      build_rc = 0;
  88.141 -	    } else {
  88.142 -	      build_p = r.exec (build_cmdarray);
  88.143 -	      build_rc = build_p.waitFor ();
  88.144 -	    }
  88.145 -	    
  88.146 -	    if (build_rc != 0) {
  88.147 -	      return reportXIError ("Failed to build domain", build_cmdarray);
  88.148 -	    }
  88.149 -	    
  88.150 -	    /* Set up the first VIF if necessary */
  88.151 -	    if (vifs > 0) {
  88.152 -	      Process vifinit_p;
  88.153 -	      String vifinit_cmdarray[] = new String[4];
  88.154 -	      int vifinit_rc;
  88.155 -	      vifinit_cmdarray[0] = d.XIToolsDir + "xi_vifinit";
  88.156 -	      vifinit_cmdarray[1] = "" + domain_id;
  88.157 -	      vifinit_cmdarray[2] = "0";
  88.158 -	      vifinit_cmdarray[3] = domain_ip;
  88.159 -	      if (Settings.TEST) {
  88.160 -		reportCommand (vifinit_cmdarray);
  88.161 -		vifinit_rc = 0;
  88.162 -	      } else {
  88.163 -		vifinit_p = r.exec (vifinit_cmdarray);
  88.164 -		vifinit_rc = vifinit_p.waitFor ();
  88.165 -	      }
  88.166 -	      
  88.167 -	      if (vifinit_rc != 0) {
  88.168 -		return reportXIError ("Failed to initialise VIF 0", vifinit_cmdarray);
  88.169 -	      }
  88.170 -	    }
  88.171 -	  } finally {
  88.172 -	    if (image_tmp != null) image_tmp.delete();
  88.173 -	    if (initrd_tmp != null) initrd_tmp.delete ();
  88.174 -	  }
  88.175 -      }
  88.176 -    catch (Exception e) 
  88.177 -      {
  88.178 -	System.err.println ("Could not create new domain (" + e + ")");
  88.179 -	e.printStackTrace ();
  88.180 -	rc = -1;
  88.181 -      }
  88.182 -
  88.183 -    if (rc == 0) {
  88.184 -      System.out.println ("Created domain " + domain_id);
  88.185 -    }
  88.186 -
  88.187 -    return rc;
  88.188 -  }
  88.189 -
  88.190 -  File getUncompressed (String prefix, String original) throws IOException {
  88.191 -    FileOutputStream fos;
  88.192 -    GZIPInputStream gis;
  88.193 -    File result;
  88.194 -    byte buffer[] = new byte[1024];
  88.195 -    int l;
  88.196 -    
  88.197 -    result = File.createTempFile (prefix, null);
  88.198 -    
  88.199 -    try {
  88.200 -      fos = new FileOutputStream (result);
  88.201 -      gis = new GZIPInputStream (new FileInputStream (original));
  88.202 -      while ((l = gis.read(buffer, 0, buffer.length)) != -1) {
  88.203 -	fos.write (buffer, 0, l);
  88.204 -      }	  
  88.205 -    } catch (IOException ioe) {
  88.206 -      result.delete ();
  88.207 -      throw ioe;
  88.208 -    }
  88.209 -
  88.210 -    return result;
  88.211 -  }
  88.212 -
  88.213 -  public String getName()
  88.214 -  {
  88.215 -    return "new";
  88.216 -  }
  88.217 -
  88.218 -  public String getUsage()
  88.219 -  {
  88.220 -    return "[-n<domain_name>] [-k<size>] [-i<image>] [-v<num_vifs>] [-r<initrd>] [-d<root_device>] [-f<nfs_root>] [-s<nfs_boot_server>] [-4<ipv4_boot_address>] [-g<ipv4_boot_gateway>] [-m<ipv4_boot_netmask>] [-h<hostname>] [-a<args>]";
  88.221 -  }
  88.222 -
  88.223 -  public String getHelpText()
  88.224 -  {
  88.225 -    return
  88.226 -      "Create a new domain.  Note that most of the parameters will assume\n" +
  88.227 -      "default values: it should not be necessary to specify them all. See\n" +
  88.228 -      "domctl.xml for the current default settings.\n" +
  88.229 -      "\n" +
  88.230 -      "General command line options:\n" +
  88.231 -      "  -n  Domain name                              domain_name\n" +
  88.232 -      "  -k  Domain size (kb)                         domain_size_kb\n" +
  88.233 -      "  -i  Domain image name                        domain_image\n" +
  88.234 -      "  -v  Number of VIFs                           domain_vifs\n" +
  88.235 -      "  -r  InitRD (if required)                     domain_init_rd\n" +
  88.236 -      "  -d  Root device (e.g /dev/nfs, /dev/hda3)    root_device\n" +
  88.237 -      "  -a  Additional boot parameters\n" +
  88.238 -      "\n" +
  88.239 -      "Networking options:\n" +
  88.240 -      "  -f  NFS root (if /dev/nfs specified)         nw_nfs_root\n" +
  88.241 -      "  -s  NFS server                               nw_nfs_server\n" +
  88.242 -      "  -4  Domain IPv4 address                      nw_ip\n" +
  88.243 -      "  -g  Domain gateway                           nw_gw\n" +
  88.244 -      "  -m  Domain net mask                          nw_mask\n" +
  88.245 -      "  -h  Domain hostname                          nw_host\n" +
  88.246 -      "\n" +
  88.247 -      "Parameters to -d, -f, -4, -g, -h can be specified as patterns into\n" +
  88.248 -      "which the allocated domain ID will be incorporated.  e.g.  for\n" +
  88.249 -      "domain 1 patterns would expand as follows:\n" +
  88.250 -      "\n" +
  88.251 -      "  /dev/hda+       /dev/hda1\n" +
  88.252 -      "  /dev/hda7+      /dev/hda8\n" +
  88.253 -      "  128.232.8.50+   128.232.8.51\n" +
  88.254 -      "\n" +
  88.255 -      "Additionally, patterns for -4 -g -m can include an = which is\n" + 
  88.256 -      "expanded to the corresponding setting from the calling domain.\n";
  88.257 -  }
  88.258 -}
    89.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandStart.java	Thu May 15 17:57:46 2003 +0000
    89.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.3 @@ -1,63 +0,0 @@
    89.4 -package uk.ac.cam.cl.xeno.domctl;
    89.5 -
    89.6 -import java.io.*;
    89.7 -import java.net.*;
    89.8 -
    89.9 -public class CommandStart extends Command
   89.10 -{
   89.11 -  public int doCommand(Defaults d, String args[])
   89.12 -  {
   89.13 -    Runtime r = Runtime.getRuntime ();
   89.14 -    int domain_id = getIntParameter(args, 'n', 0);
   89.15 -    int rc = 0;
   89.16 -
   89.17 -    if (domain_id == 0) {
   89.18 -      System.err.println ("Expected -n<domain_id>");
   89.19 -      rc = -1;
   89.20 -      return rc;
   89.21 -    }
   89.22 -
   89.23 -    try
   89.24 -      {
   89.25 -	Process start_p;
   89.26 -	String start_cmdarray[] = new String[2];
   89.27 -	int start_rc;
   89.28 -	start_cmdarray[0] = d.XIToolsDir + "xi_start";
   89.29 -	start_cmdarray[1] = "" + domain_id;
   89.30 -
   89.31 -	if (Settings.TEST) {
   89.32 -	  reportCommand (start_cmdarray);
   89.33 -	} else {
   89.34 -	  start_p = r.exec (start_cmdarray);
   89.35 -	  start_rc = start_p.waitFor ();
   89.36 -	  if (start_rc != 0) {
   89.37 -	    return reportXIError ("Could not start domain", start_cmdarray);
   89.38 -	  }
   89.39 -	}
   89.40 -      }
   89.41 -    catch (Exception e) 
   89.42 -      {
   89.43 -	System.err.println ("Could not start new domain (" + e + ")");
   89.44 -	e.printStackTrace ();
   89.45 -	rc = -1;
   89.46 -      }
   89.47 -
   89.48 -    return rc;
   89.49 -  }
   89.50 -
   89.51 -  public String getName()
   89.52 -  {
   89.53 -    return "start";
   89.54 -  }
   89.55 -
   89.56 -  public String getUsage()
   89.57 -  {
   89.58 -    return "[-n<domain_id>]";
   89.59 -  }
   89.60 -
   89.61 -  public String getHelpText()
   89.62 -  {
   89.63 -    return
   89.64 -      "Start the specified domain.";
   89.65 -  }
   89.66 -}
    90.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/CommandStop.java	Thu May 15 17:57:46 2003 +0000
    90.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.3 @@ -1,64 +0,0 @@
    90.4 -package uk.ac.cam.cl.xeno.domctl;
    90.5 -
    90.6 -import java.io.*;
    90.7 -import java.net.*;
    90.8 -
    90.9 -public class CommandStop extends Command
   90.10 -{
   90.11 -  public int doCommand(Defaults d, String args[])
   90.12 -  {
   90.13 -    Runtime r = Runtime.getRuntime ();
   90.14 -    int domain_id = getIntParameter(args, 'n', 0);
   90.15 -    int rc = 0;
   90.16 -
   90.17 -    if (domain_id == 0) {
   90.18 -      System.err.println ("Expected -n<domain_id>");
   90.19 -      rc = -1;
   90.20 -      return rc;
   90.21 -    }
   90.22 -
   90.23 -    try
   90.24 -      {
   90.25 -	Process stop_p;
   90.26 -	String stop_cmdarray[] = new String[2];
   90.27 -	int stop_rc;
   90.28 -	stop_cmdarray[0] = d.XIToolsDir + "xi_stop";
   90.29 -	stop_cmdarray[1] = "" + domain_id;
   90.30 -
   90.31 -	if (Settings.TEST) {
   90.32 -	  reportCommand (stop_cmdarray);
   90.33 -	} else {
   90.34 -	  stop_p = r.exec (stop_cmdarray);
   90.35 -	  stop_rc = stop_p.waitFor ();
   90.36 -	  
   90.37 -	  if (stop_rc != 0) {
   90.38 -	    return reportXIError ("Could not stop domain", stop_cmdarray);
   90.39 -	  }
   90.40 -	}
   90.41 -      }
   90.42 -    catch (Exception e) 
   90.43 -      {
   90.44 -	System.err.println ("Could not stop new domain (" + e + ")");
   90.45 -	e.printStackTrace ();
   90.46 -	rc = -1;
   90.47 -      }
   90.48 -
   90.49 -    return rc;
   90.50 -  }
   90.51 -
   90.52 -  public String getName()
   90.53 -  {
   90.54 -    return "stop";
   90.55 -  }
   90.56 -
   90.57 -  public String getUsage()
   90.58 -  {
   90.59 -    return "[-n<domain_id>]";
   90.60 -  }
   90.61 -
   90.62 -  public String getHelpText()
   90.63 -  {
   90.64 -    return
   90.65 -      "Stop the specified domain.";
   90.66 -  }
   90.67 -}
    91.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Defaults.java	Thu May 15 17:57:46 2003 +0000
    91.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.3 @@ -1,158 +0,0 @@
    91.4 -package uk.ac.cam.cl.xeno.domctl;
    91.5 -
    91.6 -import java.net.InetAddress;
    91.7 -import java.io.*;
    91.8 -import org.xml.sax.*;
    91.9 -import org.xml.sax.helpers.*;
   91.10 -
   91.11 -public class Defaults
   91.12 -{
   91.13 -  String domainName;
   91.14 -
   91.15 -  int domainSizeKB;
   91.16 -  String domainImage;
   91.17 -  String domainInitRD;
   91.18 -  int domainVIFs;
   91.19 -
   91.20 -  String rootDevice;
   91.21 -
   91.22 -  String NWIP;
   91.23 -  String NWGW;
   91.24 -  String NWMask;
   91.25 -  String NWHost;
   91.26 -
   91.27 -  String NWNFSServer;
   91.28 -  String NWNFSRoot;
   91.29 -
   91.30 -  int MaxDomainNumber = Integer.MAX_VALUE;
   91.31 -  String args = "";
   91.32 -
   91.33 -  String XIToolsDir;
   91.34 -
   91.35 -  /***********************************************************************/
   91.36 -
   91.37 -  public Defaults ()
   91.38 -  {
   91.39 -    File f = Settings.getDefaultsFile ();
   91.40 -
   91.41 -    try
   91.42 -      {
   91.43 -	XMLReader xr = new org.apache.crimson.parser.XMLReaderImpl();
   91.44 -	Handler handler = new Handler ();
   91.45 -	xr.setContentHandler (handler);
   91.46 -	xr.setErrorHandler (handler);
   91.47 -	xr.parse (new InputSource(new FileReader (f)));
   91.48 -      }
   91.49 -    catch (Exception e) 
   91.50 -      {
   91.51 -	System.err.println ("Could not read defaults file " + f +
   91.52 -			    "\nException: " + e);
   91.53 -	e.printStackTrace();
   91.54 -	System.exit(1);
   91.55 -      }
   91.56 -  }
   91.57 -
   91.58 -  public void describe () {
   91.59 -    System.out.println ("Domain defaults:");
   91.60 -    System.out.println ("   name            " + domainName);
   91.61 -    System.out.println ("   size            " + domainSizeKB);
   91.62 -    System.out.println ("   vifs            " + domainVIFs);
   91.63 -    System.out.println ("   domainImage     " + domainImage);
   91.64 -    System.out.println ("   domainInitRD    " + domainInitRD);
   91.65 -    System.out.println ("   rootDevice      " + rootDevice);
   91.66 -    System.out.println ("   NWIP            " + NWIP);
   91.67 -    System.out.println ("   NWGW            " + NWGW);
   91.68 -    System.out.println ("   NWMask          " + NWMask);
   91.69 -    System.out.println ("   MaxDomainNumber " + MaxDomainNumber);
   91.70 -    System.out.println ("   NWNFSServer     " + NWNFSServer);
   91.71 -    System.out.println ("   NWNFSRoot       " + NWNFSRoot);
   91.72 -    System.out.println ("   XIToolsDir      " + XIToolsDir);
   91.73 -    System.out.println ("   args            " + args);
   91.74 -  }
   91.75 -
   91.76 -  /***********************************************************************/
   91.77 -
   91.78 -  class Handler extends DefaultHandler
   91.79 -  {
   91.80 -    boolean inDomctlDefaults;
   91.81 -    String lastName;
   91.82 -
   91.83 -    public void startDocument ()
   91.84 -    {
   91.85 -    }
   91.86 -
   91.87 -    public void endDocument ()
   91.88 -    {
   91.89 -    }
   91.90 -
   91.91 -    public void startElement (String uri, String name,
   91.92 -			      String qname, Attributes atts)
   91.93 -    {
   91.94 -      if (qname.equals ("domctl_defaults")) {
   91.95 -	inDomctlDefaults = true;
   91.96 -      } else {
   91.97 -	lastName = qname;
   91.98 -      }
   91.99 -    }
  91.100 -
  91.101 -    public void endElement (String uri, String name, String qname)
  91.102 -    {
  91.103 -      lastName = "";
  91.104 -      if (qname.equals ("domctl_defaults")) {
  91.105 -	inDomctlDefaults = false;
  91.106 -      }
  91.107 -    }
  91.108 -    
  91.109 -    public void characters (char ch[], int start, int length)
  91.110 -    {
  91.111 -      String s = new String (ch, start, length);
  91.112 -      if (lastName != null)
  91.113 -	{
  91.114 -	  if (lastName.equals ("domain_size_kb")) {
  91.115 -	    domainSizeKB = Integer.parseInt (s);
  91.116 -	  } else if (lastName.equals ("domain_image")) {
  91.117 -	    domainImage = s;
  91.118 -	  } else if (lastName.equals ("domain_name")) {
  91.119 -	    domainName = s;
  91.120 -	  } else if (lastName.equals ("domain_init_rd")) {
  91.121 -	    domainInitRD = s;
  91.122 -	  } else if (lastName.equals ("domain_vifs")) {
  91.123 -	    domainVIFs = Integer.parseInt (s);
  91.124 -	  } else if (lastName.equals ("root_device")) {
  91.125 -	    rootDevice = s;
  91.126 -	  } else if (lastName.equals ("nw_ip")) {
  91.127 -	    NWIP = expandDefault (s, Settings.LOCAL_IP);
  91.128 -	  } else if (lastName.equals ("nw_gw")) {
  91.129 -	    NWGW = expandDefault (s, Settings.LOCAL_GW);
  91.130 -	  } else if (lastName.equals ("nw_mask")) {
  91.131 -	    NWMask = expandDefault (s, Settings.LOCAL_MASK);
  91.132 -	  } else if (lastName.equals ("nw_host")) {
  91.133 -	    NWHost = s;
  91.134 -	  } else if (lastName.equals ("nw_nfs_server")) {
  91.135 -	    NWNFSServer = s;
  91.136 -	  } else if (lastName.equals ("nw_nfs_root")) {
  91.137 -	    NWNFSRoot = s;
  91.138 -	  } else if (lastName.equals ("args")) {
  91.139 -	    args = s;
  91.140 -	  } else if (lastName.equals ("max_domain_number")) {
  91.141 -	    MaxDomainNumber = Integer.parseInt(s);
  91.142 -	  } else if (lastName.equals ("xi_tools_dir")) {
  91.143 -	    XIToolsDir = s;
  91.144 -	  }
  91.145 -	}
  91.146 -    }
  91.147 -  }
  91.148 -
  91.149 -  public String expandDefault (String supplied, String self)
  91.150 -  {
  91.151 -    if (supplied.startsWith ("=")) {
  91.152 -      if (supplied.length() > 1) {
  91.153 -	return self + supplied.substring (1, supplied.length());
  91.154 -      } else {
  91.155 -	return self;
  91.156 -      }
  91.157 -    } else {
  91.158 -      return supplied;
  91.159 -    }
  91.160 -  }
  91.161 -}
    92.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/InetAddressPattern.java	Thu May 15 17:57:46 2003 +0000
    92.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.3 @@ -1,60 +0,0 @@
    92.4 -package uk.ac.cam.cl.xeno.domctl;
    92.5 -
    92.6 -import java.net.*;
    92.7 -
    92.8 -public class InetAddressPattern
    92.9 -{
   92.10 -  InetAddress base;
   92.11 -  boolean addDom;
   92.12 -
   92.13 -  static InetAddressPattern parse (String t)
   92.14 -  {
   92.15 -    InetAddressPattern result = new InetAddressPattern ();
   92.16 -    char[] ca = t.toCharArray ();
   92.17 -    int idx = 0;
   92.18 -    int len = ca.length;
   92.19 -
   92.20 -    try {
   92.21 -      if (len == 0) {
   92.22 -	result.base = null;
   92.23 -	result.addDom = false;
   92.24 -      } else if (ca[len - 1] == '+') {
   92.25 -	result.base = InetAddress.getByName(t.substring(0, len - 1));
   92.26 -	result.addDom = true;
   92.27 -      } else {
   92.28 -	result.base = InetAddress.getByName(t);
   92.29 -	result.addDom = false;
   92.30 -      }
   92.31 -    } catch (UnknownHostException uhe) {
   92.32 -      result.base = null;
   92.33 -      result.addDom = false;
   92.34 -    }
   92.35 -
   92.36 -    return result;
   92.37 -  }
   92.38 -
   92.39 -  public String resolve (int domain_id) {
   92.40 -    byte b[] = base.getAddress ();
   92.41 -    if (addDom) {
   92.42 -      if (((int)b[3]) + domain_id > 255) {
   92.43 -	if (((int)b[2]) + domain_id > 255) {
   92.44 -	  if (((int)b[1]) + domain_id > 255) {
   92.45 -	    b[0] ++;
   92.46 -	  }
   92.47 -	  b[1] ++;
   92.48 -	}
   92.49 -	b[2] ++;
   92.50 -      }
   92.51 -      b[3] += domain_id;
   92.52 -    }
   92.53 -    return "" + 
   92.54 -      (b[0] + (b[0] < 0 ? 256 : 0)) + "." + 
   92.55 -      (b[1] + (b[1] < 0 ? 256 : 0)) + "." + 
   92.56 -      (b[2] + (b[2] < 0 ? 256 : 0)) + "." + 
   92.57 -      (b[3] + (b[3] < 0 ? 256 : 0));
   92.58 -  }
   92.59 -
   92.60 -  public String toString () {
   92.61 -    return "[" + base + (addDom ? "+dom_id" : "") + "]";
   92.62 -  }
   92.63 -}
    93.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Main.java	Thu May 15 17:57:46 2003 +0000
    93.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.3 @@ -1,39 +0,0 @@
    93.4 -package uk.ac.cam.cl.xeno.domctl;
    93.5 -
    93.6 -public class Main 
    93.7 -{
    93.8 -  static CommandHelp help = new CommandHelp ();
    93.9 -  static CommandNew newdom = new CommandNew ();
   93.10 -  static CommandStart start = new CommandStart ();
   93.11 -  static CommandStop stop = new CommandStop ();
   93.12 -  static CommandDestroy destroy = new CommandDestroy ();
   93.13 -  static Command commands[] = { help, newdom, start, stop, destroy };
   93.14 -
   93.15 -  public static void main (String[] args)
   93.16 -  {
   93.17 -    Defaults d = new Defaults ();
   93.18 -    int ec = -1;
   93.19 -
   93.20 -    if (args.length == 0) {
   93.21 -      ec = help.doCommand (d, args);
   93.22 -    } else {
   93.23 -      String c = args[0];
   93.24 -      int i;
   93.25 -      for (i = 0; i < commands.length; i ++) {
   93.26 -	if (commands[i].getName().equals(c)) {
   93.27 -	  if (commands[i].getFlagParameter (args, '?')) {
   93.28 -	    ec = help.doHelpFor (commands[i]);
   93.29 -	  } else {
   93.30 -	    ec = commands[i].doCommand (d, args);
   93.31 -	  }
   93.32 -	  break;
   93.33 -	}
   93.34 -      }
   93.35 -      if (i == commands.length) {
   93.36 -	System.out.println ("Unknown command " + c);
   93.37 -      }
   93.38 -    }
   93.39 -
   93.40 -    System.exit (ec);
   93.41 -  }
   93.42 -}
    94.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/Settings.java	Thu May 15 17:57:46 2003 +0000
    94.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.3 @@ -1,38 +0,0 @@
    94.4 -package uk.ac.cam.cl.xeno.domctl;
    94.5 -
    94.6 -import java.util.*;
    94.7 -import java.io.*;
    94.8 -import org.xml.sax.*;
    94.9 -
   94.10 -public final class Settings
   94.11 -{
   94.12 -  public static final String DEFAULTS_FILE = System.getProperty ("DEFAULTS_FILE");
   94.13 -  public static final String DEFAULTS_PATH = System.getProperty ("DEFAULTS_PATH");
   94.14 -  public static final String LOCAL_IP = System.getProperty ("LOCAL_IP");
   94.15 -  public static final String LOCAL_MASK = System.getProperty ("LOCAL_MASK");
   94.16 -  public static final String LOCAL_GW = System.getProperty ("LOCAL_ROUTE");
   94.17 -  public static final boolean TEST = (System.getProperty ("TEST") != null);
   94.18 -
   94.19 -
   94.20 -  public static File getDefaultsFile() {
   94.21 -    StringTokenizer tok = new StringTokenizer (DEFAULTS_PATH, ":");
   94.22 -    File result = null;
   94.23 -    File probe;
   94.24 -
   94.25 -    while (tok.hasMoreTokens ()) {
   94.26 -      String probe_dir = tok.nextToken ();
   94.27 -      probe = new File (probe_dir, DEFAULTS_FILE);
   94.28 -      if (probe.exists ()) {
   94.29 -	result = probe;
   94.30 -	break;
   94.31 -      }
   94.32 -    }
   94.33 -
   94.34 -    if (result == null) {
   94.35 -      System.err.println ("Could not find " + DEFAULTS_FILE + " in path " + DEFAULTS_PATH);
   94.36 -      System.exit (1);
   94.37 -    }
   94.38 -
   94.39 -    return result;
   94.40 -  }
   94.41 -}
    95.1 --- a/tools/domctl/src/uk/ac/cam/cl/xeno/domctl/StringPattern.java	Thu May 15 17:57:46 2003 +0000
    95.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.3 @@ -1,59 +0,0 @@
    95.4 -package uk.ac.cam.cl.xeno.domctl;
    95.5 -
    95.6 -public class StringPattern
    95.7 -{
    95.8 -  String base;
    95.9 -  int bn;
   95.10 -  boolean addDom;
   95.11 -  boolean appendDom;
   95.12 -
   95.13 -  static StringPattern parse (String t)
   95.14 -  {
   95.15 -    StringPattern result = new StringPattern ();
   95.16 -    char[] ca = t.toCharArray ();
   95.17 -    int idx = 0;
   95.18 -    int len = ca.length;
   95.19 -
   95.20 -    if (len == 0) {
   95.21 -      result.base = "";
   95.22 -      result.bn = 0;
   95.23 -      result.addDom = false;
   95.24 -    } else if (ca[len - 1] == '+') {
   95.25 -      idx = len - 2;
   95.26 -      if ((idx >= 0) && (ca[idx] >= '0') && (ca[idx] <= '9')) {
   95.27 -	while ((idx >= 0) && (ca[idx] >= '0') && (ca[idx] <= '9')) {
   95.28 -	  idx --;
   95.29 -	}
   95.30 -	result.base = t.substring(0, idx + 1);
   95.31 -	result.bn = Integer.parseInt (t.substring (idx + 1, len - 1));
   95.32 -	result.addDom = true;
   95.33 -      } else {
   95.34 -	result.base = t.substring(0, len - 1);
   95.35 -	result.appendDom = true;
   95.36 -      }
   95.37 -    } else {
   95.38 -      result.base = t;
   95.39 -    }
   95.40 -
   95.41 -    return result;
   95.42 -  }
   95.43 -
   95.44 -  public String resolve (int domain_id) {
   95.45 -    if (addDom) {
   95.46 -      return base + (bn + domain_id);
   95.47 -    } else if (appendDom) {
   95.48 -      return base + domain_id;
   95.49 -    } else {
   95.50 -      return base;
   95.51 -    }
   95.52 -  }
   95.53 -
   95.54 -  public String toString () {
   95.55 -    return ("[" + 
   95.56 -	    base + 
   95.57 -	    (addDom ? "+" + bn : "") + 
   95.58 -	    ((addDom || appendDom) ? "+ID" : "") + 
   95.59 -	    "]");
   95.60 -  }
   95.61 -
   95.62 -}
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/tools/internal/xi_helper	Fri May 16 09:35:50 2003 +0000
    96.3 @@ -0,0 +1,15 @@
    96.4 +#!/bin/bash
    96.5 +
    96.6 +if [ -z "$QUERY_DEV" ] ; then QUERY_DEV=eth0 ; fi
    96.7 +
    96.8 +if [ "$1" = "ip" ] ; then
    96.9 +  /sbin/ifconfig $QUERY_DEV | grep 'inet addr' | tr ':' '\t' | awk '{ print $3}';
   96.10 +fi
   96.11 +
   96.12 +if [ "$1" = "mask" ] ; then
   96.13 +  /sbin/ifconfig $QUERY_DEV | grep 'Mask' | tr ':' '\t' | awk '{print $7}';
   96.14 +fi
   96.15 +
   96.16 +if [ "$1" = "route" ] ; then
   96.17 +  /sbin/route -n | grep $QUERY_DEV | grep 'G' | awk '{print $2}'
   96.18 +fi
    97.1 --- a/tools/internal/xi_list	Thu May 15 17:57:46 2003 +0000
    97.2 +++ b/tools/internal/xi_list	Fri May 16 09:35:50 2003 +0000
    97.3 @@ -8,10 +8,11 @@
    97.4  #  1. Domain id
    97.5  #  2. Processor
    97.6  #  3. Has CPU (1 => true, 0 => false)
    97.7 -#  4. State (RUNNING, INTERRUPTABLE, UNINTERRUPTABLE, WAIT, SUSPENDED, DYING)
    97.8 -#  5. MCU advance
    97.9 -#  6. Total pages
   97.10 -#  7. Name
   97.11 +#  4. State (integer)
   97.12 +#  5. State (RUNNING, INTERRUPTABLE, UNINTERRUPTABLE, WAIT, SUSPENDED, DYING)
   97.13 +#  6. MCU advance
   97.14 +#  7. Total pages
   97.15 +#  8. Name
   97.16  
   97.17  INPUT_FILE=/proc/xeno/domains
   97.18  
   97.19 @@ -36,7 +37,7 @@ awk -f - $INPUT_FILE <<EOF
   97.20  
   97.21    tot_pages = \$8;
   97.22  
   97.23 -  printf "%d %d %d %s %d %d %s", dom_id, processor, has_cpu, state, mcu_advance, tot_pages, \$9;
   97.24 +  printf "%d %d %d %d %s %d %d %s", dom_id, processor, has_cpu, \$4, state, mcu_advance, tot_pages, \$9;
   97.25    for (i = 10; i < NF; i ++) {
   97.26      printf " %s", \$i;
   97.27    }