Xen Debian.py

From Xen
Revision as of 17:43, 4 January 2012 by WawrzekNiewodniczanski (talk | contribs) (Direct code)

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