Overview of OpenNebula Step by Step Guide - Shashank Rachamalla ( Hexagrid networks )

( Ref : OpenNubula.org  )


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

    Migrating Windows XP Virtual Machine from ESX to KVM

    Before converting any Windows Virtual Machine we have to enable IDE in the registry and uninstall VMware tools form VM.


    1. Uninstall VMware tools form VM

    2. Below is the process to enable IDE in Windows registry.

    Login into the VM which you want to migrate, extract the Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys files from the

    %SystemRoot%\Driver Cache\I386\Driver.cab file, and copy into the %SystemRoot%\System32\Drivers folder.

    Now we will Import new registry settings into windows registry

    Open regedit-->Go to file-->Export-->Give a file name-->Click save to save a registry file.

    Right Click on saved reg file and click-->Edit-->Open below link-->Copy each line from below link-->Replace copied data into Opened registry file-->Save the registry file

    3. Shutdown the VM and Copy VMDK,Flat.VMDK and VMX files to KVM machine.

    #scp 10014-1001.vmdk 10014-1001-flat.vmdk 10014-1001.vmx user@KVM Server ip:/var/lib/libvirt/images/

    4. Now we will convert .vmx to .xml and .vmdk to .qcow2. We will use vmware2libvirt to convert .vmx file to .xml .

    Below command to install virt-goodies in your KVM system.

    #apt-get install virt-goodies

    5. Convert 10014-1001.vmx to file.xml

    #vmware2libvirt -f ./10014-1001.vmx > file.xml

    Above command converts the VMware '10014-1001.vmx' file to the libvirt compatible 'file.xml'.

    6. Define xml file

    # virsh -c qemu:///system define file.xml

    Above command imports file.xml into libvirt. The imported .xml files are stored in /etc/libvirt/qemu.


    7. Now we will convert .vmdk file to qcow2 format

    #qemu-img convert 10014-1001-flat.vmdk -O qcow2 new-diskname.qcow2


    Now we have converted .vmx to .xml and .vmdk to .qcow2 file, we need to edit VMNAME, OS Arch & Disk name or source file name in xml file. Please find below is the sample of a xml file. Open the converted xml file and Change VM name as you want, change "type arch" to x86_64, change source file name.

    Below command will open file.xml to edit.

    #virsh edit file.xml

    In the above XML you can see my disk is pointed new-diskname.qcow2 which we have converted to qcow2 format.


    Note:While vmware2libvirt works well on simple virtual machines, there are limitations because .vmx files don't always contain enough information, and also because vmware2libvirt tries not to make too many assumptions about what it finds. A couple of things to look out for: While vmware2libvirt attempts to detect a 64-bit guest, be sure that your 64-bit guest has in its .xml file:


    hvm


    vmware2libvirt only detects and uses the first ethernet interface found. Additional interfaces can be added from within virt-manager.

    Currently the first scsi disk is used if found, otherwise the first ide disk. Additional disks can be added from within virt-manager.

    The converted virtual machine is hard-coded to use 1 cpu. This can be changed with:

    2


    8. Define the xml file and start the VM.

    #virsh -c qemu:///system define file.xml

    #virsh start vmname

    Above command imports file.xml into libvirt. The imported .xml files are stored in /etc/libvirt/qemu.Next command will start VM.

    How to see log files in linux

    tail -f vmware.log -----Output data as the file grows,by default shows last 10 lines
    tail -n 15 vmware.log--------Print last N lines instead of last 10

    how to see OS kernel & hardware & os bit


    uname -a

    how to see linux os name

    head -n1 /etc/issue

    how to Register a VM from CLI

    vim-cmd solo/registervm /vmfs/volumes/datastore1/WinXP/WinXP.vmx

    How to check a service is running or not

    ps -ef | grep nfs(service name)

    how to change network card in vm

    before add this line delete old netadapter from vmx file

    ethernet0.virtualDev = "vmxnet"
    ethernet0.features = "15"

    Copy files from one hypervisor to another hypervisor

    scp source filename destinatin path
    Ex:scp /home/learnadmin/pr.vmx root@192.168.1.61:/home/learnadmin2/la2
    then it will ask destination's root password

    Clone VM from console command

    vmkfs -i 10008_28d0.vmdk /vnfs/volumes/datastore1/10008_29d0.vmdk

    Copying files betweent two remote meachines , different ssh consoles, using SCP command

    scp filename targetssh username@ipadd:target path


    ex: scp 2003.iso root@192.168.1.61:/vmfs/volums/datastore1/iso

    Set java path on Ubuntu meachine

    open Vi /etc/bash.bashrc


    and then append the following lines


    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    export PATH=$PATH:$JAVA_HOME/bin