3

I'm creating an image from a running instance in OpenStack

nova image-create <server-name>

and i'm just wondering,can this image be uploaded to ec2? Or do i need to create an ami from it?

Can someone guide me on how to go about this?

Pavan
  • 658
  • 2
  • 7
  • 28

1 Answers1

1

glance, the openstack image service is capable of storing a number of image types:

Raw
Machine (kernel/ramdisk outside of image, a.k.a. AMI)
VHD (Hyper-V)
VDI (VirtualBox)
qcow2 (Qemu/KVM)
VMDK (VMWare)
OVF (VMWare, others)

Ref: http://www.openstack.org/projects/image-service/

So basically. You can upload AMIs to openstack directly.

Example:

KERNEL_ID=`glance image-create --name="tty-linux-kernel" --disk-format=aki --container-format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz | awk '/ id / { print $4 }'`
INITRD_ID=`glance image-create --name="tty-linux-ramdisk" --disk-format=ari --container-format=ari < ttylinux-uec-amd64-12.1_2.6.35-22_1-loader | awk '/ id / { print $4 }'`
glance image-create --name="tty-linux" --disk-format=ami --container-format=ami --property kernel_id=${KERNEL_ID} --property ramdisk_id=${INITRD_ID} < ttylinux-uec-amd64-12.1_2.6.35-22_1.img

When performing an image-create against a running instance

Images can only be created from running instances if Compute is configured to use qcow2 > images, which is the default setting. You can explicitly enable the use of qcow2 images > by adding the following line to nova.conf:

But assuming you are configured as such, yes it will output in AMI format.

Ref:

http://docs.openstack.org/trunk/openstack-compute/admin/content/creating-images-from-running-instances.html

Matt Joyce
  • 2,010
  • 2
  • 20
  • 31
  • So, its not possible to convert an image to an AMI making it runnable in EC2? – Pavan Mar 17 '13 at 03:17
  • 1
    openstack does not have any integrated functionality for image conversion. so if the image is not a qcow to begin with it cannot be converted to an ami. if the image IS a qcow it will be snapshotted as an AMI compatible image. – Matt Joyce Mar 17 '13 at 06:47
  • 1
    but the images being stored in /opt/stack/data/glance/images are qemu qcow image. So this can be used in ec2 for launching instances by converting this to an AMI? – Pavan Mar 17 '13 at 20:39