This is a Vagrant plugin that adds a XenServer provider, allowing Vagrant to control and provision machines on a XenServer host.
- Vagrant >= 1.5(?) (http://www.vagrantup.com/downloads.html)
- qemu-img
vagrant plugin install http://repo.jcamp.net/gems/vagrant-xenserver/vagrant-xenserver-0.0.11.gem
N.B. Currently this will only work on XenServer 6.5 and later:
# Install netcat
yum install --enablerepo=base,extras --disablerepo=citrix -y nc
You will also need to copy your ssh key to the Xenserver host:
ssh-copy-id root@xenserver
Make sure the default_SR is set, and that a VHD-based SR is in use. Currently the NFS SR is the recommended storage type.
- Download the box file (e.g. https://vagrantcloud.com/ubuntu/trusty64/version/v20160323.1.0/provider/virtualbox.box)
- Unpack it:
mkdir tmp
cd tmp
tar xvf ../virtualbox.box
- Convert the disk image using qemu-img
qemu-img convert -O vpc *.vmdk box.vhd
- Remove the other files
rm -f Vagrantfile box.ovf metadata.json
- Make a new metadata file
echo "{\"provider\": \"xenserver\"}" > metadata.json
- Create the box:
tar cf ../xenserver.box .
- Add the box:
vagrant box add ubuntu xenserver.box
- Download and compile
xva-img
tools - Follow the instruction there on how to extract the
.xva
to get theraw
image - convert the
raw
image to bevhd
file just like above instructions and follow the rest
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu"
config.vm.provider :xenserver do |xs|
xs.xs_host = "st29.uk.xensource.com"
xs.xs_username = "root"
xs.xs_password = "xenroot"
xs.pv = true
xs.memory = 2048
end
config.vm.network "public_network",
network: "LAN",
device: "eth1", # Don't ever use eth0
proto: "static",
ip: "192.168.1.10",
netmask: "255.255.255.0",
gateway: "192.168.1.1",
dns: "8.8.8.8 8.8.4.4"
end
This fork is different from the original in how to configure the network. Instead of using bridge
option, here we are using the name label
of the network, please see example above.
Note that by default there will be no connection to the external network, so most configurations will require a public_network
defined as in the above Vagrantfile
Another consideration is that if there is already DHCP service on xenbr0
network (outside the XenServer), or you prefer to set static IP there, you should prevent the HIMN (Host Intermal Management Network) to be the default gateway. It can be done by running these commands in the Xenserver Host (as root):
himn=`xe network-list other-config:is_host_internal_management_network=true --minimal`
xe network-param-set uuid=$himn other-config:ip_disable_gw=true
To bring the VM up, it should then be as simple as
vagrant up --provider=xenserver
To use NFS, please specify something like this in your Vagrantfile
. See the documentation for a complete reference
machine.vm.synced_folder ".", "/vagrant",
id: "vagrant-root",
disabled: false,
type: "nfs",
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
- You must install
vagrant-winnfsd
plugin
vagrant plugin install vagrant-winnfsd
- You need to install the original
winnfsd
or a patched version, and put the binarywinnfsd.exe
inC:\HashiCorp\Vagrant\bin