Friday, July 29, 2011

Implementing Cloud Computing on your average Desktop PC (Part 3/3)

Bundling an image
Under the Cloud Controller webpage’s Extras tab, there are some “ready-made” packages available for downloading:


Referencing the instructions on Eucalyptus Image Management, link:
There are basically three steps to bundle an image:
1. Add a root disk image
2. Add a kernel/ramdisk pair to Walrus
3. Register the uploaded data with Eucalyptus.


Having extracted the “ready-made” packages into my home directory, /home/jonathonl/ubuntu9.04-bucket/euca-ubuntu-9.04-i386/kvm-kernel, I carried out the following steps:
[Kernel]
euca-bundle-image -i ubuntu.9-04.x86.img --kernel true
euca-upload-bundle -b kvm-kernel/ -m /tmp/ubuntu.9-04.x86.img.manifest.xml
euca-register kvm-kernel/ubuntu.9-04.x86.img.manifest.xml
[VM]
euca-bundle-image -i /vmlinuz-2.6.28-11-server
euca-upload-bundle -b kvm-kernel/ -m /tmp/vmlinuz-2.6.28-11-server.manifest.xml
euca-register kvm-kernel/vmlinuz-2.6.28-11-server.manifest.xml
[RAM disk]
euca-upload-bundle -b kvm-kernel/ -m /tmp/initrd.img-2.6.28-11-server.manifest.xml
euca-bundle-image -i kvm-kernel/initrd.img-2.6.28-11-server --ramdisk true
euca-register kvm-kernel/initrd.img-2.6.28-11-server.manifest.xml

The kernel, vm and ram images should be available under the “images” tab:
Hybridfox - Launch Instance
I used Hybridfox to manage and launch an instance. To begin with, Firefox 5.01 does NOT work with Elasticfox(installation error). However, Firefox works well with Hybridfox (v1.7b89). This link has all the instructions for setting up Hybridfox to communicate with your cloud systems.
During the setup, a KeyPair will be created. Be sure to save this key somewhere handy as it will be used for SSH into the instance later.
The following settings were used to launch an instance:



With my setup, I am also using the Cloud Controller as a jump host to access the instance running on Node Controller. The Keypair file mentioned earlier is used as follows to allow for a password-less SSH login:
root@ubuntu-CloudController:~# ssh -i /home/jonathonl/keypair.pem 192.168.133.1
Linux ubuntu 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC 2009 i686
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
root@ubuntu:~#
So, this concludes the implementation of Cloud Computing, from installation to running an instance.

Implementing Cloud Computing on your average Desktop PC (Part 2/3)

After OS installation - on Integration and Troubleshooting
After the OS is installed on both Cloud Controller and Node Controller systems, the Cloud Controller’s web interface should be accessible through https://:8443 using the default credentials - admin/admin.
While I thought my private cloud was ready to go, it turned I still had to fix and tune a couple of things. The following were the errors I encountered along with their resolutions I gathered along the way:

1. “Store” tab showed “failed to connect to local store proxy” error:
Referencing the link, do a “apt-get install python-image-store-proxy” to resolve the problem.
2. Verify (and fix) the “/etc/eucalyptus/eucalyptus.conf” file
On Cloud Controller, ensure the private and public interfaces are set correctly (in my case, I set them as the two different NICs to avoid some random remote access issues). Furthermore, set NODES=”” to resolve the 0 free/max problem discussed later.
3. Under “Configuration” tab, remember to set the IP address for Cloud Controller, Walrus Host and Cluster Controller, as well as save the VM Types.
With my setup, I set the system’s public IP address to be Cloud Host, Walrus Host; whereas for the Cluster Controller I used private address. Also, I saved the default VM Types.
4. Credentials.zip
4.1 “eucarc” script gives “No Route to Host” error
“eucarc” script is a part of credentials.zip file, which is to be extracted into ~/.euca/ directory on the Cloud Controller.
After Walrus, Cluster Controller and VM Types registration, download credentials onto Cloud Controller (as Cloud Client) and run the "eucarc" script.
The “eucarc” script may give a "No Route to Host" error, this link suggested restarting the Cloud Controller to resolve this issue (and I can confirm it works).

