Quick guide to creating a OpenStack bootable image

Usually every time I go to install a VM from scratch I end up having to google around for the exact commands I need… so I figured I’d do a quick post on how to install your own image that’s boot-able via OpenStack.

First acquire an ISO that you want to install. For my image, I’m just using a simple ubuntu-server image.

wget http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso

Create disk image:

qemu-img create -f qcow2 ubuntu-14.04-server.img 30G

Using KVM, launch an instance using the ISO and disk image we just created (we’re launching the instance with 4096Mb of ram and 2 processors – though you can choose different values if you want a larger or smaller instance).

kvm -hda ubuntu-14.04-server.img -cdrom ubuntu-14.04-server-amd64.iso -m 4096 -smp 2

A window should pop out where you can walk through the installation steps:

Screenshot from 2014-06-01 20:12:56

When it’s finished installing you should be able to upload the image to glance:

glance image-create --name ubuntu-14.04-server --disk-format=qcow2 --container-format=bare --is-public=True < ubuntu-14.04-server.img

boot it:

nova boot --image ubuntu-14.04-server --flavor 3 vm1

The first time you boot an image it will probably take a few minutes to boot as it needs to first copy the disk image to the compute node but eventually it will (*hopefully*) go active:

nova list
| ID                                   | Name | Status | Task State | Power State | Networks         |
| f24839a2-6523-438b-a4c3-b46ddba11389 | vm1  | ACTIVE | -          | Running     | private= |

I know there are other tools out there that are probably better for this and Canonical even provides daily boot-able images though this method works fine for me since I rarely have to create a new image. One important thing to note is that in some distro’s you need to delete /etc/udev/rules.d/70-persistent-net.rules (before uploading the image to glance) in order for the nic interface ordering to start at eth0 otherwise it will start at eth1 which might not automatically start a dhcp-client on the interface for you depending on the guest’s configuration.

This entry was posted in openstack. Bookmark the permalink.

3 Responses to Quick guide to creating a OpenStack bootable image

  1. Thanks for finally talking about > Quick guide to creating a OpenStack bootable image |
    Aaron’s Blog < Liked it!

  2. Pingback: OpenStack Community Weekly Newsletter (May 30 – June 6) » The OpenStack Blog

  3. Pingback: Dell Open Source Ecosystem Digest #51 - Dell TechCenter - TechCenter - Dell Community

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>