Showing posts with label OpenNebula. Show all posts
Showing posts with label OpenNebula. Show all posts

Thursday, September 1, 2011

Overview of OpenNebula Step by Step Guide


OpenNebula can be primarily used as a virtualization tool to manage your virtual infrastructure in the data-center or cluster.
  • OpenNebula is a toolkit for building Clouds ( public cloud,private cloud )
  •  It Supports KVM , Xen , Vmware Server , VirtualBox (planned from 1.4.2)
  •  It consists of  Front End , Node
    Front End installation
    $ sudo apt-get install opennebula
          Reading package lists... Done 
          Building dependency tree 
          Reading state information... Done 
          The following extra packages will be installed: 
            opennebula-common 
          The following NEW packages will be installed: 
            opennebula opennebula-common 
          0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. 
          Need to get 280kB of archives. 
          After this operation, 1352kB of additional disk space will be used. 
          Do you want to continue [Y/n]? 
          … 
          Setting up opennebula-common (1.2-0ubuntu1~intrepid1) … 
          … 
          Adding system user `oneadmin’ (UID 107) … 
          Adding new user `oneadmin’ (UID 107) with group `nogroup’ … 
          Generating public/private rsa key pair. 
          … 
          Setting up opennebula (1.2-0ubuntu1~intrepid1) …
          oned and scheduler started 


    Node Installation

    $ sudo apt-get install opennebula-node 
        Reading package lists... Done 
        Building dependency tree 
        Reading state information... Done 
        The following extra packages will be installed: 
          opennebula-common 
        The following NEW packages will be installed: 
          opennebula-common opennebula-node 
        ... 
        Setting up opennebula-node (1.2-0ubuntu1~intrepid1) ...
        Adding user `oneadmin' to group `libvirtd' ... 
        Adding user oneadmin to group libvirtd 
        Done. 

     OpenNebula Core
    ----------------------
        *      Request Manager, to handle client requests
        *      Virtual Machine Manager, to manage and monitor of VMs
        *      Transfer Manager, to manage VM images
        *      Virtual Network Manager, to manage virtual networks
        *      Host Manager, to manage and monitor physical resources
        *      Database, persistent storage for ONE data structures

    OpenNebula does the following:
    ------------------------------------
        *      Manages Virtual Networks. Virtual networks interconnect VMs. Each Virtual Networks includes a description.
        *      Creates VMs. The VM description is added to the database.
        *      Deploys VMs. According to the allocation policy, the scheduler decides where to execute the VMs.
        *      Manages VM Images. Before execution, VM images are transferred to the host and swap disk images are created. After execution, VM images may be copied back to the repository.
        *      Manages Running VMs. VM are started, periodically polled to get their consumption and state, and can be shutdown, suspended, stopped or migrated.

    The main functional components of an OpenNebula Private Cloud are the following:
    -------------------------------------------------------------------------------------
        *      Hypervisor: Virtualization manager installed in the resources of the cluster that OpenNebula leverages for the management of the VMs within each host.
        *      Virtual Infrastructure Manager: Centralized manager of VMs and resources, providing virtual network management, VM life-cycle management, VM image management and fault tolerance.
        *      Scheduler: VM placement policies for balance of workload, server consolidation, placement constraints, affinity, advance reservation of capacity and SLA commitment.



    Daemon Configuration Attributes
    -------------------------------------

        *      HOST_MONITORING_INTERVAL : Time in seconds between host monitorization
        *      VM_POLLING_INTERVAL : Time in seconds between virtual machine monitorization
        *      VM_DIR : Remote path to store the VM images, it should be shared between all the cluster nodes to perform live migrations. This path will be used for all the cluster nodes.
        *      MAC_PREFIX: Default MAC prefix to generate virtual network MAC addresses
        *      NETWORK_SIZE: Default size for virtual networks
        *      PORT : Port where oned will listen for xml-rpc calls
        *      DEBUG_LEVEL : Sets the level of verbosity of $ONE_LOCATION/var/oned.log log file. Possible values are:

    DEBUG_LEVEL    Meaning
    ---------------------------------
    0                               ERROR
    1                               WARNING
    2                               INFO
    3                               DEBUG 



    Command line interface
    --------------------------------

        *      onevm: to submit, control and monitor virtual machines
        *      onehost: to add, delete and monitor hosts


    $ onehost list
     HID NAME                      RVM   TCPU   FCPU   ACPU    TMEM        FMEM       STAT
       0 host01                      0         800     800     800      8194468    7867604   on
       1 host02                      0         800      797    800      8387584    1438720   on

    onevm list
     ID     USER     NAME         STAT  CPU     MEM            HOSTNAME        TIME
     1001 oneadmin  fc11AOS   dele      0          512000           node2                02 22:10:56

    What is OpenNebula ?

    •It is an open source toolkit for building clouds. 
    •The latest release has built-in support for KVM, Xen Kernel and VmWare Server. 

    How OpenNebula works ?

    OpenNebula is a distributed application containing two components 

    The first component referred to as OpenNebula front-end runs on VX64 server. 

    sudo apt-get install opennebula 

    The second component referred to as OpenNebula Node should be installed on all hosts part of the compute cluster. This package prepares the machine for being a node in an OpenNebula cloud. It in turn configures the following dependent packages: 

    1) KVM 
    2) libvirt 
    3) oneadmin user creation 
    4) ruby 

    sudo apt-get install opennebula-node

    What are the components of opennebula front-end ?

    OpenNebula front-end spawns the following processes when it starts: ( Note that front-end should always be started as oneadmin user using the command sudo -u oneadmin one start ) 

    1) OpenNebula Daemon ( oned ) - Responsible for handling all incoming requests ( either from CLI or from API ). Talks to other processes whenever required. 

    2) Scheduler ( mm_sched ) - It does match making to find a suitable host ( amongst the hosts part of compute cluster ) for bringing up virtual machines. 

    3) Information Manager ( one_im_ssh.rb ) - Collects resource availability/utilization information for hosts/VMs respectively. ( Resources include CPU and Memory) 

    4) Transfer Manager ( one_tm.rb ) - Responsbile for Image Managemnt ( Clone Image, Delete Image, etc. ) 

    5) Virtual Machine Manager ( one_vmm_kvm.rb )- Acts as interface to the underlying Hypervisor. ( All operations to be performed on Virtual Machines go through this interface ) 

    6) Hook Manager ( one_hm.rb ) - Responsible for executing Virtual Machine Hooks. ( Hooks are programs which are automatically triggered on VM state changes. They must be configured prior to starting front-end ) 

    OpenNebula front-end can be configured to a great extent by modifying the contents of file /etc/one/oned.conf. Consider a sample configuration below: 

    ################################################################################
    HOST_MONITORING_INTERVAL=10 # Used by Information manager to decide the frequency at which resource availability details have to be collected for hosts 

    VM_POLLING_INTERVAL=10 # Used by Information manager to decide the frequency at which resource utilization details have to be collected for VMs 

    VM_DIR=/mnt/onenfs/ # Should be shared across all hosts in compute cluster. Contains Disk Images required for booting VMs 

    PORT=2633 # All supported API calls are converted to XML-RPC calls. front-end runs an XML-RPC Server on this port to handle these calls 

    DEBUG_LEVEL=3 # DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG 

    NETWORK_SIZE = 254 # Default size for Virtual Networks ( applicable while using onevnet ) 

    MAC_PREFIX = "00:03" # Default MAC prefix to use while generating MAC Address from IP Address ( applicable while using onevnet ) 

    # The following configuration supports KVM hypervisor. Note that the executables one_im_ssh one_vmm_kvm one_tm and one_hm can be found in /usr/lib/one/mads/ 

    IM_MAD = [ 
    name = "im_kvm", 
    executable = "one_im_ssh", 
    arguments = "im_kvm/im_kvm.conf" ] 

    VM_MAD = [ 
    name = "vmm_kvm", 
    executable = "one_vmm_kvm", 
    default = "vmm_kvm/vmm_kvm.conf", 
    type = "kvm" ] 

    TM_MAD = [ 
    name = "tm_nfs", 
    executable = "one_tm", 
    arguments = "tm_nfs/tm_nfs.conf" ] 

    HM_MAD = [ 
    executable = "one_hm" ]

    Working with OpenNebula CLI ( OpenNebula CLI is available only on front-end )

    1) Adding a new Host to compute cluster 

    onehost create 

    Note that im_mad, vmm_mad, tm_mad in our case should be im_kvm, vmm_kvm and tm_nfs respectively as we have configured them in /etc/one/oned.conf 

    Also note that Information manager needs to collect resource availability ( CPU and Memory ) information for the host we have added. This requires: 

    • oneadmin user on front-end should be able to ssh to host without entering password ( test this using sudo -u oneadmin ssh oneadmin@ on front-end ) 
    • Inorder for this to work copy the contents of /var/lib/one/.ssh/id_rsa.pub on front-end to /var/lib/one/.ssh/authorized_keys on host 

    Type onehost list to check the status: 

    Notice the value of STAT attribute. If the attribute has a value of 'on' then the host has been successfully added to compute cluster: 

    ID NAME RVM TCPU FCPU ACPU TMEM FMEM STAT 
    0 192.168.155.127 0 200 198 198 1800340 1341620 on 


    Look into /var/log/one/oned.log on front-end for debugging 
    Once a host has been successfully added use onehost disable/enable to toggle its status. 


    2) Submitting a new Virtual Machine job 

    In order to provision a Virtual Machine in the compute cluster we need to construct a template and submit it using 

    onevm create