Thursday, March 20, 2014

Creating a Windows Guest on Oracle Database Appliance(ODA) Virtualized Platform

When it comes to deploying a Windows guest as a virtual machine on Oracle's ODA, the documentation is lacking.  After some research and trial and error, I was able to put together a process that will successfully install Windows.

The ODA utilizes the oakcli command line, so OVM is not an option.  In this post, I will walk through the steps needed to prepare and deploy a Windows 7 virtual machine.

Here is a high level summary of the steps.

1. Create an unformatted virtual disk image
2. Create a configuration file for the VM template
3. Create a shared repository
4. Import the VM template
5. Clone a VM from the template
6. Boot from iso file and install Windows
7. Configure Windows network
8. Install Paravirtialized Drivers on Windows guest
9. Modify VM's network

NOTE: For the purposes of this example, all logins for Dom0 and ODA_BASE are on node 0.

First, we need to log into Domain 0 (Dom0) and create an empty unformatted virtual disk image.  The image file name must be System.img.  In the example below, the file size is fixed at 50G.

$ mkdir /OVS/staging/vm_temp/win7x64

$ dd if=/dev/zero of=/OVS/staging/vm_temp/win7x64/System.img oflag=direct bs=1M count=51200

In the same staging directory, create a vm.cfg file with the following content.  The "boot" parameter is set as "dc" which sets the CDROM first in the boot order.  The "disk" parameter names the System.img file created above as the device "hda" in "read/write" mode.  Before the Paravirtualized Drivers(PV) get installed, the "vif" parameter needs to be set with a type of "ioemu".  Later, when the VM is started, a vnc session for the console will be started.  The vnc port is set in the "vfb" parameter with a vncdisplay of 10.  The 10 sets the port to 5910.  A value of 1 would set it to 5901.

kernel = 'hvmloader'
builder = 'hvm'
vcpus = '4'
memory = '4096'
boot = 'dc'
disk = ['file:/OVS/staging/vm_temp/win7x64/System.img,hda,w']
name = 'win7x64'
vif = [ 'type=ioemu,bridge=net1' ]
on_poweroff = 'destroy'
on_reboot = 'destroy'
on_crash = 'destroy'
acpi = '1'
apic = '1'
vfb = [ 'type=vnc,vnclisten=,vncdisplay=10' ]

The next step is creating the tar file containing the two files created above to be imported.

$ cd /OVS/staging/vm_temp/win7x64

$ tar -Sczvf win7x64.tgz System.img vm.cfg

There are default repositories created as part of the ODA_BASE.  The repos "odarepo1" and "odarepo2" are local repositories and will not allow VMs running from these repos to fail over to the other node.  To avoid this, create a shared repository.

NOTE:  Once you create the repo, the size cannot be changed, so plan accordingly.

Log on to ODA_BASE and run the following command to create a 150GB shared repository in the DATA disk group.

$ oakcli create repo odashr -size 150G -dg DATA

Now the environment is set up to import the template.  Login to ODA_BASE as root and run the following command.

$ oakcli import vmtemplate tmpl_win7x64 -files "/OVS/staging/vm_temp/win7x64/win7x64.tgz" -repo odashr -node 0

Once the template has been imported, the VM can finally be cloned.  Using the vmtemplate, run the following command on ODA_BASE.

$ oakcli clone vm vm_win7x64 -vmtemplate tmpl_win7x64 -repo odashr -node 0

Copy the Windows installation iso file to a staging location on Dom0.  Then modify the file /OVS/Repositories/odashr/VirtualMachines/vm_win7x64/vm.cfg on Dom0 by adding the iso as a CDROM.  Below, the iso file /OVS/staging/X17-24281.iso has been defined as device "hdc" and made read only.

disk = [u'file:/OVS/Repositories/odashr/VirtualMachines/vm_win7x64/System.img,hda,w', 'file:/OVS/staging/X17-24281.iso,hdc:cdrom,r']

Now start the VM by logging into ODA_BASE and running the following command.

$ oakcli start vm vm_win7x64

Once the VM starts, log onto Dom0 and attach to the console with a VNC client using the vnc port defined above.  In our example, the port is 5910.  From the VNC console, you need to install Windows.

After the installation is complete, log into Dom0 and modify the /OVS/Repositories/odashr/VirtualMachines/vm_win7x64/vm.cfg file.  Change the boot parameter from "dc" to "cd".  This will name the boot device to the virtual hard drive rather than the CDROM.

Log into ODA_BASE and restart the VM.

$ oakcli stop vm vm_win7x64

$ oakcli start vm vm_win7x64

Now attach to your vnc session again and configure the network settings for the VM guest as per your requirements.  Once the network is configured and functioning, you can download the Windows PV Drivers to the guest and install them by running the executable.  As of the date of this post, the PV drivers can be downloaded from  Go to "Cloud Portal Oracle Linux/VM", and enter "Oracle VM" for the product pack and "x86 64 bit" for the platform.

After the PV drivers have been installed, modify the /OVS/Repositories/odashr/VirtualMachines/vm_win7x64/vm.cfg file by changing the "vif" parameter as follows.


vif = [ 'type=ioemu,bridge=net1']


vif = [ 'type=netfront,bridge=net1']

Now restart your VM, and the guest should be ready for use.  If you want to by-pass using the vnc session, configure remote desktop and connect to the console.

$ oakcli stop vm vm_win7x64

$ oakcli start vm vm_win7x64