Home > Blogs > OpenStack Blog for VMware


VMware Integrated OpenStack Glance Image Best Practices

A production cloud isn’t very efficacious unless users have the ability to run virtual machine images required by their application.  A cloud image is a single file that contains a virtual disk that has an operating system.  For many organizations, the simplest way to obtain a virtual machine image is to download a prebuilt base cloud image with a pre-packaged version of cloud-init to support user-data injection.  Once downloaded, an organization would leverage tools such as Packer to further customize and harden on top of the base image before rolling to production.  Most operating system projects and vendors maintain official images for direct download.  Openstack.org maintains a list of most commonly used images here.

 

 

 

 

 

 

 

 

 

Recently we received some queries about the proper way to import prebuilt QCOW2 native cloud images into VMware Integrated OpenStack.  Images import correctly, but would not successfully boot.  Common symptoms are “no Operating System found” messages generated by the virtual machine’s BIOS, the guest OS hanging during the boot cycle, or DHCP failure when trying to acquire an IP address.  After further analysis, problems were either caused by older upstream tooling or simple adjustments required in the cloud image to match the vSphere environment.  Specifically:

  • Some storage vendors need StreamOptimized image format.
  • Guest Images are attempting to write boot log to ttyS0, but the serial interface is not available on the VM.
  • Defects in earlier versions of the qemu-img tool while creating streamOptimized images.
  • DHCP binding failure caused by Predictive Network Interface Naming.

To overcome these issues, we came up with the following set of best practices to help you simplify the image import process.  I thought it would be a good idea to share our recommendations so others can avoid running into similar issues.

1). VIO 3.x and earlier, serial console output is not enabled.  When booting an image that requires serial console support, use libguestfs to edit the grub.cfg and remove all references to “console=ttyS0”.  Libguestfs provides a suite of tools for accessing and editing VM disk images.  Once installed the “guest mount” command-line tool can be used to mount qcow2 based images.  By default, the disk image mounts in read-write mode.  More info on Libguestfs here.

# guestmount -a xxx-cloudimg-amd64.img -m /dev/sda1 /mnt

# vi /mnt/boot/grub/grub.cfg

# umount mnt

See below screen Capture:

 

 

 

 

 

 

2). VMware vSAN requires all images to be in streamOptimized format.  When converting to VMDK format, use the –o flag to specify the subformat as streamOptimized:

# qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized -o adapter_type=lsilogic xxx-server-cloudimg-amd64.img xxx-server-cloudimg-amd64.vmdk ; printf ‘\x03’ | dd conv=notrunc of=xxx-server-cloudimg-amd64.vmdk bs=1 seek=$((0x4))

A few additional items to call out:

  • “lsilogic” is the recommended adapter type.  Although it is possible to set the adapter type during image upload into glance, we recommend as a good practice to always set the adapter type as part of the image conversion process.
  • Older versions of the qemu-img tool contain a bug that causes problems with the streamOptimized subformat.  The following command can be run after converting an image to correct the problem: printf ‘\x03’ | dd conv=notrunc of=xxx-server-cloudimg-amd64.vmdk bs=1 seek=$((0x4)).   It is harmless to execute the printf even if you’re using a version of qemu-tools that has the fix: all the command does is set the VMDK version to “3” which correct version of qemu-img will already have done.  If you are not sure what version of qemu-tools you have, apply the printf command.

3). In the case of CentOS, Udev rule ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules as part of the image bundle is ignored during CentOS image boot up and Predictable Network Interface Naming is enabled as a result.  Our recommendation is to disable predictive naming using grub.  You can find more information on my previous blog.

4). Finally, with Cirros QOCW image, preserve the adapter type as ‘ide’ during the QCOW2 to VMDK conversion process.  There’s currently an upstream bug open.

# qemu-img convert –f qcow2 –O vmdk /var/www/images/cirros-0.3.5-x86_64-disk.img /var/www/images/cirros-0.3.5-x86_64-disk.idk.vmdk

qemu-img defaults to IDE if no adapter type is specified.

Once converted, you can look into the image metadata and validate information such as disk and image type before uploading into Glance image repository.  Image metadata can be viewed by display the first 20 lines of the VMDK

# cat xxx-server-cloudimg-amd64.vmdk | head -20

You can add the newly converted image into glance using OpenStack CLI or Horizon.  Set the public flag when ready for end user consumption.

OpenStack CLI:

# openstack image create –disk-format vmdk –public –file ./xxx-server-cloudimg-amd64.vmdk –property vmware_adaptertype=’lsiLogic’ –property vmware_disktype=’streamOptimized’ <Image display name>

Horizon:

 

 

 

 

 

 

 

 

 

 

Your cloud is as useful as the application and virtual machine images you can support.  By following above simple best practice guidelines, you will deliver a better user experience to your end users by offering more Virtual machine varieties with significantly reduced lead time.

Visit us at VMworld in Las Vegas; we have a large number of Demo and speaking sessions planned:

MGT2609BU:  VMware Integrated OpenStack 4.0: What’s New
MGT1785BU:  OpenStack in the Real World: VMware Integrated OpenStack Customer Panel
NET1338BU:  VMware Integrated OpenStack and NSX Integration Deep Dive
FUT3076BU:  Simplifying Your Open-Source Cloud With VMware
LDT2834BU:  Running Hybrid Applications: Mainframes to Containers
SPL182001U:  VMware Integrated OpenStack (VIO) – Getting Started
ELW182001U: VMware Integrated OpenStack (VIO) – Getting Started
SPL188602U: vCloud Network Functions Virtualization – Advanced Topics
LDT1844BU: Open Source at VMware: A Key Ingredient to Our Success and Yours

Leave a Reply

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

*