Testing

Differences between revisions 1 and 2
Revision 1 as of 2009-08-11 09:13:30
Size: 3035
Editor: 0107ds1-abv
Comment: Added test instructions.
Revision 2 as of 2009-10-15 16:02:25
Size: 3265
Editor: d14-69-66-169
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
rsync -P ec2-images.ubuntu.com::ec2-image/karmic/current/ubuntu-ec2-karmic-amd64.img.gz . rsync -aP uec-images.ubuntu.com::uec-images/karmic/current/karmic-uec-amd64.tar.gz .
Line 12: Line 12:
The first time you do it, it will probably take a while, as the images are around 600 MB. Subsequent rsyncs should be quite a bit faster. The first time you do it, it will probably take a while, as the images are around 180 MB. Subsequent rsyncs should be quite a bit faster.
Line 14: Line 14:
Next, you uncompress the image. It's a 10 GB filesystem, so if you just ungzip it, it'll take up 10 GB of space on your disk. The image is very sparse, so we save a lot of space by uncompressing it like so: Next, you uncompress the image. It's a 2 GB filesystem, so if you just ungzip it, it'll take up 2 GB of space on your disk. The image is very sparse, so we save a lot of space by uncompressing it like so (note '-S' to tar):
Line 16: Line 16:
gunzip -c ubuntu-ec2-karmic-amd64.img.gz | cp --sparse=always /dev/stdin ubuntu-ec2-karmic-amd64.img tar -xSvzf karmic-uec-amd64.tar.gz
Line 23: Line 23:
ec2-init in the images expects to be able to reach the EC2 meta-data service at 169.254.169.254. The simplest way to make this happen is to assign this IP to your host machine. Add something like the following to your '/etc/network/interfaces': ec2-init in the images expects to be able to reach the EC2 meta-data service at 169.254.169.254. The simplest way to make this happen is to assign this IP to your host machine.  You then have 2 options, either a.) disable ec2init on boot, or b.) setup a meta-data service on your system.

=== Disable ec2-init ===
ec2-init can be disabled with a kernel command line argument of {{{ec2init=0}}}

=== Setup Metadata service ===
Add something like the following to your '/etc/network/interfaces':
Line 41: Line 47:
Line 52: Line 59:
    <kernel>/boot/vmlinuz-2.6.28-8-server</kernel>
    <initrd>/boot/initrd.img-2.6.28-8-server</initrd>
    <kernel>/home/soren/uec/karmic-uec-amd64-vmlinuz-virtual</kernel>
    <initrd>/home/soren/uec/karmic-uec-amd64-initrd-virtual</initrd>
Line 65: Line 72:
      <source file='/home/soren/uec/ubuntu-ec2-karmic-amd64.img'/>       <source file='/home/soren/uec/karmic-uec-amd64.img'/>

This page describes how to test UEC images without signing and uploading to eeither EC2 or UEC.

Basic requirements

Grabbing an image to test

You need a UEC image to test. You can for instance rsync the current karmic image like so:

rsync -aP uec-images.ubuntu.com::uec-images/karmic/current/karmic-uec-amd64.tar.gz .

The first time you do it, it will probably take a while, as the images are around 180 MB. Subsequent rsyncs should be quite a bit faster.

Next, you uncompress the image. It's a 2 GB filesystem, so if you just ungzip it, it'll take up 2 GB of space on your disk. The image is very sparse, so we save a lot of space by uncompressing it like so (note '-S' to tar):

tar -xSvzf karmic-uec-amd64.tar.gz

This also takes a while.

Setting up a fake meta-data service

ec2-init in the images expects to be able to reach the EC2 meta-data service at 169.254.169.254. The simplest way to make this happen is to assign this IP to your host machine. You then have 2 options, either a.) disable ec2init on boot, or b.) setup a meta-data service on your system.

Disable ec2-init

ec2-init can be disabled with a kernel command line argument of ec2init=0

Setup Metadata service

Add something like the following to your '/etc/network/interfaces':

iface eth0:0 inet static
     address 169.254.169.254
         netmask 255.255.255.255

and run

sudo ifup eth0:0

You should also have apache installed.

sudo apt-get install apache2

Now, the trick to the metadata service is that it's a simple HTTP interface, so we're just going to emulate it with a bunch of files in our webroot. You can grab http://people.canonical.com/~soren/mock-meta-data.tar.gz and unpack it in your webroot, and you should be ready to roll.

Starting the instance

Next, we add the instance to libvirt. Create a file like this:

<domain type='kvm'>
  <name>uec-amd64-karmic-test</name>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
    <kernel>/home/soren/uec/karmic-uec-amd64-vmlinuz-virtual</kernel>
    <initrd>/home/soren/uec/karmic-uec-amd64-initrd-virtual</initrd>
    <cmdline>root=/dev/sda ro</cmdline>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='/home/soren/uec/karmic-uec-amd64.img'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <interface type='network'>
      <source network='default'/>
      <model type='e1000'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
  </devices>
</domain>

..obviously adjusting the paths according to you local setup. Save it as temp.xml, and run

virsh define temp.xml

And remove the file again. It'll just be confusing to have it lying around.

That should do it, really!

virsh start uec-amd64-karmic-test

should start up an instance and it should boot completely. Yay.

UbuntuCloud/Images/Testing (last edited 2011-08-20 13:28:33 by 204)