A builder plugin for Packer.IO to support building XenServer images.
Go to file
kunm f79980553f CP-18743: refine type of NetworkNames & remove unused code
Signed-off-by: kunm <kun.ma@citrix.com>
2016-09-05 17:05:44 +08:00
builder/xenserver CP-18743: refine type of NetworkNames & remove unused code 2016-09-05 17:05:44 +08:00
docs/builders Added VM description field 2015-05-06 06:25:12 +04:00
examples CP-18743: Make packer-build-xenserver support VIF configuration 2016-09-02 23:15:34 +08:00
Godeps Add Godeps 2016-07-15 09:44:41 -07:00
plugin Rebase and add USE_XE option to xva export 2016-07-15 09:54:23 -07:00
vendor CP-18646: Make packer-build-xenserver support other-config for vm packing 2016-08-23 11:55:38 +08:00
.gitignore Add build dirs to gitignore 2015-01-02 16:55:43 +00:00
.travis.yml Rebase and add USE_XE option to xva export 2016-07-15 09:54:23 -07:00
build.sh Rebase and add USE_XE option to xva export 2016-07-15 09:54:23 -07:00
LICENSE Initial plugin for building XenServer images using Packer.IO 2014-11-10 18:16:02 +00:00
README.md CP-18743: refine type of NetworkNames & remove unused code 2016-09-05 17:05:44 +08:00

Build Status

XenServer packer.io builder

This builder plugin extends packer.io to support building images for XenServer.

You can check out packer here.

Dependencies

Install Go

Follow these instructions and install golang on your system:

Install Packer

Clone the Packer repository:

git clone https://github.com/mitchellh/packer.git

Then follow the instructions to build and install a development version of Packer.

Compile the plugin

Once you have installed Packer, you must compile this plugin and install the resulting binary.

cd $GOROOT
mkdir -p src/github.com/rdobson/
cd src/github.com/rdobson
git clone https://github.com/rdobson/packer-builder-xenserver.git
cd packer-builder-xenserver
./build.sh

If the build is successful, you should now have packer-builder-xenserver-iso and packer-builder-xenserver-xva binaries in your $GOPATH/bin directory and you are ready to get going with packer; skip to the CentOS 6.6 example below.

In order to do a cross-compile, run instead:

XC_OS="windows linux" XC_ARCH="386 amd64" ./build.sh

This builds 32 and 64 bit binaries for both Windows and Linux. Native binaries will be installed in $GOPATH/bin as above, and cross-compiled ones in the pkg/ directory.

Don't forget to also cross compile Packer, by running

XC_OS="windows linux" XC_ARCH="386 amd64" make bin

(instead of make dev) in the directory where you checked out Packer.

CentOS 6.6 Example

Once you've setup the above, you are good to go with an example.

To get you started, there is an example config file which you can use: examples/centos-6.6.json

The example is functional, once suitable remote_host, remote_username and remote_password configurations have been substituted.

A brief explanation of what the config parameters mean:

  • type - specifies the builder type. This is 'xenserver-iso', for installing a VM from scratch, or 'xenserver-xva' to import existing XVA as a starting point.
  • remote_username - the username for the XenServer host being used.
  • remote_password - the password for the XenServer host being used.
  • remote_host - the IP for the XenServer host being used.
  • vm_name - the name that should be given to the created VM.
  • vm_memory - the static memory configuration for the VM, in MB.
  • disk_size - the size of the disk the VM should be created with, in MB.
  • iso_name - the name of the ISO visible on a ISO SR connected to the XenServer host.
  • http_directory - the path to a local directory to serve up over http.
  • ssh_username - the username set by the installer for the instance.
  • ssh_password - the password set by the installer for the instance.
  • boot_command - a list of commands to be sent to the instance over VNC.
  • vm_other_config - a map of string to string for setting vm's other-config.
  • network_names - a list of network name for the VIFs to connect with.

Note, the http_directory parameter is only required if you want Packer to serve up files over HTTP. In this example, the templated variables {{ .HTTPIP }} and {{ .HTTPPort }} will be substituted for the local IP and the port that Packer starts its HTTP service on.

Once you've updated the config file with your own parameters, you can use packer to build this VM with the following command:

packer build centos-6.6.json

Documentation

For complete documentation on configuration commands, see either the xenserver-iso docs or the xenserver-xva docs.