Create a custom image for OpenStack

Internap offers multiple Glance Images that can be used to deploy Cloud or Baremetal servers. Those images are all kept up-to-date, and are all included within our scope of technical support. However, you may want to use another operating system that is not offered, or use a more customized image to fasten up your deployments. This article will show you how  to create a custom image for OpenStack based on an ISO.

Note:

Some actions in this article will require to have the Openstack command line interface tools installed on your workstation.


Create an image from a standard hypervisor

  • Install the Operating System of your choice in a standard hypervisor from an ISO such as:
      • Virtual Box
      • VMware
      • Hyper-V
      • Xen

    In this example, we used Virtual Box to create a Debian VM from an ISO.
    Capture d’écran 2015-10-22 à 17.35.38

  • Once your VM is ready, install any software/packages you want your custom image to contain (Optional)
  • Next, install Cloud-init which will be responsible for the automation of multiple tasks such as the hostname definition, IP address assignment, user password creation, (…) during the deployment of an AgileCLOUD or Baremetal server.
    • For any of our officially supported OS, you can find the cloud-init package at the following link for all distributions Internap supports: http://packages.mirror.iweb.com/cloud-init/
      • Download the script under the “scripts” folder for your OS in your VM with curl or wget.
      • Run the script which will install the proper cloud-init packages and enable the console redirection.
    • For any other Operating systems, refer to their respective documentation, and remember to enable the console redirection in Grub so that the remote console can work for troubleshooting.

    Capture d’écran 2016-12-20 à 12.21.03

  • On your workstation, install QEMU which will allow you to convert your virtual machine’s hard drive to an OpenStack compatible format

    • MacOS: brew install qemu
    • Ubuntu: apt-get install qemu-kvm libvirt-bin virt-manager
    • CentOS: yum groupinstall “Virtualization” “Virtualization Platform”
    • Windows: https://qemu.weilnetz.de/
  • Convert the virtual machine’s hard drive to the QCOW2 format
    $ qemu-img convert -f <source_format> -O <destination_format> <source_image> <destination_image>
    
    • <source_format> will be the current format of your virtual hard drive (VDI, VHD, …)
    • <destination_format> will be QCOW2
    • <source_image> will be the actual path to your VM’s virtual hard drive
    • <destination_image> will be the final QCOW2 file that will be used by OpenStack
    • Example:
      $ qemu-img convert -f vdi -O qcow2 Openstack_debian.vdi My_debian_image.qcow2
      
  • Upload the QCOW2 image to OpenStack using Glance or Horizon
    • You can upload your image using the command line tool for Glance. Refer to this procedure for more details
    • You can also upload your image using the web interface Horizon. For more information, please read this article.

You are now ready to use your custom image to deploy Cloud or Baremetal servers!