Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-71-1524138.1
Update Date:2017-05-30
Keywords:

Solution Type  Technical Instruction Sure

Solution  1524138.1 :   ODAVP: How To Create a Fully-Virtualized Guests (HVM) from an OS ISO image  


Related Items
  • Oracle Database Appliance Software
  •  
  • Oracle Database Appliance
  •  
Related Categories
  • PLA-Support>Eng Systems>Exadata/ODA/SSC>Oracle Database Appliance>DB: ODA_EST
  •  




In this Document
Goal
Solution
 How To Create a Fully-Virtualized Guests (HVM) from an OS ISO image
 Creating a virtual disk
 Installing the Guest
 Some considerations about the guest configuration
 Create the Guest System Installation Template
 Using the new Guest
 Installing Microsoft Windows
 Extra Steps if you are installing Microsoft Windows
References


Applies to:

Oracle Database Appliance Software - Version 2.5.0.0 and later
Oracle Database Appliance - Version All Versions and later
Information in this document applies to any platform.

Goal

The purpose of this white paper is to illustrate how to create a Fully-Virtualized Guest (Hardware Virtual Machine) from an OS ISO image on Oracle Database Appliance Virtualized Platform.
Besides hosting paravirtualized guest systems Oracle Database Appliance can also host fully virtualized guests. This means that you can run any Operating System that is supported by the OVM Version that runs on your Oracle Database Appliance. The whitepaper describes how to install a fully virtualized guest on Oracle Database Appliance. We begin to outline sample installations of CentOS 6 and Microsoft Windows, thereafter we will discuss some of the potential changes to the configuration.

You can get the pdf version here.

Solution

DISCLAIMER:
     This article is provided for educational purposes describing an example of how to make a VM from an OS ISO image.
     Oracle World Wide Technical Support won't support in anyway the creation of such VM.
     Moreover if you are going to use OS such Microsoft Windows, this requires your own license.
     The OS ISO images are available on the respective OS vendor website

 
 

How To Create a Fully-Virtualized Guests (HVM) from an OS ISO image

Creating a virtual disk

The first step is to create an image which will hold the domU virtual disk. In this example images are located in '/OVS/staging/vm_temp/<vm_machine_name>' on dom0.

1. Create the required folder to host a temporary virtual machine guest (on dom0):

mkdir -p /OVS/staging/vm_temp/<virtual_machine_name>

ie:
mkdir -p /OVS/staging/vm_temp/CentOS6

 

2a. If there is a requirement to allocate disk blocks when the file grows, the option to create a "sparse" file should be used. The following command creates a “centOS6.img” file but the disk image doesn't take up the assigned 20 GB (20480 Mb) until it got filled (lazy fashion):

dd if=/dev/zero of=/OVS/staging/vm_temp/<virtual_machine_name>/System.img oflag=direct bs=1M count=0 seek=<file size in Mb>

ie:
# dd if=/dev/zero of=/OVS/staging/vm_temp/CentOS6/centOS6.img oflag=direct bs=1M count=0 seek=20480

 

Note 1: "sparse" file may have run-time performance issues as need to allocate the space on disk while the VM is working.
Note 2: shared repositories are supporting "sparse" file (since OAK vers. 12.1.2.2.0)
When installing MS Windows, consider a bigger virtual disk size (at least 50Gb=51200Mb)

 

2b. If there is a requirement to reserve all the data blocks immediately, use the following command. This avoids data block allocation problems which might influence performance.

dd if=/dev/zero of=/OVS/staging/vm_temp/<virtual_machine_name>/.img oflag=direct bs=1M count=20480 

ie:
dd if=/dev/zero of=/OVS/staging/vm_temp/Ubuntu12_10/ubuntu12_10.img oflag=direct bs=1M count=20480

This will avoid data block allocation problems if the volume that holds the image is full.

 

Installing the Guest

The following is required to start the installation '/OVS/staging/vm_temp/<virtual_machine_name>/vm.cfg' configuration file on dom0 that defines the guest system:

name = '<virtual_machine_name>'
kernel = '/usr/lib/xen/boot/hvmloader'
device_model = '/usr/lib/xen/bin/qemu-dm'
builder = 'hvm'
memory = '<memory>'
vcpus = <vcpus>
acpi = 1
apic = 1
pae = 1
disk = ['file:/OVS/staging/vm_temp/<virtual_machine_name>/<System file name>.img,xvda,w']
on_reboot = 'destroy'
on_crash = 'destroy'
on_poweroff = 'destroy'
keymap = '<keymap>'
usbdevice = 'tablet'
vif = [ 'type=ioemu, bridge=net1']
vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=10' ]
ie:

name = 'CentOS6'
kernel = '/usr/lib/xen/boot/hvmloader'
device_model = '/usr/lib/xen/bin/qemu-dm'
builder = 'hvm'
memory = '2048'
vcpus = 2
acpi = 1
apic = 1
pae = 1
disk = ['file:/OVS/staging/vm_temp/CentOS6/centOS6.img,xvda,w']
on_reboot = 'destroy'
on_crash = 'destroy'
on_poweroff = 'destroy'
keymap = 'it'
usbdevice = 'tablet'
vif = [ 'type=ioemu, bridge=net1' ]
vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=10' ]
Some considerations about the guest configuration

