The robustness of the OpenStack cloud allows you to run almost any operating system that you need on our platform. The only thing you need to do is make sure that it’s configured to pick up an IP address via DHCP when it first boots and everything will be handled for you automatically. This gives you the freedom to use any operating system you need, from custom Linux appliances to FreeBSD and much more!
Prerequisites
For this tutorial, you’ll have to make sure that you have properly configured your OpenStack CLI clients. You will be using the CLI tools to create and upload the new image to the service. In addition, you’ll have to make sure that you have an image that is compatible with the cloud which you are using.
For information purposes, the supported image types on OpenStack clouds powered by KVM (such as our own public cloud) are qcow2 or raw. If your images are using a different format, you can read more online about the qemu-img tool, as it can help you convert formats easily.
Image Upload
The actual upload process is quite straightforward and it involves using the glance CLI client, assuming our image file type is qcow2 and the image file name is image.qcow2, you’ll have to run the following command (with all the environment variables configured and set).
$ glance image-create --name "My Image" --disk-format qcow2 --container-format bare --file image.qcow2 --progress
Once you run that command, you’ll see the upload progress and it will let you know when it’s complete with the new ID of the uploaded image. You can now use that ID to provision servers instantly.
If you were uploading an image which was of raw format, simply change the --disk-format qcow to --disk-format raw. The command line interface is pretty straightforward and very simple to use.
Image Customization
OpenStack has a plethora of customization options for your images. You can configure these via image properties which modify the behavior of how your server is provisioned, they allow you to configure different IO controllers and much more.
In order to set it, all you need is the ID of the image that you’re trying to alter. If you’re following this tutorial, you should have it from the step before.
$ glance image-update image-uuid --property key=value
We’ve provided below a table of commonly used OpenStack image properties which should help you get the perfect environment for your image when it boots up. Please note that the values which are in bold are the defaults for that property.
Property | Allowed Values | Description |
---|---|---|
hw_disk_bus | virtio, scsi, ide, usb | Type of disk controller to attach disk devices |
nic_model | virtio, e1000, rtl8139 | Model of the network interface device |
img_config_drive | optional, mandatory | Specifies whether the image needs a config drive. |
You can get the whole list of image service property keys from the OpenStack CLI reference. However, the ones above are the most commonly needed ones.
Hopefully, you’ll now be able to provision servers of any operating system or your favorite distribution right away. Even better, you can migrate your servers easily by simply uploading an image and uploading it!