Difference between revisions of "Xen Debian.py"

From Xen
m
Line 44: Line 44:
   
 
=== Help ===
 
=== Help ===
[user on server] /home/user #>XenDebian.py --help
+
[niewod on bizantium] /local/home/niewod #>XenDebian.py --help
 
This is the tool to create a Debian based VM.
 
This is the tool to create a Debian based VM.
 
It is controlled by following options:
 
It is controlled by following options:
-c --configfile= string: name of a file with config (default: xendebia.conf);
+
-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 (default: root);
 
-p --password= string: password used to login into the pool master/server (no default)"
+
-u --username= string: username to connect to the pool master/server;
-m --master= string: name of the pool master/server you want to connect to (no default);
+
-p --password= string: password used to login into the pool master/server;
-s --server= string: name of the server (host) you want to install your VM (no default);
+
-m --master= string: name of the pool master/server you want to connect to;
-v --vm= string: name of the new VM (default: new);
+
-s --server= string: name of the server (host) you want to install your VM;
-i --info= string: description of the new VM (default: New Debian VM);
+
-v --vm= string: name of the new VM;
-d --distro= [5,6]: release number of Debian release (default: 6);
+
-i --info= string: description of the new VM;
-a --answerfile= [address] : address of preseed file to use (no default)"
+
-d --distro= [5,6]: release number of Debian release;
-r --repo= [address]: address of local mirror (default http://ftp.debian.org/debian)"
+
-a --answerfile= [address] : address of preseed file to use;
-A --arch= [32,64]: VM architecture (default: 32);
+
-r --repo= [address]: address of local mirror;
  +
-A --arch= [32,64]: VM architecture;
-C --cpu= int: number of virtual CPU assign to vm (default 1);
 
-M --memory= float: number of memory in GB (default 1.0);
+
-C --cpu= int: number of virtual CPU assign to vm;
  +
-M --memory= float: number of memory in GB;
  +
  +
  +
 
 
   

Revision as of 17:49, 4 January 2012

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

[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;