- Since the disk image is empty at this time, you need to boot from the OS ISO image. The boot device order can be specified with the boot parameter:

boot="dc"

- The amount of CPUs for the guest is defined by 

vcpu = 2

- The amount of memory for the guest is defined in Mb by

memory = '2048'

- We should avoid booting the guest with the same parameters.after the installation is completed. We have to ensure the virtual machine gets destroyed after a reboot. The same applies for a “crash”  or  “power off”

on_reboot = 'destroy'
on_crash = 'destroy'
on_poweroff = 'destroy'

- The device entry for the hard disk create above is present as the device for the CDROM/DVD OS iso image

disk = [u'file:/OVS/staging/vm_temp/<virtual_machine_name>/.img,xvda,w', 'file:/OVS/staging/.iso,xvdc:cdrom,r']

- The backend listens on IP 127.0.0.1 port 5900+N by default where N is the domain ID. Both, address and N can be changed (IP address 0.0.0.0 means dom0 IP)

vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=1' ]

Or you can bind the first unused port above 5900:

vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]

- The password can be changed as well

vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncpassword='MyPassword',vncunused=1' ]

- You can change the key mapping which is used when connecting to a virtual machine's console using the "keymap" ('en-us' for English, 'it' for Italian ...) parameter, in this example keymap='it '.

keymap = 'it'

The keymaps available are defined by the device-model which you are using. Commonly this includes:

ar  de-ch  es  fo     fr-ca  hu  ja  mk     no  pt-br  sv
da  en-gb  et  fr     fr-ch  is  lt  nl     pl  ru     th
de  en-us  fi  fr-be  hr     it  lv  nl-be  pt  sl     tr

The default is en-us

Create the Guest System Installation Template

You can now create the guest system installation template. On dom0 execute the following command

tar -Sczvf <virtual_machine_name>.tgz /OVS/staging/vm_temp/<virtual_machine_name>/System.img /OVS/staging/vm_temp/<virtual_machine_name>/vm.cfg

ie:
# tar -Sczvf centOS6.tgz centOS6.img vm.cfg
centOS6.img
vm.cfg

Once the prompt returns, import the template from ODA_BASE domain with the following command:


oakcli import vmtemplate <vmtemplatename> -files /OVS/staging/vm_temp/<virtual_machine_name>/<virtual_machine_name>.tgz –repo <repo_name>

ie:
# oakcli import vmtemplate CentOS6 -files "/OVS/staging/vm_temp/CentOS6/centOS6.tgz" -repo odarepo2

Imported VM Template

Once the template is imported, clone the VM issuing (from ODA_BASE):

oakcli clone vm <vm_name> -vmtemplate <template_name> -repo <repo_name>
ie:
# oakcli clone vm CentOS6 -vmtemplate CentOS6 -repo odarepo2
Cloned VM : CentOS6  

Once the VM is cloned, you need to edit the vm.cfg under the created VM folder “/OVS/Repositories/<repo_name>/VirtualMachines/<vm_name>” on dom0.

- As the disk image is empty at this time, you need to boot from the OS ISO image. The boot device order can be specified with the boot parameter:
boot="dc"
boot on CD-ROM (d), hard disk (c)

- The device entry for the hard disk created above is present as the device for the CDROM/DVD OS iso image:

disk = ['file:/OVS/staging/vm_temp/<virtual_machine_name>/System.img,xvda,w', 'file:/OVS/staging/<OS_ISO_image>.iso,xvdc:cdrom,r']

  
Note: you need to copy your Operating System ISO image into “/OVS/staging”.

Example:

name = 'CentOS6'
kernel = '/usr/lib/xen/boot/hvmloader'
device_model = '/usr/lib/xen/bin/qemu-dm'
builder = 'hvm'
memory = '2048'
vcpus = 2
acpi = 1
apic = 1
pae = 1
boot="dc"
disk = ['file:/OVS/staging/vm_temp/CentOS6/centOS6.img,xvda,w', 'file:/OVS/staging/CentOS-6.4-x86_64-minimal.iso,xvdc:cdrom,r']
on_reboot = 'destroy'
on_crash = 'destroy'
on_poweroff = 'destroy'
keymap = 'it'
usbdevice = 'tablet'
vif = [ 'type=ioemu, bridge=net1' ]
vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=10' ]

You can now startup the VM issuing the following commands (from ODA_BASE)

oakcli start vm <vm_name>

ie:
# oakcli start vm CentOS6

Started VM : CentOS6

 
You will have to attach a VNC viewer to view the graphical console. In this example, the guest system is running with

vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=10' ]

You can now connect to this system with
vncviewer oda_dom0:<VNCDisplayID>. In this case, the command to use is: vncviewer oda2-d0:5910

Using the new Guest

