Deploying Windows Server 2008 R2 on VMware with Openstack

Deploying Windows Server 2008 R2 on VMware with Openstack

I would like to share my experience of deploying virtual machines (from now on – VM’s) based on Windows Server 2008 R2 x64 in Openstack environment.

First I would like to describe the situation why I had to use Openstack for deployment of Windows-based VM’s. Currently the project for distributed calculations using OGC WPS standard is being developed in

ISDCT SB RAS, Irkutsk, so there is a need for a web-application, which will allow users to create VPS in one click – then they install required WPS service on they freshly created VPS and join our project. Users enter the name of the VM and choose the operation system. Currently we offer Ubuntu 14.04 LTS and Windows Server 2008 R2. When user creates his own VPS, he receives public IP and root credentials of the VM.

 So, what do we have – host with VMware ESXi controlled by vCenter, two VM’s for Openstack compute and controller nodes. In this guide we will cover full procedure how to create Windows VM in vCenter, then we will convert it to the Openstack image in Glance and launch it as ready-to-use VM in one click. Probably, this guide can be applied to any of the Windows system, not only for Windows 7-based systems.

Technical data

  • VMware ESXi host – 1 TB storage, 64 GB RAM, 24 CPU’s
  • vCenter 5.1
  • Openstack Icehouse
  • vCenter is installed on Windows Server 2008 x64 R2
  • Openstack nodes are installed on Ubuntu LTS 14.04

 

1. Create source VM

First we create regular VM with Windows Server onboard – in some cases I will use vSphere client, sometimes – vCenter web client – this does not really matter for our guide. So, we create new VM – select any settings you would like, remember the SCSi type setting – in our case I’ve selected LSI Logics Parallel, so I have to remeber this setting in order to correctly import this VM as image in Openstack. Anyway, we can always check this setting later.

Select your Windows ISO, connect it at power on.

 

VM settings

VM settings

Selecting Windows ISO

Selecting Windows ISO

Freshly created VM ws2008x64 in vCenter listing

Freshly created VM ws2008x64 in vCenter listing

 

2. Install Windows Server

Launch VM and install Windows as usual. Adjust your network settings, then we will download external software for virtualization support. In my case I will install some extra software for convenience as well. Do not forget to activate windows, or you can leave it for those who will use the VM’s – after deployment the unregistered version will ask user for registration key.

Windows Server 2008 R2 VM

Windows Server 2008 R2 VM

3. Installing software for image-creation and future deployment

First we need to install VMware tools.

Install VMware Tools

Select your VM in vCenter, choose “Intall/upgrade VMware tools” in settings panel, then ISO with VMware tools will be attached to your VM as regular CD

 

 

Then we need to install Cloudbase init solution (http://www.cloudbase.it/cloud-init-for-windows-instances/), it will install required software and execute sysprep Windows utility – basically, when you first launch your instance, it will initialize OS as the freshly installed one, at the same time keeping preinstalled software and non-user specific settings.

Keep in mind that before you execute sysprep, you have to put your network settings to the defaults (obtain address by DHCP) to allow VM’s, that use this image, to boot properly.

Cloudbase init solution

Cloudbase init solution

 

4. Creating a template

So, our VM is ready to be saved as a template and then we will import the template to the Openstack Glance image service. Create template and transfer it to the controller Openstack node. Template is stored in vmdk file, which is can be exported into the Glance.

Creating template

Creating template

Selecting template through the Datastore browser in VMware vCenter

Selecting template through the Datastore browser in VMware vCenter

 

Transferring VMDK template file to the Openstack controller host

Transferring VMDK template file to the Openstack controller host

 

5. Import template to the Glance

Import template to the Glance with following command

glance image-create –name=ws2008x64 –is-public=True –disk-format=vmdk –property vmware_adaptertype=”lsiLogic” –property vmware_disktype=”preallocated”  –property vmware_ostype=”windows7Server64Guest” –container-format=bare < ws2008r2x64-flat.vmdk

Note, that we set the vmware_adaptertype property according to the settings of the source VM, that we created in the step No. 1


Check if image was registered with

glance image-list

 

6. Launch instance

Launch new instance in the Dashboard, it will take a lot of time, probably – do not worry, Glance is copying image back to your VMware host – next time this Windows VM, that is based on this image will be launched in couple of seconds. Finally, we have our VM launched, it has assigned by DHCP network address and DNS servers, so, we are ready to work!

Sometimes following problem occurs: when you are trying to RDP your freshly created instance, it proposes you to enter new password for Administrator account. When you enter the new one, it says that Access denied. To avoid it, you need to enter not just Administrator username, but the localhost\Admistrator (assuming that the password is empty).

Voila!

Voila!