Image management in Eucalyptus

Managing images in Eucalyptus is generally done by Euca2ools distributed by Eucalyptus team.

All users may upload and register images (depending on access granted to them by the Eucalyptus administrator), but only the admin user may ever upload/register kernels or ramdisks.

Now source the ‘eucarc’ from you ~/.euca directory if you haven’t.

Registering kernel image Execute the following commands to bundle and register the kernel image (vmlinuz-2.6.35-22-server)

shaon@client:~$ euca-bundle-image -i vmlinuz-2.6.32-28-generic --kernel true
shoan@client:~$ euca-upload-bundle -b mybucket -m /tmp/vmlinuz-2.6.32-28-generic.manifest.xml
shaon@client:~$ euca-register mybucket/vmlinuz-2.6.32-28 generic.manifest.xml

Save the output produced by the last command above (eki-XXXXXXXX), which will be needed while registering the disk image.

Registering ramdisk image Execute the following commands to bundle and register the ramdisk image (initrd.img-2.6.35-22-server)

shaon@client:~$ euca-bundle-image -i initrd.img-2.6.32-28-generic --ramdisk true
shaon@client:~$ euca-upload-bundle -b mybucket -m /tmp/initrd.img-2.6.32-28-generic.manifest.xml
shaon@client:~$ euca−register mybucket/initrd.img−2.6.35−22−server.manifest.xml

Save the output produced by the last command above (eri-XXXXXXXX), which will be needed while registering the disk image.

Registering disk image Execute the following commands to bundle and register the ramdisk image ( imagefinal .img)

shaon@client:~$ euca-bundle-image -i imagefinal.img --kernel eki-XXXXXXXX --ramdisk eri-XXXXXXXX
shaon@client:~$ euca-upload-bundle -b mybucket -m /tmp/imagefinal.img.manifest.xml
shaon@client:~$ euca-register mybucket/imagefinal.img.manifest.xml

Replace eki-XXXXXXXX and eri-XXXXXXXX with the exact values you have saved earlier.

To see the the uploaded images

shaon@client:~$ euca-describe-images
IMAGE    eki-7A8D1340    mybucket/vmlinuz-2.6.32-28-generic.manifest.xml    admin    available    public   	 x86_64kernel              instance-store
IMAGE    eri-B603142C    mybucket/initrd.img-2.6.32-28-generic.manifest.xml    admin    available    public   	 x86_64    ramdisk              instance-store
IMAGE    emi-CF6C10B0    mybucket/imagefinal.img.manifest.xml    admin    available    public   	 x86_64    machine    eki-7A8D1340    eri-B603142C    instance-store

Running a custom image

Add a new key-pair to run a new instance with the key.

shaon@client:~$ cd ~/.euca/
shaon@client:~/.euca$ euca-add-keypair jssecacerts > jssecacerts.priv
shaon@client:~/.euca$ chmod 600 jssecacerts.priv
shaon@client:~/.euca$ euca-describe-keypairs

Now run instance with the following command

shaon@client:~/.euca$ euca-run-instances emi-CF6C10B0 -k jssecacerts -t c1.medium

Instance Security

# Check group detail
shaon@client:~/.euca$ euca-describe-groups

# Add new group
shaon@client:~/.euca$ euca-add-group -d "Web Servers" webservers

# Add tcp and icmp permission to the webservers group
shaon@client:~/.euca$ euca-authorize -P tcp -s 0.0.0.0/0 webservers
shaon@client:~/.euca$ euca-authorize -P icmp -s 0.0.0.0/0 webservers
shaon@client:~/.euca$ euca-authorize -P tcp -s 0.0.0.0/0 default
shaon@client:~/.euca$ euca-authorize -P icmp -s 0.0.0.0/0 default
shaon@client:~/.euca$ euca-authorize -P tcp -p 80 default

Tadaa!!

About these ads