You will have to adjust the guest “vm.cfg” configuration for normal use. Change the boot device and correct the “on_reboot” and “on_crash” options to “restart” or "destroy" base on your needs. The following example shows the mentioned changes and removes the cdrom device:

name = 'CentOS6'
kernel = '/usr/lib/xen/boot/hvmloader'
device_model = '/usr/lib/xen/bin/qemu-dm'
builder = 'hvm'
memory = '2048'
vcpus = 2
acpi = 1
apic = 1
pae = 1
disk = ['file:/OVS/staging/vm_temp/CentOS6/centOS6.img,xvda,w']
on_reboot = 'restart'
on_crash = 'restart'
on_poweroff = 'restart'
keymap = 'it'
usbdevice = 'tablet'
vif = [ 'type=ioemu, bridge=net1']
vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncpasswd='',vncunused=1']

 
Now then start the guest system (from ODA_BASE):

oakcli start vm <vm_name>

ie:
# oakcli start vm CentOS6

 
You can connect to the graphical console with the same procedure as described above.

Now remove the "temporary" new guest virtual machine from dom0

rm -fr /OVS/staging/vm_temp/<vm_name>

ie:
# rm –fr /OVS/staging/vm_temp/CentOS6

 
Show the new guest settings:

# oakcli show vm CentOS6
Resource: CentOS6
    AutoStart       :    restore        
    CPUPriority     :    100            
    Disks           :    |file:/OVS/Repositories/odarepo2/VirtualMachines/CentOS6/centOS6.img,xvda,w|
    Domain          :    XEN_PVM        
    ExpectedState   :    offline        
    Keyboard        :    it             
    MaxMemory       :    2048           
    MaxVcpu         :    2              
    Memory          :    2048           
    Mouse           :    OS_DEFAULT     
    Name            :    CentOS6    
    Networks        :    |type=ioemu, bridge=net1|
    NodeNum         :    1              
    OS              :    OL_5           
    PrivateIP       :    None           
    ProcessorCap    :    100            
    RepoName        :    odarepo2       
    State           :    Offline        
    TemplateName    :    otml_CentOS6
    Vcpu            :    2              
    cpupool         :    default-unpinned-pool
    vncport         :    0

Installing Microsoft Windows

In case the windows installer hangs during the kernel boot-up,. disable ACPI and the APIC in the guest (“vm.cfg”):

acpi = 0
apic = 0
Extra Steps if you are installing Microsoft Windows

Download the PV drivers for windows and Install them
After the network has been configured for Windows VM, access the http://edelivery.oracle.com, down-load and install the Oracle PV drivers for Windows, you find them on:
Cloud Portal (Oracle Linux/VM)

  • Product Pack: Oracle VM
  • Platform X86 64bit
  • Oracle VM Media Pack should be the same version of the OVM running on ODA  

Modify the VM configuration file and specify the netfront drivers
So far the “vm.cfg” file was configured to use the emulated drivers for Windows. Modify the vm.cfg configuration and vif option to use the netfront drivers instead of the ioemu drivers.

Make the following changes to the “vm.cfg” file:

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

Make the network changes from ODA_Base (oakDom1) with the following “oakcli” command:

oakcli configure vm <vm_name> -network "['type=netfront,bridge=net1']"

ie:
# oakcli configure vm MsWin -network "['type=netfront,bridge=net1']"


Restart the VM:

oakcli stop vm <vm_name> ; oakcli start <vm_name>

ie:
# oakcli stop vm MsWin ; oakcli start MsWin

 
Once the VM comes up, check the network settings and verify if the realtek driver is still enabled. If this is the case, disable the realtek driver and configure the Oracle VM PV driver, assign the correct IP address, netmask, gateway and the DNS information. At this stage of the installation and configuration, Windows VM is complete with a fully working copy of Windows.

ioemu vs netfront
If the virtual machine is a hardware virtualized machine (fully virtualized). You can configure the virtual interface (VIF) type to be either ioemu or netfront. The netfront driver is a paravirtualized driver which can be used with a Paravirtualized machine or with a hardware virtualized machine. The ioemu driver is a hardware virtualized driver and can only be used with a hardware virtualized machine. Both drivers contain the BIOS and device emulation code to support hardware virtualized machines. For hardware virtualized machines, the default is ioemu. For Paravirtualized machines, the default is netfront. After you configure the virtual interface type for one network interface card, i.e. all the network interface cards in the virtual machine will be set to the same type.

  



References

<NOTE:1608367.1> - ODAVP: Migrating systems to ODA Virtualized Platform (ODA VP)
<NOTE:579413.1> - Oracle VM: How to Configure 'xm console' Access for Guests
http://en.wikipedia.org/wiki/Sparse_file
<NOTE:1606398.1> - Oracle VM 3.x: Oracle Linux 6 guest VM conversion from HVM to PVM
<BUG:16863114> - PLACE HOLDER BUG TO RELEASE WINDOWS PV DRIVER 3.2
<NOTE:2099289.1> - ODAVP: Create HVM Guest from ISO in "1-Click"

Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback