Saturday, August 24, 2013

Creating Application VM Templates for Exalogic X3-2

 It is a well known fact that one of the primary goal for applications virtualization is to provide enterprise users with a consistent and reliable experience through accelerated deployment. For complex enterprise-class applications like Oracle SOA Suite (or IdM/any other business software), virtualization facilitates rapid provisioning and delivery of optimized application configuration to meet security, high availability and performance standards.

Exalogic Elastic Cloud X3-2 is Oracle' flagship engineered system for running business applications in a highly performant environment. The Exalogic X3-2 software includes a optimized Exabus­ enabled Type I Xen hypervisor i.e. Oracle VM Server, which allows to host virtual servers running Oracle Linux. In this post, I will share my experience creating an application template for deploying on Exalogic.

The application template creation procedure for Exalogic can be split into 2 broad categories:

  1. Preparing the Oracle VM Server environment
  2. Creating the application VM template

Note that access to an Exalogic instance is not required for the purpose of creating the application templates.You will require the following software though; download from eDelivery.oracle.com

  • "Oracle Linux JeOS for Building Oracle VM Templates Media Pack v13 for x86_64 (64 bit)"
  • "Oracle Exalogic 2.0.4.0.0 Base Guest Template" for Exalogic Linux x86-64 (64 bit) V35512-01  (requires OVM Server 3.x or later)

First, the steps to configure the Oracle VM Server:

1) Connect to Oracle VM Server 3.x
- it is recommended to use VM Server 3.x installation or later
- ssh username@hostname

2) Configure xend-config.sxp on the OVM Server (OVS) to use bridge networking
- the OVS system must be setup so that we can attach virtual machines to the external network. This is done by creating a virtual switch within dom0 (domain zero i.e. management domain in a OVS env responsible for hardware detection) that takes packets from the virtual machines and forwards them onto the physical network so they can see the internet and other machines on your network. The piece of software we use to do this is called the Linux bridge and its core components reside inside the Linux kernel. In this case the “bridge” is effectively our virtual switch.

# vi /etc/xen/xend-config.sxp
(network-script network-bridge)
(vif-script vif-bridge)

3) Restart OVM Server
# [root@ovmserver BASE]# reboot

4) Configure your OVM Server operating system to use a public Yum repository
- download and install any prerequisite Oracle Enterprise Linux packages not installed on your computer from the public Oracle Yum repository

--- Oracle Linux 4, Update 6 or Newer
# cd /etc/yum.repos.d
# mv Oracle-Base.repo Oracle-Base.repo.disabled
# wget http://public-yum.oracle.com/public-yum-el4.repo

--- Oracle Linux 5
# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-el5.repo

--- Oracle Linux 6
# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-ol6.repo

5) Install the JeOS dependent packages with the following command:
# yum install createrepo

6) Install "Oracle Linux JeOS for Building Oracle VM Templates Media Pack v13 for x86_64 (64 bit)"
     - JeOS is particularly useful and handy when you need to re-size the VM template Root Disk Image
- download the zip files for JeOS base and JeOS base image for required operating system to your OVS system in local directory e.g /u01/JeOS.
        (you will have following rpms in your local directory after uncompressing the zip files)
ovm-modify-jeos-1.1.0-17.el5.noarch.rpm
ovm-template-config-1.1.0-8.el5.noarch.rpm
ovm-el5u8-xvm-jeos-1.1.0-2.el5.x86_64.rpm

- install these rpms

# rpm -ivh ovm-modify-jeos-1.1.0-17.el5.noarch.rpm
# rpm -ivh ovm-template-config-1.1.0-8.el5.noarch.rpm
# rpm -ivh ovm-el5u8-xvm-jeos-1.1.0-2.el5.x86_64.rpm

7) At the end of this step, you will have the base OVM Server environment ready to create the virtual machines (or virtual host servers in Exalogic terminology).

Next, the steps to create the application VM template. Three main phases:

  1. Creating VM using Exalogic Base Guest template  
  2. Installing and configuring the required application software
  3. Preparing the VM template TAR

Phase1

1. From eDelivery.oracle.com download "Oracle Exalogic 2.0.4.0.0 Base Guest Template" for Exalogic Linux x86-64 (64 bit) V35512-01 

