Thursday, July 28, 2011

Just create guest virtual machine from template

I heard many people talk about Oracle VM templates. I interested and checked them on E-Delivery. But I just needed to test, before test more... So, Installed Oracle VM server release 2.2.2 and used some Oracle VM template for testing. I used WebLogic10gR3 -)
# ln -s /DISK_PATH /OVS/seed_pool
# cd /OVS/seed_pool/
# unzip V15726-01.zip
Archive: V15726-01.zip
creating: OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/
inflating: OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/README
inflating: OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/vm.cfg
inflating: OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/System.img
inflating: OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/u01.img
inflating: OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/weblogic.img
Directory structure:
/OVS/seed_pool/OVM_template_name
|
|- System.img (operating system image file)
|- extra.img (optional additional image file(s))
|- vm.cfg (virtual machine configuration file)
|- README
Generate a new MAC address
# export PYTHONPATH=/opt/ovs-agent-2.3; python -c "from OVSCommons import randomMAC; print randomMAC()"
00:16:3e:74:21:bb
Edit the vm.cfg file
# cd OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/
# cat vm.cfg
bootloader = '/usr/bin/pygrub'
disk = ['file:/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/System.img,xvda,w',
'file:/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/weblogic.img,xvdb,w',
'file:/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/u01.img,xvdc,w']
memory = '1024'
name = 'OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10'
on_crash = 'restart'
on_reboot = 'restart'
vcpus = 2
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0']
vif = ['']
*** Change ***
# cat vm.cfg
bootloader = '/usr/bin/pygrub'
disk = ['file:/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/System.img,xvda,w',
'file:/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/weblogic.img,xvdb,w',
'file:/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/u01.img,xvdc,w']
memory = '1024'
name = 'OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10'
on_crash = 'restart'
on_reboot = 'restart'
vcpus = 2
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0']
vif = ['mac=00:16:3e:74:21:bb', ]
Create and start up the guest virtual machine
# xm create /OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/vm.cfg
Using config file "/OVS/seed_pool/OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10/vm.cfg".
Started domain OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10 (id=4)
Find out the VNC port number
# xm list -l OVM_EL52_jeos_i386_PVM_WebLogic10gR3_v10 |grep location
(location 0.0.0.0:5900)
(location 2)
Connect vnc by vncviewer:

Set IP Address/Netmask/Gateway and Hostname... THEN
Done... good for me for new learning -)

No comments: