Create a Good OpenStack Image

This post will describe how to construct a good OpenStack image. After VM started, cloud-init will overwrite VM’s settings (Network, Service, User and so on), so we can configure our image file for better user experience.

Environment Preparation

We use Ubuntu 16.04 for demo, you can decide use which Linux distribution by yourself. Install following package in your Image build machine.

qemu-utils

virtinst

virt-manager

libguestfs-tools

Create Image disk

Here is my custom create script, take a look or use following command:

1

2

3

4

5

6

7

virt-install--virt-type kvm--name mynewvm--ram1024\

--cdrom=base/xenial.iso\

--disk=mynewdisk.qcow2,format=qcow2\

--network network=default\

--graphics vnc,listen=0.0.0.0--noautoconsole\

--os-type=linux--os-variant=ubuntu16.04

Warning: If your image build machine is Ubuntu 14.04, then os-variant=ubuntu16.04 is not supported, use ubuntu14.04 instead.