2. Extract the Exalogic Guest Template contents to a directory location (say /Exalogic/BASE) on your Oracle VM Server 3.x installation

    # ssh username@ovshostname
     # mkdir -p /Exalogic/BASE
      
    # pwd
   /Exalogic/BASE
   
    BASE]# ls
    System.img  vm.cfg 
    
3. Change the path to the virtual disk in the vm.cfg file, as follows:
        disk = ['file:/OVS/seed_pool/OVM_simple_/System.img,hda,w'] to disk = ['file:/Exalogic/BASE/System.img,hda,w']  

4. In the Exalogic Guest template vm.cfg file, set vif = ['bridge=bond0'], where bond0 is the bridging Ethernet adapter on OVS. It is usually called 'xenbr0'

5. Start the VM with '-c' flag, and press Ctrl+D when it gets to the OVM template configuration stage
# cd /Exalogic/BASE
# xm create vm.cfg -c  
       (alternatively, you can skip the '-c' flag and connect to the VM using the command: xm console <vm-
         domain-Id>)

6. Login as 'root' to the created VM host (lets call it App-VM)
      - the default root password is 'ovsroot'

7. Add the network script ifcfg-eth0 in the App-VM 
- if eth0 already exists, use a different one
      - there are two options, DHCP, and Static IP Address. If you choose to make use of DHCP to automatically assign IP addresses to servers or virtual machines within a network, you must ensure that a DHCP server is set up and available within your VM environment

 # vi /etc/sysconfig/network-scripts/ifcfg-eth0
-----------------------------------------
DEVICE=eth0
            BOOTPROTO=static
            ONBOOT=yes
            IPADDR=10.200.250.300
            NETMASK=255.255.252.0
            GATEWAY=10.200.220.320
            DELAY=0

8. Configure the Network
- Edit the host name in the App-VM /etc/sysconfig/network file
- Edit the host name in /etc/hosts/
- Update /etc/resolv.conf as well

9. Turn off the initial configuration of the OVM template
# vi /etc/sysconfig/ovmd
set INITIAL_CONFIG=no

10. Use ifup to bring eth0 online or reboot VM
# /sbin/ifup eth0

11. Restart the networking service
# /etc/init.d/network restart

Phase2

1. Copy the necessary application software to the App-VM environment created in phase1
- you may need to configure the required JDK as well if your application depends on it. Exalogic guest template OS does not package any Java runtime
2. Install and configure the business applications in the App-VM

Phase3

1. Prepare to create a Template from the running App-VM
- Update ovmd script

# vi /etc/sysconfig/ovmd
Set the "INITIAL_CONFIG" parameter to "yes"
INITIAL_CONFIG=yes

2. Cleanup App-VM host specific OS-network level configuration
- Remove DNS information
    - Remove extraneous SSH information
    - Cleanup network file
# cd /etc/sysconfig
# sed -i '/^GATEWAY/d' network
    - Cleanup hosts file
    - Remove networking information
# cd /etc/sysconfig/network-scripts
# rm -f ifcfg-*eth*
# rm -f ifcfg*ib*
# rm -f ifcfg*bond*
     
# cd /etc/sysconfig/networking/profiles/default
# rm -f ifcfg-*eth*
# rm -f ifcfg*ib*
# rm -f ifcfg*bond*
    - Remove logs
    - Remove kernel messages
# cd /var/log
# rm -f dmesg
# dmesg -c
    - Remove history
# rm -f /root/.bash_history
# history -c

(Note: execute steps 3 through 5 below from the OVM Server host)

3. Shutdown App-VM

# xm list
# xm shutdown <VM_ID>

4. Compact the App-VM template vDisks (optional)

# [root@ovmserver BASE] modifyjeos -f System.img -zero-out-all 

5. Package the vServer with its virtual disk

# tar -pczvf <app_template_name>.tgz <el_base_template_directory>

The TAR VM template <app_template_name>.tgz is now ready to be uploaded/deployed to the Exalogic Elastic Cloud

Hope this helps to get a general idea on what it takes to create application templates on Linux for Exalogic X3-2 system. Feel free to share your experience/comments/tips .

No comments:

Post a Comment