OpenNebula

From GigaTux Wiki
Jump to navigation Jump to search

Pre-Installation Tasks

  1. groupadd --gid 2001 oneadmin
  2. useradd --uid 201 -g oneadmin -d /var/lib/one -m oneadmin
  3. elinks http://downloads.opennebula.org/
  4. apt-get install mysql-server git ruby-dev
  5. As MySQL root: GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY 'password'

Install

  1. dpkg --install *.deb
  2. apt-get -f install (to get dependencies)
  3. /usr/share/opennebula/install_gems
  4. gem install nokogiri
  5. cd /usr/share/opennebula
  6. ./install_novnc.sh

Configure

Host configuration

  1. Copy /home/marc/git/xen/dist/install/usr/local/lib/xen/boot/pv-grub* on Flibble to /usr/lib/xen-4.1/boot/
  2. Ensure that /etc/xen/xend-config.sxp has the vnc-listen directive set to 0.0.0.0
  3. Also ensure that /etc/xen/xend-config.sxp has the following configured:
 (xend-relocation-server yes)
 (xen-api-server ((9363 'none') (unix)))
 (xend-tcp-xmlrpc-server yes)
 (xend-tcp-xmlrpc-server-address )
  1. Add opennebula to /etc/hosts
  2. apt-get install ruby sshfs
  3. Copy key to /root/.ssh/authorized_keys
  4. groupadd and useradd commands as above
  5. usermod -a -G disk oneadmin
  6. mkdir /etc/xen/auto
  7. mkdir /etc/xen/vm
  8. ssh-keygen for oneadmin and add to authorized_keys on opennebula controller
  9. Add to /etc/sudoers:
 oneadmin  ALL=(ALL) NOPASSWD: /usr/sbin/xm *
 oneadmin  ALL=(ALL) NOPASSWD: /usr/sbin/xentop *
 oneadmin  ALL=(ALL) NOPASSWD: /sbin/lvs *
 oneadmin  ALL=(ALL) NOPASSWD: /sbin/lvcreate *
 oneadmin  ALL=(ALL) NOPASSWD: /sbin/lvremove *
 oneadmin  ALL=(ALL) NOPASSWD: /bin/dd *
  1. Mount the datastore by adding to /etc/fstab
 sshfs#oneadmin@opennebula:/var/lib/one/datastores/1   /var/lib/one/datastores/1   fuse defaults,allow_other,reconnect   0 0

Front end

  1. mkdir ~/.one
  2. echo "oneadmin:password" > ~/.one/one_auth
  3. chmod 600 ~/.one/one_auth
  4. Change :host: to 0.0.0.0 and :port: to 80 in /etc/one/sunstone-server.conf
  5. echo "Host *" >> ~/.ssh/config
  6. echo " StrictHostKeyChecking no" >> ~/.ssh/config
  7. Authorise self to SSH: cat /var/lib/one/.ssh/id_rsa.pub >> /var/lib/one/.ssh/authorized_keys

CXM

  1. cd ~
  2. git clone git://github.com/nagius/cxm
  3. cd git/cxm/miscl
  4. cp -r opennebula/tm opennebula/vmm /var/lib/one/remotes
  5. cp cxm.conf /etc/
  6. Change XPATH directive in cxm.conf to read "xpath -e"
  1. N.B. Not sure what this does. Ignore for now:
 Change the post-migration hook in the cxm configuration to use one-migrate script. In /etc/xen/cxm.conf, change:e in /etc/xen/cxm.conf :
 POST_MIGRATION_HOOK="/usr/local/sbin/one-migrate"
 And update this script to fill the variable ONE_HOST with the hostname of your OpenNebula frontend.

