Archive for October, 2009

Running Windows on Eucalyptus (Improved)

October 14, 2009

I’ve previously written about running Windows on Eucalyptus here, using a method that involved using parts of the Windows boot chain to create a Eucalyptus ramdisk.  This works well enough, but can be quite time-consuming to set up.

I’ve since come up with a better way, using only open source components, which means I can make it all freely available!  And in addition, there’s a perl script included to create randomised Windows access credentials.  Read on…

Creating the image

As before, you need to create a KVM base image of the Windows variant you’re wanting to install.  I haven’t tried a Xen equivalent, but there’s no reason that it shouldn’t work also.  Vital prerequisites are:

  • The virtual disk of the base image MUST  be configured as SCSI, as this is what Eucalyptus expects.
  • The disk should have a minimum of two partitions: the first contains the operating system installation; the second can be as small as you wish, and is present to instruct Eucalyptus not to try to run Linux disk operations on the image (thanks to EtienneG for this tip; see comments on the previous post).
  • Ensure that Remote Desktop is enabled, or you won’t be able to access the running image
  • If using Eucalyptus 1.6 (perhaps as part of the UEC), you’ll need to install the e1000 network driver to the image.  Instructions for this are here.

Installing the random credential generator

Download the win-euca-blobs tarball from http://launchpad.net/euca-blobs/0.1/win-euca-img-0.1/+download/win-euca-blobs-0.1.tar.gz .  Extract the tarball, and copy the AWS directory to the root of the Windows image C:\ drive (if you wish to put this elesewhere, you’ll need to modify the path in AWS\set-admin-password.bat).

Next, install a perl runtime onto the image (I’ve used the ActiveState one found here, which is free, and seems to work well).

Finally, add AWS\set-admin-password.bat as a startup script for the virtual image, following the instructions found on this page.  You can test the script by adding the following lines to the libvirt xml of your image, in the <devices> section:

<serial type=”file”>
<source path=’/tmp/console.log’/>
<target port=’1’/>
</serial>

On next startup of the VM, something like the following should spit out in /tmp/console.log

** Access Credentials **

Username: administrator
Password: ef11kr4o

I’ve tested the above script on Windows XP, and I’d imagine it should also work just fine on Server 2003 and Windows 2000.  Beyond that, mileage will vary.  And, if anyone more Windows-savvy would like to re-implement the script in .vbs or similar and contribute it, I’ll gladly update the posting!

Create the bundle

Finally, bundle your image using the memdisk and win-grub.img files supplied in the win-euca-blobs tarball, using something like:

mkdir kernel
ec2-bundle-image -i /path-to/memdisk -d ./kernel –kernel true
ec2-upload-bundle -b kernel -m ./kernel/memdisk.manifest.xml
EKI=`ec2-register kernel/memdisk.manifest.xml | awk ‘{print $2}’`
echo $EKI

mkdir ramdisk
ec2-bundle-image -i /path-to/win-grub.img -d ./ramdisk –ramdisk true
ec2-upload-bundle -b ramdisk -m ramdisk/win-grub.img.manifest.xml
ERI=`ec2-register ramdisk/win-boot.img.manifest.xml | awk ‘{print $2}’`
echo $ERI

mkdir image
ec2-bundle-image -i path-to/<windows_disk>.img -d ./image –kernel $EKI –ramdisk $ERI
ec2-upload-bundle -b image -m ./image/<windows_disk>.manifest.xml
EMI=`ec2-register image/<windows_disk>.manifest.xml | awk ‘{print $2}’`
echo $EMI

Launch it!

The image should start in the same way as any other.  To retrieve the login credentials, run ec2-get-console-output (or similar – I’m using eucatools these days).

Elasticfox for Eucalyptus

October 5, 2009

As some of you are aware, the latest (version 1.7) of Elasticfox doesn’t work without pain on Eucalyptus.  This is because of the addition of VPC (Virtual Private Cloud) functionality – and a resulting upgrade to the EC2 API version used – which breaks Eucalyptus compatibility.

Elasticfox 1.6 worked pretty well with Eucalyptus, but is no longer available for direct download any more.  It can be easily built from Subversion, however,  Here’s how:

Checkout revision 107 of Elasticfox

On ubuntu, checkout with the following command:
$ svn co -r 107 https://elasticfox.svn.sourceforge.net/svnroot/elasticfox/trunk elasticfox

This will extract the Elasticfox source from repository into the elasticfox directory.

Configure the build environment

Basically, you just need the java jar command to be available, which is part of the sun Java Development Kit.  On Ubuntu:

$ sudo apt-get install sun-java6-jdk

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

Build Elasticfox

Switch to the elasticfox directory, then execute the make.sh script:

$ cd elasticfox

$ sh ./make.sh

This creates an .xpi package of Elasticfox under the dist directory

Install in Firefox

In Firefox, click to File –> Open File .  Navigate to the elasticfox/dist directory, and select the file elasticfox-1.6.000107.xpi .  Hit Open to install the Elasticfox plugin.

Configuration

This is pretty simple, and will require you to have the Eucalyptus eucarc file somewhere handy.  From the Firefox Tools menu, select Elasticfox.  This will prompt for your EC2 credentials; enter these as follows:

Account Name: value from EC2_USER_ID= in eucarc

AWS Access Key: value from EC2_ACCESS_KEY= in eucarc

AWS Secret Access Key: value from EC2_SECRET_KEY= in eucarc

Now, add your Eucalyptus deployment as a Region.  To do this, click Regions in the top left, then add using the following:

Region Name: you can choose this

Endpoint URL: value from EC2_URL= in eucarc

And you can now control your Eucalyptus instance using Elasticfox!