![]() | Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition | ||
|
|
![]() |
||||||||||||||||||||||||||||||||
Solution Type Technical Instruction Sure Solution 1524138.1 : ODAVP: How To Create a Fully-Virtualized Guests (HVM) from an OS ISO image
In this Document
Applies to:Oracle Database Appliance Software - Version 2.5.0.0 and laterOracle Database Appliance - Version All Versions and later Information in this document applies to any platform. GoalThe 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. You can get the pdf version here. SolutionDISCLAIMER:
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 imageCreating a virtual diskThe 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 GuestThe 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 TemplateYou 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. disk = ['file:/OVS/staging/vm_temp/<virtual_machine_name>/System.img,xvda,w', 'file:/OVS/staging/<OS_ISO_image>.iso,xvdc:cdrom,r']
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 vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=10' ]
You can now connect to this system with Using the new GuestYou 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'] oakcli start vm <vm_name>
ie: # oakcli start vm CentOS6 rm -fr /OVS/staging/vm_temp/<vm_name>
ie: # rm –fr /OVS/staging/vm_temp/CentOS6 # 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 WindowsIn 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 WindowsDownload the PV drivers for windows and Install them
Modify the VM configuration file and specify the netfront drivers 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']"
oakcli stop vm <vm_name> ; oakcli start <vm_name>
ie: # oakcli stop vm MsWin ; oakcli start MsWin 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 |
||||||||||||||||||||||||||||||||
|