4.2 “EC2_ACCESS_KEY environment variable must be set”
While issue “euca_describe-availability-zones verbose” command (euca2ools), it gives an error as follows:
root@ubuntu-CloudController:~# euca-describe-availability-zones
EC2_ACCESS_KEY environment variable must be set.
Connection failed
The way I resolved this was to download the credentials again, and re-run the “eucarc” script. Furthermore, in /root/.bashrc, add the line to avoid downloading the credentials every time the cloud controller restarts.
[ -r ~/.euca/eucarc ] && . ~/.euca/eucarc
(I read this on one of the forums but forgot to capture the link)
4.3 Node Controller (?) Without fully understand the purpose of the "eucarc" script, I also scp and ran it on the Node Controller having encountered the 0 free/max cpu issue the second time.
5. “euca-describe-availability-zones verbose” should describe the environment (resources availabile on the Node Controller for running an instance). If the “free/max” fields are both 0, then something has not been registered properly.
By removing "NODES" config under eucalyptus.conf, and then deregister BOTH clusters and Node, and then register the cluster and then node again, it solved the 000 free/max CPU problem, referencing this link.
root@ubuntu-CloudController:~/.euca# euca_conf --deregister-nodes 192.168.20.2
SUCCESS: removed node '192.168.20.2' from '//etc/eucalyptus/eucalyptus.local.conf'
root@ubuntu-CloudController:~/.euca# euca_conf --list-clusters
registered clusters:
HomeCluster 192.168.10.153
root@ubuntu-CloudController:~/.euca# euca_conf --deregister-cluster HomeCluster
SUCCESS: cluster 'HomeCluster' successfully deregistered.
root@ubuntu-CloudController:~/.euca# euca_conf --register-cluster HomeCluster 192.168.20.1
Trying rsync to sync keys with "192.168.20.1"...The authenticity of host '192.168.20.1 (192.168.20.1)' can't be established.
ECDSA key fingerprint is 2a:29:27:ce:a1:03:a9:5e:c1:e3:52:9e:62:89:de:23.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.20.1' (ECDSA) to the list of known hosts.
done.
SUCCESS: new cluster 'HomeCluster' on host '192.168.20.1' successfully registered.
root@ubuntu-CloudController:~/.euca# euca_conf --list-clusters
registered clusters:
HomeCluster 192.168.20.1
root@ubuntu-CloudController:~/.euca# euca_conf --register-nodes 192.168.20.2
INFO: We expect all nodes to have eucalyptus installed in //var/lib/eucalyptus/keys for key synchronization.
Trying rsync to sync keys with "192.168.20.2"...done.
root@ubuntu-CloudController:~/.euca# euca_conf --list-nodes
registered nodes:
192.168.20.2 HomeCluster
root@ubuntu-CloudController:~/.euca# euca-describe-availability-zones
AVAILABILITYZONE HomeCluster 192.168.20.1
root@ubuntu-CloudController:~/.euca# euca-describe-availability-zones verbose
AVAILABILITYZONE HomeCluster 192.168.20.1
AVAILABILITYZONE |- vm types free / max cpu ram disk
AVAILABILITYZONE |- m1.small 0002 / 0002 1 192 2
AVAILABILITYZONE |- c1.medium 0002 / 0002 1 256 5
AVAILABILITYZONE |- m1.large 0001 / 0001 2 512 10
AVAILABILITYZONE |- m1.xlarge 0001 / 0001 2 1024 20
AVAILABILITYZONE |- c1.xlarge 0000 / 0000 4 2048 20

6. Configure bridge on CloudController in response to WARN message in /var/log/eucalyptus/cc.log, referencing recommendations from this link.