16 responses to “Image management in Eucalyptus

  1. Hi,

    I followed you instruction an succesfully uploaded the image, the kernel and the ramdisk on my Eucalyptus Cloud. Only when I try to start an instance with the new image it stays for some time in “pending” mode and then terminates.

    Is there a place where I can debug and see what is gonging wrong?

    Bye,
    martin

  2. which networking mode are you using? are you getting any associated IP for the instance? check the log files, it tells you what exactly is going on.

    • I use STATIC, since the others are not supported. Yes the instance get an IP assigned but stays in “pending”.

      Which log files? Since in the Eucalyptus log files (/var/log/eucalyptus) I can’t see much.

  3. well, there should be nc.log in the NC. long pending state usually means, difficulties in talking with the walrus. you may also try the libvirt log.
    and for everything, log in as root.

  4. Ok, found error. Stupid me there was not enough disk space. Did not catch that when looking into nc.log the first time. Sorry for bordering.

  5. Hi,

    When I try to run my instance in Eucalyptus, I’m not able to SSH to it or ping it. But when I run an instance of image provided by Eucalyptus, I’m able to SSH and ping the instance. Can you help me out here?

  6. did you remove the 70-persistent-net.rules? that might create problem with networking

  7. Yes removing 70-persistent-net.rules worked. Thanks.

  8. Felipe Gutierrez

    can you access the instance that you just created? I mean “ssh -i key root@your-ip-address”

  9. Felipe Gutierrez

    Hi Shaon,

    Did you already install Eucalyptus with Xen as Hypervisor? I got everything with KVM, but with Xen my instances don’t get IP. https://engage.eucalyptus.com/customer/en/portal/questions/752553-xen-doesn-t-get-ip-address?new=752553
    If you have some clue, please share to me.

    Thanks, Felipe

  10. hi shaon
    its a great blog abt creating a custom vm after a long time am seeing my vm getting ip but still i had a problem am using SYSTEM mode in eucalyptus so i have to get ip from dhcp server and am getting so . i started a vm and i got 192.168.3.5 where 192.168.3.0 is my network . but am not able to ssh my instance
    i tried
    ssh -i test.private user@192.168.3.5
    ssh user@192.168.3.5
    ssh -i test.private ubuntu@192.168.3.5
    iam getting ssh :connection to host 192.168.3.2 port 22 connection refused
    since am using system mode there is no need of instance security right ??

    • Sorry for late reply. Can you please check the console log if the instance has been booted properly? Also, another good way of debugging instance would be installing VNC server on your NC and check the VMs.

  11. Gaurav Sadhwani

    hi,
    I followed your instruction regarding image upload in eucalyptus cloud and succesfully uploaded the image, the kernel and the ramdisk on my Eucalyptus Cloud. But when I try to start an instance with the new image it stays for some time in “pending” mode and then terminates. I have checked the nc.log file and here its output:

    2014-03-12 11:50:44 INFO | downloaded 99.8% of http://11.11.3.220:8773/services/Walrus/image-bucket-LB2/LB2.img.manifest.xml
    2014-03-12 11:50:45 INFO | downloaded /var/lib/eucalyptus/instances/cache/emi-F7213CC8-8480fe74/blocks
    2014-03-12 11:50:45 INFO | [i-EE203EF8] copying/cloning blob emi-F7213CC8-8480fe74 to blob HJXXSZMDZURRVNAN3IG3D/i-EE203EF8/emi-F7213CC8-8442c6d3
    2014-03-12 11:50:46 INFO | [i-EE203EF8] tuning root file system on disk 0 partition 1
    2014-03-12 11:50:46 ERROR | bad return code from cmd ‘//usr/lib/eucalyptus/euca_rootwrap /sbin/tune2fs /dev/mapper/euca-HJXXSZMDZURRVNAN3IG3D-i-EE203EF8-emi-F7213CC8-8442c6d3 -c 0 -i 0 2>&1′
    2014-03-12 11:50:46 ERROR | cannot tune file system on ‘/dev/mapper/euca-HJXXSZMDZURRVNAN3IG3D-i-EE203EF8-emi-F7213CC8-8442c6d3′
    2014-03-12 11:50:46 WARN | [i-EE203EF8] failed to tune root file system: blobstore.c:4499 file access only supported for uncloned blockblobs
    2014-03-12 11:50:46 INFO | [i-EE203EF8] injecting the ssh key
    2014-03-12 11:50:46 ERROR | bad return code from cmd ‘//usr/lib/eucalyptus/euca_rootwrap //usr/lib/eucalyptus/euca_mountwrap mount /dev/mapper/euca-HJXXSZMDZURRVNAN3IG3D-i-EE203EF8-emi-F7213CC8-8442c6d3 /tmp/euca-mount-VxRFSg 2>&1′
    2014-03-12 11:50:46 ERROR | cannot mount device ‘/dev/mapper/euca-HJXXSZMDZURRVNAN3IG3D-i-EE203EF8-emi-F7213CC8-8442c6d3′ on ‘/tmp/euca-mount-VxRFSg’
    2014-03-12 11:50:46 ERROR | [i-EE203EF8] failed to mount ‘/dev/mapper/euca-HJXXSZMDZURRVNAN3IG3D-i-EE203EF8-emi-F7213CC8-8442c6d3′ on ‘/tmp/euca-mount-VxRFSg’
    2014-03-12 11:50:46 ERROR | [i-EE203EF8] failed to create artifact emi-F7213CC8-8442c6d3 (error=1, may retry) on try 1
    2014-03-12 11:50:46 ERROR | [i-EE203EF8] failed to provision dependency emi-F7213CC8-8442c6d3 for artifact dsk-F7213CC8-d2432afe (error=1) on try 1
    2014-03-12 11:50:46 ERROR | [i-EE203EF8] failed to provision dependency dsk-F7213CC8-d2432afe for artifact i-EE203EF8 (error=1) on try 1
    2014-03-12 11:50:46 ERROR | [i-EE203EF8] failed to implement backing for instance
    2014-03-12 11:50:46 ERROR | [i-EE203EF8] failed to prepare images for instance (error=1)
    2014-03-12 11:50:50 WARN | libvirt: Domain not found: no domain with matching name ‘i-EE203EF8′ (code=42)
    2014-03-12 11:50:50 INFO | [i-EE203EF8] cleaning up state for instance
    2014-03-12 11:50:50 INFO | [i-EE203EF8] stopping the network (vlan=26)
    2014-03-12 11:51:06 ERROR | [i-EE203EF8] failed to write instance XML to /var/lib/eucalyptus/instances/work/HJXXSZMDZURRVNAN3IG3D/i-EE203EF8/instance.xml
    2014-03-12 11:53:51 INFO | [i-EE203EF8] forgetting about instance

    I cannot figure whats preventing instance from running. Please can you help whats going wrong in this?

    • Hello,

      What version of Eucalyptus are you using? And can you also give some more info about the image? Can you run other images (may be already cached images?) on this cloud? Is is happening only for instance-store images or any image?

  12. Gaurav Sadhwani

    hi,
    Eucalyptus version is 3.3 and image i m trying to upload is Ubuntu 10.04LTS. Its disk size is 8GB, also i have tried with 4GB. Yes i m able to run images downloaded from eustore but problem is with custom images

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s