I am wondering about a certain scenario.
User on some machine runs a command. This unpacks XEN and boots up domain 0. Domain 0 boots up 3 other domains that are setup in this way.
- One is a "client" domain
- One is an apache / php server
- One is a database server (MySQL)
When the servers are up, the client machine runs a script that does some benchmarking on the performance of the webserver.
When the benchmarking is done, the results are output and the XEN cleans up after himself (as if he was never there)
What I am wondering if this is possible and what gotchas I need to keep in mind about the XEN setup?
I also would use xen-tools from Steve Kemp for creating the domUs. Under debian I use cfengine for configuration management. It can install and configure packages.
If you just want to install this lonely host and you don
t know how to handle cfengine - dont
t use it. But if you are going to install more servers like this. I strongly recommend to work with cfengine or puppet.Its pure fun, when you can automatic roll-out several servers a day.
I've only done this on the Citrix version of XenServer, but yes, almost anything can be automated.
I second what the guy above me has said, but I'd like to add that you can make life a whole lot Less Hateful(tm) if you bring a good changeconfig package into the mix as well. I prefer puppet, but if you're more comfortable with cfengine, bcfg2, whatever, the overall theory still applies. Just figure out how to make a basic Xen instance that installs puppet, and then have puppet suck down the full configuration of your choice depending on the hostname.
Alternatively, you could use something like Systemimager to image the generic Xen instances, getting you the software packages and setup you desire.
You can use xen-tools to script the creation of a xen instance. I'm pretty sure you can use them to delete the instance too. You should be able to easily set up the infrastructure you require without too much trouble. The biggest headache you're going to have is setting up the initial xen templates with all the packages and set up you require. You'll find it's very time consuming to debug the scripts, having to constantly create new instances.
This purpose may be better served by cloud tools such as Eucalyptus or OpenNebula that are designed to launch temporary instances of virtual machine templates. Both of them can be configured to interact with Xen.
It sounds like you're essentially looking for on-demand network provisioning of Xen virtual machines so you might want to look at Cobbler & Koan, a set of tools developed by Red Hat for precisely this sort of use case. They support a lot of different virtualization platforms (Xen, qemu, KVM, VMWare) and provide both a CLI, Web interface, and a number of development API's. More info at wikipedia.
To tie together all the specific behaviours that you want, you may need to do some additional scripting but this should give you a strong starting point.