To test openstack compute (Nova) with xen based machine, it needs XCP (Xen Cloud Planform) or Xenserver. Openstack compute supports KVM, XenServer/XCP and ESXi hypervisor. I chose XCP because it needs no license.
XCP is open source version of XenServer which has the same toolstack with XerServer. As a Cronos project, it is able to use XCP on Ubuntu 12.04 called Precise. (For Fedora and Centos users, they should wait until May. XCP team is porting xen on Fedora and CentOS, It will be finished by May)
I prepared the following servers for the test.
- 1 Virtual Machine: Openstack compute, installed Ubuntu.
- 1 Physical Machine : Openstack Controller, Ubuntu 12.04 beta (XCP 1.5 beta)
When creating virtual machine on XCP, it has to create a storage repository first. XCP uses SR (Storage Repository) to store virtual machine images, ISO files and templates. SR supports for IDE, SATA, SCSI and SAS drives locally connected, and iSCSI, NFS, SAS and Fibre Channel remotely connected.
I have known storage repository concept since Oracle VM. I used NFS as a shared resository. NFS also can be used in XCP. However, I only have one physical machine this time. There are two physical hard disks on the server. One is for operating system and the other is for storage of XCP.
Set the environment of XCP
As a result of Cronos project, it is able to install xcp using agt-get command on Ubuntu 12.04.
1) Set up software repositories
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ubuntu-xen-org/xcp-unstable
2) Workaround xcp-networkd missing file
$ mkdir /etc/xcp
$ echo "bridge" >> /etc/xcp/network.conf
3) Install xapi: This step installs XCP's xapi and all its dependencies, including the Xen hypervisor.
$ apt-get pciutils
$ apt-get update
$ apt-get install xcp-xapi
$ apt-get install xcp-xe
4) Workaround VM's not going to power-state: halted after shutdown
$ vi /usr/lib/xcp/scripts/vif
remove) => remove|offline)
if [ "${TYPE}" = "vif" ] ;then
call_hook_script $DOMID "${ACTION}"
# Unclear whether this is necessary, since netback also does it:
logger -t script-vif "${dev}: removing ${HOTPLUG_STATUS}"
xenstore-rm "${HOTPLUG_STATUS}"
5) Workaround XAPI conflicts with XEND
$ sudo sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend
$ sudo update-rc.d xendomains disable
6) Workaround qemu keymap location preventing vncterm from starting
$ sudo mkdir /usr/share/qemu
$ sudo ln -s /usr/share/qemu-linaro/keymaps /usr/share/qemu/keymaps
7) Make xen the default grub entry.
$ sed -i 's/GRUB_DEFAULT=.\+/GRUB_DEFAULT="Xen 4.1-amd64"/' /etc/default/grub
$ update-grub
Create local storage repository
If you want to create a VM before create a SR, you meet the following error:
Error: No SR specified and Pool default SR is null
So, I make a partition to map storage repository
$ pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
$ pvdisplay
----- Physical volmue -------
PV Name /dev/sda2
VG Name VolGroup00
PV Size 11.72 GB / not usable 1.68 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 375
Free PE 0
Allocated PE 375
PV UUID AN--------------
----- Physical volmue -------
PV Name /dev/sda3
VG Name VolGroup00
PV Size 8.17 GB / not usable 17.80 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 261
Free PE 261
Allocated PE 0
PV UUID Tj--------------
$ xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_ST3320620AS_5QF7QZZL name-label=”local storage”
After run this command, an error was occurred.
The SR could not be connected because the driver was not recognised.
driver: lvm
Set EXT if you have an unused block device. I got an idea of how to solve from here.
Tried again after changed type from lvm to ext
$ xe sr-create type=ext content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_ST3320620AS_5QF7QZZL name-label=”local storage”
# Create a vm
$ net_uuid=$(xe network-list bridge=xenbr0 --minimal)
$ vm=$(xe vm-install new-name-label="centos-test" template="CentOS 5 (64-bit)" sr-name-label="local stroage")
$ xe vif-create vm-uuid=$vm network-uuid=$net_uuid mac=random device=0
$ xe vm-param-set uuid=$vm other-config:install-repository=http://ftp.daum.net/centos/5/os/x86_64
$ xe vm-param-set uuid=$vm other-config:disable_pv_vnc=1
$ xe vm-start uuid=$vm
# Connecting to xenconsole
$ dom_id=$(xe vm-list uuid=$vm params=dom-id --minimal)
$ /usr/lib/xen-4.1/bin/xenconsole ${dom_id}
Type ctrl + ] if you want to close xencosole
References:
1. XCP toolstack on a Debian: http://wiki.xen.org/wiki/XCP_toolstack_on_a_Debian-based_distribution
2. Hypervisor support matrix: http://wiki.openstack.org/HypervisorSupportMatrix
3. CentOS 6 VM (64 bit) automated installation on XCP: http://grantmcwilliams.com/item/563-centos6-on-xcp