Bundling an OpenStack image from a running Instance at administration level.


Sometimes we would need an image directly bundled from a running instance. In that case we can use the following steps to bundle an image.

Find the ID of the instance using the command:

euca-describe-instances

The output will be like


RESERVATION r-0lx3wbp5 18805ef3acf14b5d82e11e552b92d213 default
INSTANCE i-00000009 ami-00000009 10.0.0.227 test running None (18805ef3acf14b5d82e11e552b92d213, openstack) 0 m1.tiny 2012-08-24T06:14:43.000Z nova monitoring-disabled 10.0.0.227 192.168.4.36 instance-store

The instance ID is will be in the format i-00000xxx. Make a note of the instance ID.

We need to find the image file relevant to the running instance now. For example if the instance id is  i-00000009 then the relevant image file will be present in the folder /var/lib/nova/instances/instance-00000009

Copy the image file to present folder


cp /var/lib/nova/instances/instance-00000009/disk .

Now convert the file to relevant format


kvm-img convert -O qcow2 disk disk.img

Upload the image to glance


glance add name="Image-from-instance" is_public=true container_format=ovf disk_format=qcow2 <disk.img

Instances can now be started from this image.

Advertisements

One thought on “Bundling an OpenStack image from a running Instance at administration level.

  1. I was able to follow these steps using the updated qemu-img tool. I did have to add the -f flag to the command line:

    qemu -img convert -f raw -O qcow2 disk disk.img

    Would also recommend placing disk and disk.img on separate hard drives if your image(s) are large.

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