Having
recently worked on ProActive Cloudstack integration, I would like to
share some challenges I faced and some tools that helped me. We present you a short video showing dynamic nodes deployment on a Cloudstack infrastructure.
Cloudstack is
an open source cloud platform to build public, private or hybrid clouds. It offers a VirtualBox image, called DevCloud, that allows running a (virtual) cloud on a local machine without requiring a physical
infrastructure. It basically consists of a Xen host virtual machine that
will spawn Xen virtual machines as you create Cloudstack instances.
During
the integration of Cloudstack with ProActive one of the challenges was
to build a template allowing us to spawn instances that run as ProActive
nodes. Consequently you are able to create elastic ProActive NodeSources
that can grow more compute resources required. DevCloud comes with
a lightweight ttyLinux template that is well suited to run several
Cloudstack instances on your development machine. As ProActive
requires only Java to run, I just needed to install it, unpack ProActive
installation and create a boot script that would launch the ProActive
node.
Being
familiar with Debian based distribution, I first tried to create a
template from an ISO image but then moved back on using the ttyLinux
template as I hit issues regarding virtualization. It seems quite hard
to create a new template using an ISO image on a paravirtualized Xen
server. The ttyLinux template image comes with a disk of 50 MB only, so
the JRE itself would not fit on it. The image is using VHD format and it
seems quite hard to find useful information on the internet on how to
work with. Here is how I managed to resize, mount and edit
the image:
- All operations were performed on the DevCloud virtual machine as it has all the required tools installed.
- You can download the ttyLinux image from the Cloudstack web interface
- First, we start by expanding the VHD image
- vhd-util resize -n ttyLinux.vhd -s 500 -j log.log
- size is in MB
- Now we need to expand the partition size otherwise the ttyLinux running with this template will not see the extra space
- It can be done by attaching the VHD image as a device with blktap
device=$(tap-ctl allocate)
deviceid=${device#/dev/xen/blktap-2/tapdev}
spawn=$(tap-ctl spawn)
pid=${spawn#tapdisk spawned with pid }
tap-ctl attach -p $pid -m $deviceid
tap-ctl open -p $pid -m $deviceid -a vhd:ABSOLUTE_PATH_TO_VHD_IMAGE
- A new device has been created under /dev/xen/blktap-2/, called tapdev (followed by the device id, let’s assume tapdev4), to check if it exists we can use fdisk
- fdisk -l /dev/xen/blktap-2/tapdev$deviceid
- resize2fs can now be used to resize the partition
- resize2fs /dev/xen/blktap-2/tapdev4 1G
- here we expand the partition to 1 gigabytes
- a filesystem check might be required (fsck), it is ok to run it
- Next are the commands to destroy the device properly
- $pid and $deviceid are the values use when creating the device
tap-ctl close -m $deviceid -p $pid
tap-ctl detach -m $deviceid -p $pid
tap-ctl free -m $deviceid
Since the VHD image is present as a device, we can mount it and directly edit files on it.
- To mount the device
- mount /dev/xen/blktap-2/tapdev4 mounted_image/
- For my needs, I copied Java and ProActive and created a boot script that runs a ProActive node
- To un mount the device
- umount mounted_image/
Installing
the template in Cloudstack is just a matter of uploading the image file
using the web client. As it requires downloading a file from a HTTP
URL, "python -m SimpleHTTPServer 80" comes handy to expose local files on port 80.
We have now a custom made VHD image ready to use with Cloudstack!
Sources:
Sources:
No comments:
Post a Comment