Xen Debian.py

From Xen

Revision as of 10:46, 12 January 2012 by Lars.kurth (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

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.

I used XMLRPClib module directly rather than XenAPI python wrapper, because of XAPI developers. It seems that XenAPI may cause some problems and doesn't bring so many advantages.

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

[niewod on bizantium] /local/home/niewod #>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: xendebian.conf and ~xendebian.py);
   -u --username= string: username to connect to the pool master/server;
   -p --password= string: password used to login into  the pool master/server;
   -m --master= string: name of the pool master/server you want to connect to;
   -s --server= string: name of the server (host) you want to install your VM;
   -v --vm= string: name of the new VM;
   -i --info= string: description of the new VM;
   -d --distro= [5,6]: release number of Debian release;
   -a --answerfile= [address] : address of preseed file to use;
   -r --repo= [address]: address of local mirror;
   -A --arch= [32,64]: VM architecture;
   -C --cpu= int: number of virtual CPU assign to vm;
   -M --memory= float: number of memory in GB;
   




Personal tools