Linux is not the only operating system in cloud computing; your OpenStack users may want to utilize Windows images too! Today, we discuss how to create your Windows VM for OpenStack and how to import that VM with the Glance service.
Prepare the Windows VM for OpenStack
Fortunately, preparing Windows images is fairly easy on the VMware vSphere platform.
The process can be summarized with the following steps:
- Create a new VM with a single virtual disk with sufficient storage and memory allocations
- Deploy the Windows operating system in a VMware vSphere VM
- Install VMware Tools after Windows is done installing
- This step is especially important if you are using Windows 2012 images since VMXNET3 network adapters are recommended.
That’s it! You will then have a VM that can be imported to VMware Integrated OpenStack as a Glance image.
Some users may want to leverage cloudbase-init in addition to the Windows Guest Customization feature in VMware Integrated OpenStack (VIO) versions 2.0 and later. So, an optional final step would be to install cloudbase-init.
VIO versions 2.0.1 and later are capable of interpreting which customization method you wish to use based on the image’s metadata. If you add Windows-specifc customization metadata to the image, the VIO guest customization feature will be used. Otherwise, the user is free to use their favorite cloudbase-init scripts during instance deployment.
VIO 2.0 GA does not have an automatic switch between the guest customization feature and cloudbase-init automation. For users that want to leverage cloudbase-init with VIO 2.0 GA, the following steps need to be followed:
- On the VIO management server, create or edit the following file:
- In the custom.yml file, add or edit the following setting
- nova_compute_vmware_use_guest_customizations: false
- Run the following command to apply the setting
- sudo viocli deployment configure –limit compute
Import the VMDK to Glance
Now that you have your Windows VM created, it is time to import it to the OpenStack Glance service. Before we do so, let’s use PowerCLI to collect some information about the VM that the Glance service will need: the Operating System identifier, and the SCSI controller type.
# First, identify which VM you are importing to OpenStack
$OpenStackWinVM = get-vm -name your-vm-name
# Now, get the Operating System ID for the vmware_ostype property
# We also need the SCSI controller type for the vmware_adaptertype property
$OpenStackWinVM | Get-ScsiController
There is also a vmware_disktype property. If you manually copy the VMDK file from the datastore, the vmware_disktype property will be preallocated. If you exported your VM as an OVA file, then set the vmware_disktype to streamOptimized
Mount the folder or share that contains the exported VM to your desktop. Then, load your OpenStack credentials into memory, and use the Glance CLI to upload your Windows VM to the cloud.
Windows PowerShell syntax:
glance image-create --property vmware_disktype=preallocated `
--property vmware_adaptertype=lsiLogicsas --name windows-2012-r2-test `
--property vmware_ostype=windows8Server64Guest --container-format bare `
--disk-format vmdk --min-disk 40 --min-ram 512 --progress `
Mac\Linux Shell syntax:
glance image-create --property vmware_disktype=preallocated \
--property vmware_adaptertype=lsiLogicsas --name windows-2012-r2-test \
--property vmware_ostype=windows8Server64Guest --container-format bare \
--disk-format vmdk --min-disk 40 --min-ram 512 --progress \
The Glance service may populate incorrect values for your SCSI controller (vmware_adaptertype) and for your NIC type (hw_vif_model). Examine the output from the glance image-create command to verify the correct settings. See Figure 1 for for an example:
Notice the vmware_adaptertype is set to lsiLogic instead of lsiLogicsas. Also, since there isn’t an explicit hw_vif_model value specified, it will default to e1000. Again, for a Windows 2012 instance, you will want to use a VMXNET3 virtual NIC. We can correct these two items using the glance image-update command:
glance image-update --property vmware_adaptertype=lsiLogicsas 97673f90-8948-425b-a0db-24c6a234dc0d
glance image-update --property hw_vif_model=VirtualVmxnet3 97673f90-8948-425b-a0db-24c6a234dc0d
Once these changes are made, your VMware-specific metadata will be set correctly as seen in Figure 2. Notice the updated values for the hw_vif_model and vmware_adaptertype settings.
If you would like to learn more about VMware-specfic Glance properties check out the OpenStack documentation site which has some helpful examples.