Congratulations if you have reached this far into this post. At this stage, you should have a working cloud platform, allowing you to search and install images from "Store" tab.
The next blog will be about Hybridfox interface, launching an instance and accessing it through ssh.

Implementing Cloud Computing on your average Desktop PC (Part 1/3)

Why Eucalyptus? Because it is also used by Amazon’sEC2 cloud platform. Even better, Eucalyptus comes with Ubuntu Server edition 11.04.


I began by reading Eucalyptus beginner’s guide, which contains all the installation procedure and configuration items, as well as a high-level reference diagram showing all of the private cloud's components (please read the guide in case if this diagram is not clear due to low resolution):
While I do not intend to go through every step in the beginner's guide, the definition of an "instance" is worth paying attention to (since this is what I aimed at running eventually), "The VMs running on the hypervisor and controlled by UEC are called instances."As you may notice, the private cloud implementation is across two desktop PCs:

Although there is an option of installing the entire private cloud on a single computer, I decided to use my old PC as a dedicated Cloud Controller.
My old PC's CPU does not support Intel’s Virtual Hardware Acceleration (VT) technology but it has a hard-drive of 1.5TB (ample storage space). For the Node Controllers, I purchased a second hand PC from EBay for $190, which is only strong enough to run Windows XP but its CPU supports VT and also upgraded it to 4GB of ram in total.
Installation Notes
The actual OS installation was rather straight forward. I inserted Ubuntu’s installation CD and followed the screen instructions. As a note, it would be a good idea to be connected to the internet to do apt-get update as well as sync up the time with NTP.
Node Controller
Prior to installation, consider the Node Controller is the only component which CPU is required to support hardware virtualization. To identify the CPU model, either check in BIOS or check the /proc/cpuinfo file (if Linux is already installed):
root@ubuntu-NodeController:/var/log# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
model name : Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz
address sizes : 36 bits physical, 48 bits virtual
Cross check with this Intel's link to confirm if the process supports VT technology.
Virtual Hardware Acceleration (VT) technology needs to be enabled through BIOS settings (in my case, it was enabling the "Hardware Virtualization" cpu setting). Otherwise, Eucalyptus complaints about BIOS stopping KVM from starting in the following syslog messages:
root@ubuntu-NodeController:/var/log# cat syslog | grep -i kvm
Jul 21 20:39:29 ubuntu-NodeController kernel: [ 27.885070] kvm:disable TXT in the BIOS or activate TXT before enabling KVM
Jul 21 20:39:29 ubuntu-NodeController kernel: [ 27.885074] kvm: disabled by bios
Jul 21 20:39:29 ubuntu-NodeController init: qemu-kvm pre-start process (1086) terminated with status 1
Another thing worth nothing about Node Controller is, the "eth1" interface should be part of the bridge interface, which, as its named, bridges the physical port to a virtual/ internal interface on the instance.
Cloud Controller
As you may note in the diagram above, the Cloud Controller has two NIC cards installed. One for internet access (public), the other for cloud access (private). I attempted setting up both Private and Public interfaces on the same Ethernet port, but remote access worked intermediately (...I doubt does single port setup works).
Herewith the /etc/network/interfaces file for reference:
root@ubuntu-CloudController:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The internet interface
auto eth0
iface eth0 inet static
address 192.168.10.153
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
# The Cloud Computing interface (This was changed to a bridge interface later to resolve an error message)
auto eth1
iface eth1 inet static
address 192.168.20.1
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.200.255
Also worth mentioning, I have setup my Cloud Controller as client as well, installing the following packages:
apt-get install qemu-kvm
apt-get install euca2ools
P.S. I setup my Cloud Controller as NAT to allow Node Controller to access the internet (Somehow my home’s internet gateway does not allow me to configure static routing so I had to resolve to this work around).
So herewith the list of considerations I came across during installation of Eucalyptus. Part two will contain configuration and troubleshooting items needed to get Eucalyptus up-and-running.