Blog Article:

Configuring Virtual Machines with Windows Templates

André Monteiro

Nov 12, 2011

We have recently been working on deploying Windows VMs using OpenNebula templates and, although the process can be optimized, the basic steps are enough to automate this process and deploy dozens of Windows VMs simultaneously in a couple of minutes. We thought we would share our experience through the OpenNebula blog.

Basically, we developed a set of scripts that handle the contextualization of the Windows VM on boot. Using the OpenNebula context.sh script, ours scripts configure username, password, IP, gateway, DNS, hostname, Remote Desktop and even leave a README file on Desktop with credentials and recommendations.

To use these scripts, you must have a Windows machine installed on a raw or qcow file. Windows 2008 (64-bit) and Windows 7 (32/64-bit) have been successfully tested with this approach.

To give you an idea, here is an example of a Windows 2008 ONE template:

CONTEXT=[
  FILES="/opt/opennebula_shared/context-scripts/windows/startup.vbs
              /opt/opennebula_shared/context-scripts/windows/one-context.ps1 
             /opt/opennebula_shared/context-scripts/windows/unattend.xml
             /opt/opennebula_shared/context-scripts/windows/README.txt 
             /opt/opennebula_shared/context-scripts/windows/SetupComplete.cmd",
  HOSTNAME=Win2008-$VMID,
  IP_PUBLIC="$NIC[IP, NETWORK=\"Classes Network\"]",
  PASSWORD=thepassword,
  ROOT_PUBKEY=id_rsa.pub,
  USERNAME=theusername
]

CPU=1

DISK=[
  BUS=virtio,
  DRIVER=qcow2,
  READONLY=no,
  IMAGE_ID = 12,
  TARGET=vda,
  TYPE=disk 
]

FEATURES=[ ACPI=yes ]

GRAPHICS=[ TYPE=vnc ]

MEMORY=2048

NAME=Windows2008-SQL2008-VS2010

NIC=[
 MODEL=e1000,
 NETWORK_ID=4 
]

OS=[
  ARCH=x86_64,
  BOOT=hd 
]

TYPE=kvm 
]

We are already using these templates on our OpenNebula server at the Institute of Electronics and Telematics Engineering of Aveiro, and everything has been running smoothly for a month!

Feel free to comment or ask for help. Please visit our guide on Using Windows Images for new Virtual Machines for more information, including the contextualization scripts needed by the template.

1 Comment

  1. S N Banerjee

    Hi,

    I have somewhat able to boot Win7 OS using virt-install command on a qcow2 disk of 8GB. But on instantiating the template, the VM is in running status but not able to Boot from Hard Disk.

    The error on the VNC screen is “Booting from Hard Disk”

    Could you please help me!

    Reply

Trackbacks/Pingbacks

  1. opennebula.org » Archives » OpenNebula Newsletter – November 2011 - [...] André Monteiro, from the Institute of Electronics and Telematics Engineering of Aveiro, contributed a detailed guide on how to…

Submit a Comment

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