Xen Debian.py
Why
XenDebian.py:
helps to install Debian VMs on XenServer and XCP (using XenAPI); is an example of XenAPI usage from Python.
What
The code is accessible from GitHub. To make it easier to use the example of it's config file along the preseed config file are added.
How
Direct code
You can just get a copy of the code from GitHub and use XenDebian.py directly. I.e.:
XenDebian.py -m p2-m1 -s p2-m1 -a 32 -M 2 -C 1 -d 6 -a http://files.your.company.com/XenDebian/preseed-6.cfg -r http://ftp.uk.debian.org/debian -v hub-04 -i "Box for Performance Team"
or using long options:
XenDebian.py --master p2-m1 --server p2-m1 --arch 32 --memory 2 --cpu 1 --distro 6 --answerfile http://files.your.company.com/XenDebian/preseed-6.cfg --repo http://ftp.uk.debian.org/debian --vm test4 --info "Box for Test"
Config file
- Rather then type all the necessary information (especially answerfile and repository addresses) you can create a config file. It has very simple format "option_name: value" (see the example file below).
- By default XenDebian tries to read a file define by the "--config/-c" option. If it fails will try xendebian.conf in the current directory and finally .xendebian.conf from the user home directory.
- You can mix commandline and config variable. Settings from command line overwrite values from config file.
- The example config file:
- arch: 32
- distro: 6
- memory: 1.0
- cpu: 1
- vmname: new
- description: New VM prepared by XenDebian.py
- answerfile http://files.your.company.com/XenDebian/preseed-6.cfg
- repo: http://ftp.uk.debian.com/debian
- server: xenserver
- master: xenserver
- username: root
- password: xenroot
Help
[user on server] /home/user #>XenDebian.py --help This is the tool to create a Debian based VM. It is controlled by following options: -c --configfile= string: name of a file with config (default: xendebia.conf); -u --username= string: username to connect to the pool master/server (default: root); -p --password= string: password used to login into the pool master/server (no default)" -m --master= string: name of the pool master/server you want to connect to (no default); -s --server= string: name of the server (host) you want to install your VM (no default); -v --vm= string: name of the new VM (default: new); -i --info= string: description of the new VM (default: New Debian VM); -d --distro= [5,6]: release number of Debian release (default: 6); -a --answerfile= [address] : address of preseed file to use (no default)" -r --repo= [address]: address of local mirror (default http://ftp.debian.org/debian)" -A --arch= [32,64]: VM architecture (default: 32); -C --cpu= int: number of virtual CPU assign to vm (default 1); -M --memory= float: number of memory in GB (default 1.0);