Root OpenNebula Configuration

  1. Make OpenNebula use the MySQL backend by editing /etc/one/oned.conf:
 DB = [ backend = "mysql",
   server  = "localhost",
   port    = 0,
   user    = "oneadmin",
   passwd  = "password",
   db_name = "opennebula" ]
  1. Go to /var/lib/one/remotes/vmm/xen/xenrc and uncomment the line:
 export XM_CREDITS="sudo $XM_PATH sched-credit"
  1. Change /etc/one/oned.conf to uncomment the following (commenting the KVM lines):
 IM_MAD = [
     name       = "im_xen",
     executable = "one_im_ssh",
     arguments  = "xen" ]
 
 VM_MAD = [
     name       = "vmm_xen",
     executable = "one_vmm_exec",
     arguments  = "xen",
     default    = "vmm_exec/vmm_exec_xen.conf",
     type       = "xen" ]
  1. Also add cxm to the TM_MAD directive so it reads:
 TM_MAD = [
 executable = "one_tm",
 arguments  = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmware,iscsi,cxm" ]
  1. Add the cxm driver:
 VM_MAD = [
 name       = "vmm_cxm",
 executable = "one_vmm_exec",
 arguments  = "-t 15 -r 0 cxm",
 default    = "vmm_exec/vmm_exec_xen.conf",
 type       = "xen" ]
  1. Change the default disk driver for phy: in /etc/one/vmm_exec/vmm_exec_xen.conf :
 DISK = [ driver = "phy:" ]
  1. Change the default device prefix
 DEFAULT_DEVICE_PREFIX = "xvd"
  1. Add the following to /etc/rc.local:
 sunstone-server start

Hosts

  • onehost create cloud1 --im im_xen --vm vmm_cxm --net dummy
  • onehost create cloud2 --im im_xen --vm vmm_cxm --net dummy
  • onehost enable cloud1
  • onehost enable cloud2

Datastores

  • Change the default datastore to use cxm by typing onedatastore update 1
 TM_MAD="cxm"
  • onedatastore create
 NAME="london1cxm"
 DS_MAD="fs"
 TM_MAD="cxm"
 NO_DECOMPRESS="yes"
  • onecluster adddatastore London1 london1cxm

Clusters

  • onecluster create London1
  • onecluster addhost London1 cloud1
  • onecluster addhost London1 cloud2
  • onecluster update 102
 SYSTEM_DS="X" where X is the cxm datastore

Images

  • Create debian.one in /images with the following
 NAME = "Deb 6 x86 Std"
 PATH = "/images/debian-opennebula.tar.gz"
 TYPE = OS
 DESCRIPTION = "Debian 6 (Squeeze) x86_64 with standard system utilities"
  • oneimage create debian.one -d 103
  • Download the OpenNebula Virtual Router
  • gunzip it in /images
  • Create router.one in /images with the following
 NAME = "OpenNebula Router"
 PATH = "/images/router.img"
 TYPE = OS
 DESCRIPTION = "OpenNebula Router"
  • oneimage create router.one -d 103

Networks

Create eth0.net with the following contents

NAME = "Network Name"
TYPE = ranged

BRIDGE = eth0
NETWORK_SIZE = 30
NETWORK_ADDRESS = 192.168.1.224

GATEWAY = 192.168.1.254
DNS = 8.8.8.8

Templates

  • onetemplate create
 CPU="1"
 DISK=[
   FORMAT="ext3",
   IMAGE_ID="XX"
   SIZE="1024",
   TYPE="fs" ]
 DISK=[
   SIZE="128",
   TYPE="swap" ]
 GRAPHICS=[
   TYPE="vnc" ]
 MEMORY="128"
 NAME="Template Name"
 NIC=[
   NETWORK="Network Name" ]
 OS=[
   BOOTLOADER="/usr/lib/xen-4.1/bin/pygrub" ]
 RAW=[
   TYPE="xen" ]
 TEMPLATE_ID="X"
 VCPU="1"
  • onetemplate create (for the router)
 CONTEXT=[
   DHCP="YES",
   NTP="NO",
   PRIVNET="$NETWORK[TEMPLATE, NETWORK=\"Network Name\"]",
   TARGET="hdb",
   TEMPLATE="$TEMPLATE" ]
 CPU="1"
 DISK=[
   FORMAT="ext3",
   IMAGE_ID="YY"
   SIZE="2048",
   TYPE="raw" ]
 GRAPHICS=[
   TYPE="vnc" ]
 MEMORY="128"
 NAME="One Router"
 NIC=[
   NETWORK="Network Name" ]
 OS=[
   BOOTLOADER="/usr/lib/xen-4.1/bin/pygrub" ]
 RAW=[
   TYPE="xen" ]
 TEMPLATE_ID="X"
 VCPU="1"

CXM post-configuration

  1. apt-get install python-twister python-paramiko
  2. git clone https://github.com/nagius/cxm.git
  3. cp -rv cxm/lib/cxm /usr/lib/python2.7
  4. ln -s /usr/lib/xen-4.1/lib/python/xen /usr/lib/python2.7/

Miscellaneous

  1. Download the vm_runn utility and save in ~oneadmin