Jun 19, 2011

OpenNebula installation on Ubuntu (II)

Once we have made up the shared storage, the database and the requeried users, we are going to carry on the article about OpenNebula installation on Ubuntu by installing the dependences of OpenNebula.

root@frontend01:~# aptitude install build-essential ruby libxmlrpc-c3-dev scons libopenssl-ruby libssl-dev flex bison ruby-dev rake rubygems libxml-parser-ruby libxslt1-dev libnokogiri-ruby libsqlite3-dev

Now we are ready to download the source code of OpenNebula, compile it (with the MySQL option activated) and install it into the /srv/cloud/one directory.

root@frontend01:~# su - oneadmin ; cd /tmp

oneadmin@frontend01:/tmp$ wget http://dev.opennebula.org/attachments/download/395/opennebula-2.2.1.tar.gz

oneadmin@frontend01:/tmp$ tar xvzf opennebula-2.2.1.tar.gz ; cd opennebula-2.2.1

oneadmin@frontend01:/tmp/opennebula-2.2.1$ cat src/vmm/LibVirtDriverVMware.cc
...
        if ( emulator != "vmware" )
        {
                file << "\t\t\t<driver name='";

                if ( !driver.empty() )
                {
                        file << driver << "'/>" << endl;
                }
                else
                {
                        file << default_driver << "'/>" << endl;
                }
        }
...

oneadmin@frontend01:/tmp/opennebula-2.2.1$ scons mysql=yes parsers=yes

oneadmin@frontend01:/tmp/opennebula-2.2.1$ ./install.sh -d /srv/cloud/one

Before compiling OpenNebula, it is necessary to fix a severe mistake into a file from the source code (LibVirtDriverVMware.cc). This bug does not allow to deploy virtual machines on VMware ESXi, since when OpenNebula makes the deployment templates includes the raw format as the default DRIVER.

oneadmin@frontend01:~/templates$ virsh -c esx://esxi01/?no_verify=1
Enter username for esxi01 [root]: oneadmin
Enter oneadmin's password for esxi01:
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # define /srv/cloud/one/var/0/deployment.0
error: Failed to define domain from /srv/cloud/one/var/0/deployment.0
error: internal error Unknown driver name 'raw'

The last step before starting OpenNebula, is to set up (within the oned.conf file) the MySQL connection parameters (remember that in this case, you have to comment the line related to SQLite).

oneadmin@frontend01:/tmp/opennebula-2.2.1$ cat /srv/cloud/one/etc/oned.conf
...
# DB = [ backend = "sqlite" ]

DB = [ backend = "mysql",
   server  = "localhost",
   port    = 0,
   user    = "oneadmin",
   passwd  = "xxxxxx",
   db_name = "opennebula" ]
...

By means of the one script (situated in $ONE_LOCATION/bin), we can run and stop the OpenNebula daemon (oned) and the scheduler (mm_sched). Also say that the log files are located in $ONE_LOCATION/var.

oneadmin@frontend01:~$ one start

oneadmin@frontend01:~$ one stop

And finally, mention too that if we want that the operating system to start automatically OpenNebula during the boot, we must create a LSB init script for this purpose.

root@frontend01:~# cat /etc/init.d/opennebula
#!/bin/bash

### BEGIN INIT INFO
# Provides:          OpenNebula
# Required-Start:    $remote_fs $syslog $network
# Required-Stop:     $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

export ONE_LOCATION=/srv/cloud/one
export ONE_AUTH=$ONE_LOCATION/.one/one_auth
export ONE_XMLRPC=http://localhost:2633/RPC2
export PATH=$ONE_LOCATION/bin:$PATH

RETVAL=0

start()
{
     su oneadmin -s /bin/bash -c '$ONE_LOCATION/bin/one start' ; RETVAL=$?
     return $RETVAL
}

stop()
{
     su oneadmin -s /bin/bash -c '$ONE_LOCATION/bin/one stop' ; RETVAL=$?
}

case "$1" in
     start)
             sleep 5
             start
             ;;
     stop)
             stop
             ;;
     restart)
             stop
             start
             ;;
     *)
             echo $"Usage: service opennebula {start stop restart}"
esac

exit $RETVAL


root@frontend01:~# chmod +x /etc/init.d/opennebula

root@frontend01:~# update-rc.d opennebula start 90 2 3 4 5 . stop 10 0 1 6 .


3 comments:

  1. Nice explain :) I will wait for next article ... connect to ESXI Node

    ReplyDelete
  2. Next week... I hope!

    Because this is incredible, I cannot believe how a final version as the 2.2 or 2.2.1 can be released without being tested against a VMware ESXi, and then to say that works with VMware...

    I have found two serious bugs, one of them into the LibVirtDriverVMware.cc file (I have already fixed it in this article) and the other one related to the VMware Drivers Addon.

    ReplyDelete
  3. Gracias por el post, soy bastante nobato y me gustaría saber el porque de este error:
    oneadmin@jhigueras:~/templates$ /var/lib/one/remotes/im/run_probes kvm kvm01
    WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-ekavUl/pkcs11: Permission denied
    ARCH=x86_64 MODELNAME="AMD Phenom(tm) II X6 1055T Processor" HYPERVISOR=kvm TOTALCPU=600 CPUSPEED=800 TOTALMEMORY=8176016 USEDMEMORY=1774116 FREEMEMORY=6401900 FREECPU=555.0 USEDCPU=45.0 NETRX=118773339 NETTX=12041828 HOSTNAME=jhigueras oneadmin@jhigueras:~/templates$

    Gracias de antemano

    ReplyDelete