Monday, 16 March 2015

Cloudstack-baremetal-basiczone Configuration guide

In this blog  will talk about   basic per-requisite setup details  and how to configure them.
How cloud stack will communicate   with Bare metal instances.

This blog  talks about cloudstack with basic network mode.

Things required to configure bare-metal host in CloudStack :

1. External PXe server ,DHCP
2. Host with IPMI capability(i.e bare-metal host)
3. Enable the PXE boot  on bare-metal host
4. Setup NFS File server

First preapre pxe server and dhcp
*************************
1. choose a host or vm  with centos
2. perform yum update to make sure your OS has latest updates
3. Install tftp-server :
          yum install tftp-server [it will install dependent package xinetd as well]
4. vi /etc/xinetd.d/tftp and change disable to 'no'
      
   disable = no
 
5. restart the service

   service xinetd restart
6. Once  you install tftp server,it creates a folder in the /var/lib/tftpboot [this is your root folder for pxe]
7.Next install syslinux

yum install syslinux
 
8.Copy needed files from syslinux to the tftpboot directory
 
cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /usr/lib/syslinux/menu.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/memdisk /var/lib/tftpboot/
cp /usr/lib/syslinux/mboot.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/chain.c32 /var/lib/tftpboot/
 
9.Create the directory for your PXE menus 
 
mkdir /var/lib//tftpboot/pxelinux.cfg  

10. Create a base directory for images. Create directories for each centOS release you are supporting.
eg: will create for centos6.2
 
mkdir -p /var/lib/tftpboot/images/centos/x86_64/6.2
 

 
11. install cobbler  for generating kickstart file:
 
 
(please refer below links to install cob)
 http://www.cobblerd.org/manuals/2.4.0/3/2_-_Installing_From_Packages.html more information) 
 
 ---
    a) yum install cobbler -- will install the cobbler
    b)yum update --enablerepo=epel-testing cobbler  -- will update the installed cobbler 
with latest updates.
    c) service cobblerd start.
    d) chkconfig cobblerd on
    e) And (re)start/enable Apache:
        $ service httpd start
        $ service cobblerd on
 
 
12. Download the centos image on your local image or mount to nfs shared path
  
   [local]
    mount -o loop CentOS-6.4-x86_64-bin-DVD-Latest.iso /mnt/centos64/
   [nfs]
    mount -o loop localhost:/export/CentOS-6.4-x86_64-bin-DVD-Latest.iso    /mnt/centos64/
 
13.Then Import the image using cobbler.
 
#cobbler import --path=/mnt/centos64 -name=Centos64 --arch=x86_64.
 
It will generate distribution and profile
 
it will prepare the kick start file and places in the below location:
/var/lib/cobbler/kickstarts/Centos-6.4-x86_64
 

Installing the DHCP:
 
Cloudstack recommends dhcp server should be installed on the separate machine.
so on your production environment follow the cloudstack recommendation i.e install 
PXE one vm/host and dhcp server on another VM/host.
 
But if you are trying on your test setup and lack of resources  then you can 
install both on same VM/host.

 
 
 
 
step 2) 

-Once you are ready with PXE and dhcp server  then check your designated
 bare-metal host has IPMI capabilities or not.also its in right condition or not.
 
 make sure IMPI on bare-metal host is enabled and interface is reachable before 
adding your bare-metal host into cloud-stack,


How do I check whether my host has IPMI capabilities:

1) first check  your hardware vendor(manufacturer's)  documentation.
2. if host has IPMI card  and already an IP assigned to it then check 
the connectivity by issuing a IPMI command from your console or 
laptop[make sure you have installed ipmitool in your client machine].

****************
#ipmitool -H 10.220.3.46 -U root -P password power status

Chassis Power is on
****************** 
 
 Here 10.220.3.46 is  your Host's IPMI IP and its interface is up and running.
 
if IP is not assigned to Hosts' IPMI interface then refer the 
 manufacturers documentation  to assign IP manually.

 
 
The bare metal host needs to use PXE to boot over the network. Access the 
BIOS setup screen (or equivalent for your hardware) and do the following:
  • Ø  Set hard disk as the first priority device in the boot order.
    Ø  Make sure the connected NIC on the bare metal machine is PXE-enabled.

     
      
    Installing the NFS for storing the Images:

    in case of CentOS :

    1.yum install nfs* -y
    2.Start the NFS service
    # service rpcbind start
    # chkconfig rpcbind on
    # service nfs start
    # chkconfig nfs on
    3. create a shared folder
     #mkdir /var/lib/tftpboot/images
     chmod 755 /var/lib/tftpboot/images

    5.export the shared folder by adding entry in /etc/export file like below:

    #cat /etc/exports
    /var/lib/tftpboot/images  *(rw,async,no_root_squash)
    6. export the exports directory
     #exportfs -a

    7.Edit the /etc/sysconfig/nfs file and uncomment the following lines.
    LOCKD_TCPPORT=32803
    LOCKD_UDPPORT=32769
    MOUNTD_PORT=892
    RQUOTAD_PORT=875
    STATD_PORT=662
    STATD_OUTGOING_PORT=2020.
    8. 



    9. Once you save the iptables  then restart the service:
        #service iptables restart


    ## Once you have prepared dhcp,pxe and nfs manually then refer cloud platform/cloud stack documentation  for how to configure and setup in cloud stack.