1 Reply Latest reply: Apr 6, 2012 7:12 AM by 346704 RSS

    OVM 3.0.3 import VirtualBox OVM Manager 3.0.3 OVA template

    J Peters-Oracle
      VirtualBox Template for Oracle VM Manager 3.0.3,

      http://www.oracle.com/technetwork/server-storage/vm/template-1482544.html

      The OVM 3.0.3 host should be configured with enough space to accommodate import of OVA template. In
      this case 36G was allocated for "sda",

      [root@ovm303 ~]# fdisk -l /dev/sda

      Disk /dev/sda: 38.6 GB, 38654705664 bytes
      255 heads, 63 sectors/track, 4699 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes

      Device Boot Start End Blocks Id System
      /dev/sda1 * 1 4189 33648111 83 Linux
      /dev/sda2 4190 4699 4096575 82 Linux swap / Solaris

      Post OVA import disk usage,

      [root@ovm303 ~]# df -T -t ext3
      Filesystem Type 1K-blocks Used Available Use% Mounted on
      /dev/sda1 ext3 32594216 24105604 6806208 78% /.

      [root@ovm303 ~]# cat /etc/motd
      Warning: making manual modifications in the management domain
      might cause inconsistencies between Oracle VM Manager and the server.

      [root@ovm303 ~]# head -4 /etc/ovs-info
      OVS summary
      release: 3.0.3
      date: 201111300901
      build: 123

      The contents of "ovs-info" also include package information.

      The "vbox-img" package is something new in OVM 3.0.3,

      [root@ovm303 ~]# grep vbox-img /etc/ovs-info
      vbox-img-1.0-2

      [root@ovm303 ~]# rpm -ql vbox-img
      /usr/bin/vbox-img
      /usr/share/doc/vbox-img-1.0
      /usr/share/doc/vbox-img-1.0/COPYING

      [root@ovm303 ~]# vbox-img --help
      Oracle VM VirtualBox Disk Utility 4.1.3
      (C) 2005-2011 Oracle Corporation
      All rights reserved.

      Usage: vbox-img
      setuuid --filename <filename>
      [--format VDI|VMDK|VHD|...]
      [--uuid <uuid>]
      [--parentuuid <uuid>]
      [--zeroparentuuid]

      convert --srcfilename <filename>
      --dstfilename <filename>
      [--stdin]|[--stdout]
      [--srcformat VDI|VMDK|VHD|RAW|..]
      [--dstformat VDI|VMDK|VHD|RAW|..]
      [--variant Standard,Fixed,Split2G,Stream,ESX]

      info --filename <filename>

      compact --filename <filename>
      createcache --filename <filename>
      --size <cache size>


      Download "OracleVMManager3" OVA,

      [root@ovm303 xen]# mkdir /etc/xen/ovm303-m

      [root@ovm303 ~]# cd /etc/xen/ovm303-m

      [root@ovm303 xen]# wget http://download.oracle.com/otn-pub/otn_software/OracleVMManager3.ova
      --2012-03-14 17:06:01-- http://download.oracle.com/otn-pub/otn_software/OracleVMManager3.ova
      Length: 4234452992 (3.9G) [text/plain]
      Saving to: `OracleVMManager3.ova'

      100%[====================================>] 4,234,452,992 834K/s in 55m 36s

      2012-03-14 18:01:38 (1.21 MB/s) - `OracleVMManager3.ova' saved [4234452992/4234452992]

      [root@ovm303 xen]# md5sum OracleVMManager3.ova
      75fc334422eda6c3425a2f09fb88f9e0 OracleVMManager3.ova

      Unpack OVA,

      [root@ovm303 xen]# tar tvf OracleVMManager3.ova
      -rw------- someone/someone 59626 2012-01-12 17:42:49 OracleVMManager3.ovf
      -rw------- someone/someone 1987182592 2012-01-12 17:48:06 OracleVMManager3-disk1.vmdk
      -rw------- someone/someone 2247208960 2012-01-12 17:51:24 OracleVMManager3-disk2.vmdk

      [root@ovm303 ovm303-m]# tar xvf OracleVMManager3.ova
      OracleVMManager3.ovf
      OracleVMManager3-disk1.vmdk
      OracleVMManager3-disk2.vmdk

      Use "vbox-img" to show "OracleVMManager3-disk1.vmdk",

      [root@ovm303 ovm303-m]# vbox-img info --filename OracleVMManager3-disk1.vmdk
      --- Dumping VD Disk, Images=1
      Dumping VD image "OracleVMManager3-disk1.vmdk" (Backend=VMDK)
      Header: Geometry PCHS=16383/16/63 LCHS=1024/255/63 cbSector=52428800
      Header: uuidCreation={f3859e00-962c-440f-a63d-feb7b731d5da}
      Header: uuidModification={00000000-0000-0000-0000-000000000000}
      Header: uuidParent={00000000-0000-0000-0000-000000000000}
      Header: uuidParentModification={00000000-0000-0000-0000-000000000000}

      Convert "OracleVMManager3-disk1.vmdk" to RAW,

      [root@ovm303 ovm303-m]# vbox-img convert srcfilename OracleVMManager3-disk1.vmdk dstfilename OracleVMManager3-disk1.img srcformat VMDK dstformat RAW
      Converting image "OracleVMManager3-disk1.vmdk" with size 26843545600 bytes (25600MB)...

      [root@ovm303 ovm303-m]# file OracleVMManager3-disk1.img
      OracleVMManager3-disk1.img: x86 boot sector; partition 1: ID=0x83, active, starthead 1, startsector 63, 208782 sectors; partition 2: ID=0x8e, starthead 0, startsector 208845, 52211250 sectors, code offset 0x48

      [root@ovm303 ovm303-m]# fdisk -l OracleVMManager3-disk1.img
      last_lba(): I don't know how to handle files with mode 8180
      You must set cylinders.
      You can do this from the extra functions menu.

      Disk OracleVMManager3-disk1.img: 0 MB, 0 bytes
      255 heads, 63 sectors/track, 0 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes

      Device Boot Start End Blocks Id System
      OracleVMManager3-disk1.img1 * 1 13 104391 83 Linux
      OracleVMManager3-disk1.img2 14 3263 26105625 8e Linux LVM
      Partition 2 has different physical/logical endings:
      phys=(1023, 254, 63) logical=(3262, 254, 63)

      Use "vbox-img" to show "OracleVMManager3-disk2.vmdk",

      [root@ovm303 ovm303-m]# vbox-img info --filename OracleVMManager3-disk2.vmdk
      --- Dumping VD Disk, Images=1
      Dumping VD image "OracleVMManager3-disk2.vmdk" (Backend=VMDK)
      Header: Geometry PCHS=16383/16/63 LCHS=1024/255/63 cbSector=20971520
      Header: uuidCreation={abc43be0-7a43-4ba2-a205-eaf37184a4d3}
      Header: uuidModification={00000000-0000-0000-0000-000000000000}
      Header: uuidParent={00000000-0000-0000-0000-000000000000}
      Header: uuidParentModification={00000000-0000-0000-0000-000000000000}

      Convert "OracleVMManager3-disk2.vmdk" to RAW,

      [root@ovm303 ovm303-m]# vbox-img convert srcfilename OracleVMManager3-disk2.vmdk dstfilename OracleVMManager3-disk2.img srcformat VMDK dstformat RAW
      Converting image "OracleVMManager3-disk2.vmdk" with size 10737418240 bytes (10240MB)...

      [root@ovm303 ovm303-m]# file OracleVMManager3-disk2.img
      OracleVMManager3-disk2.img: x86 boot sector; partition 1: ID=0x83, starthead 1, startsector 63, 20964762 sectors, extended partition table (last)\011

      [root@ovm303 ovm303-m]# fdisk -l OracleVMManager3-disk2.img
      last_lba(): I don't know how to handle files with mode 8180
      You must set cylinders.
      You can do this from the extra functions menu.

      Disk OracleVMManager3-disk2.img: 0 MB, 0 bytes
      255 heads, 63 sectors/track, 0 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes

      Device Boot Start End Blocks Id System
      OracleVMManager3-disk2.img1 1 1305 10482381 83 Linux
      Partition 1 has different physical/logical endings:
      phys=(1023, 254, 63) logical=(1304, 254, 63)

      Update disk image "/boot" configuration using loopback mount,

      [root@ovm303 ovm303-m]# mkdir boot

      [root@ovm303 ovm303-m]# kpartx -l OracleVMManager3-disk1.img
      loop1p1 : 0 208782 /dev/loop1 63
      loop1p2 : 0 52211250 /dev/loop1 208845
      loop deleted : /dev/loop1

      [root@ovm303 ovm303-m]# kpartx -a OracleVMManager3-disk1.img

      [root@ovm303 ovm303-m]# mount /dev/mapper/loop1p1 boot

      Update "/boot/grub/device.map",

      [root@ovm303 ovm303-m]# cat boot/grub/device.map
      # this device map was generated by anaconda
      (hd0) /dev/hda

      Update "/boot/grub/grub.conf" to use non-UEK kernel to avoid issues with OL5u7 default UEK boot and HVM,

      [root@ovm303 ovm303-m]# grep default boot/grub/grub.conf
      default=1

      Mount "/" logical volume,

      [root@ovm303 ovm303-m]# vgscan
      Reading all physical volumes. This may take a while...
      Found volume group "VolGroup00" using metadata type lvm2

      [root@ovm303 ovm303-m]# vgchange -ay VolGroup00
      2 logical volume(s) in volume group "VolGroup00" now active

      [root@ovm303 ovm303-m]# lvs
      LV VG Attr LSize Origin Snap% Move Log Copy% Convert
      LogVol00 VolGroup00 -wi-a- 19.06G
      LogVol01 VolGroup00 -wi-a- 5.81G

      [root@ovm303 ovm303-m]# mkdir root

      [root@ovm303 ovm303-m]# ls /dev/VolGroup00/
      LogVol00 LogVol01

      [root@ovm303 ovm303-m]# mount /dev/VolGroup00/LogVol00 root

      Update "/etc/inittab" to boot single user,

      [root@ovm303 ovm303-m]# grep id root/etc/inittab
      id:1:initdefault:

      Update "/etc/fstab" to ignore "/u01" block device mount,

      [root@ovm303 ovm303-m]# grep sdb root/etc/fstab
      #/dev/sdb1 /u01 ext3 defaults 1 1

      Unmount "/boot" and "/",

      [root@ovm303 ovm303-m]# umount boot

      [root@ovm303 ovm303-m]# umount root

      [root@ovm303 ovm303-m]# vgchange -an VolGroup00
      0 logical volume(s) in volume group "VolGroup00" now active

      [root@ovm303 ovm303-m]# kpartx -d OracleVMManager3-disk1.img
      loop deleted : /dev/loop1

      The OVM 3.0.3 network bridge configuration uses "bond0" vs "xenbr0".

      Configure "vm.cfg",

      [root@ovm303 ovm303-m]# cat vm.cfg
      # (H)ardware (V)irtual (M)achine configuration
      #
      # /etc/xen/xmexample.hvm
      #
      kernel = 'hvmloader'
      builder = 'hvm'
      memory = '4096'

      # The number of cpus guest platform has, default=1
      #vcpus=1

      # PXE boot
      #bootloader = '/usr/bin/pypxeboot'
      #bootloader = '/usr/bin/pygrub'

      # Virtual block device configuration using file:
      #
      # dd if=/dev/zero of=/$VM_PATH/$VM_NAME/System.img bs=1M count=$MB
      #
      # disk = [ 'file:/$VM_PATH/$VM_NAME/System.img,ioemu:hda,w', ]
      #
      # Configuration using physical disk logical volume:
      #
      # lvcreate --size ${GB}G --name $VM_NAME $VG_NAME
      #
      # disk = [ 'phy:/dev/$VG_NAME/$VM_NAME,xvda,w',]
      #
      # CDROM configuration using file:
      #
      # disk = [ 'file:/$BOOT_ISO_NAME,hdc:cdrom,r', ]

      disk = [ 'file:/etc/xen/ovm303-m/OracleVMManager3-disk1.img,ioemu:hda,w', 'file:/etc/xen/ovm303-m/OracleVMManager3-disk2.img,ioemu:hdb,w', ]

      # Domain name
      name = "ovm303-m"

      #
      # Networking
      #
      # Network bridge status:
      #
      # /etc/xen/scripts/network-bridge status
      #
      # 'bridge' should be proper interface e.g. xenbr0
      #
      vif = ['type=ioemu, bridge=bond0']

      #-----------------------------------------------------------------------------
      # boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
      # default: hard disk, cd-rom, floppy
      boot = "cdn"

      #
      # Enable HV VNC console
      #
      # Uses avaiablle next VNC port $OVM_SERVER_HOST:0 == 5900, :1 == 5901 etc
      #
      # Use "xm list -l" to determince VNC port "location"
      #
      vnc=1
      vncunused=1
      vnclisten="0.0.0.0"
      vncpasswd=''

      sdl=0

      #
      # Set the real time clock to local time [default=0 i.e. set to utc]
      #
      # Allows Win VM clock to work with UTC on OVM host system.
      #
      #localtime=1

      Start VM,

      [root@ovm303 ovm303-m]# xm create vm.cfg
      Using config file "./vm.cfg".
      Error: Device 0 (vif) could not be connected. Hotplug scripts not working.

      Current bridge,

      [root@ovm303 ~]# brctl show
      bridge name bridge id STP enabled interfaces

      Update "/etc/xen/xend-config.sxp" to enable "network-bridge",

      [root@ovm303 ovm303-m]# cp /etc/xen/xend-config.sxp /etc/xen/xend-config.sxp.orig

      [root@ovm303 ovm303-m]# diff /etc/xen/xend-config.sxp /etc/xen/xend-config.sxp.orig
      165,167d164
      < # Enable network-bridge, JAP 20120322
      < (network-script network-bridge)
      <

      [root@ovm303 ~]# service xend restart
      Restarting xend...
      xend daemon (pid 8848) is running...

      [root@ovm303 ~]# brctl show
      bridge name bridge id STP enabled interfaces
      bond0 8000.002128d5ce86 no pbond0

      Start VM,

      [root@ovm303 ovm303-m]# xm create vm.cfg
      Using config file "./vm.cfg".
      Started domain ovm303-m (id=1)

      Determine VNC console session,

      [root@ovm303 ovm303-m]# xm list -l ovm303-m | grep location
      (location 0.0.0.0:5900)
      (location 3)

      VNC console session. The "oraclevm-template" tools are not run in single user so hostname is "localhost",

      [root@localhost ~]# who -r
      run-level S 2012-03-23 09:09 last=1

      Update "/etc/fstab" for "/u01" mount to use label,

      [root@localhost ~]# grep /u01 /etc/fstab
      #/dev/sdb1 /u01 ext3 defaults 1 1

      [root@localhost ~]# blkid
      /dev/mapper/VolGroup00-LogVol01: TYPE="swap"
      /dev/mapper/VolGroup00-LogVol00: UUID="2751f1b2-836b-4786-ae71-8b402e0f8503" TYPE="ext3"
      /dev/VolGroup00/LogVol00: UUID="2751f1b2-836b-4786-ae71-8b402e0f8503" SEC_TYPE="ext2" TYPE="ext3"
      /dev/VolGroup00/LogVol01: TYPE="swap"
      /dev/hda1: LABEL="/boot" UUID="8701866e-5ed5-49f7-9597-bb9709d22359" TYPE="ext3"
      /dev/hdb1: UUID="5f9a7bef-3a6d-4a83-b288-638537424fa7" SEC_TYPE="ext2" TYPE="ext3"

      [root@localhost ~]# e2label /dev/hdb1 u01

      [root@localhost ~]# grep u01 /etc/fstab
      LABEL=u01 /u01 ext3 defaults 1 1

      [root@localhost ~]# mount /u01

      [root@localhost ~]# df /u01
      Filesystem 1K-blocks Used Available Use% Mounted on
      /dev/hdb1 10317828 4250832 5542880 44% /u01

      As configured the default run level will be elevated to "5" by the "/etc/rc.local" script. This enables a
      console desktop for user "ovm". This is unneeded and will be implemented by VNC session for user
      "ovm".

      Update "/etc/inittab" to enable full multiuser mode run level 3,

      [root@localhost ~]# grep id /etc/inittab
      id:3:initdefault:

      Disable "/etc/rc.local" run level elevation,

      [root@localhost ~]# tail -2 /etc/rc.local
      # Disable local forced runlevel 5, JAP 20120404
      #telinit 5

      Disable firewall to allow VNC connections,

      [root@localhost ~]# chkconfig --list iptables
      iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

      [root@localhost ~]# chkconfig iptables off

      [root@localhost ~]# chkconfig --list ip6tables
      ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

      [root@localhost ~]# chkconfig ip6tables off

      Reboot,

      [root@localhost ~]# reboot

      Broadcast message from root (pts/0) (Mon Apr 2 09:22:17 2012):

      The system is going down for reboot NOW!

      Post "oraclevm-template" configuration e.g. defining FQDN and static IP addresss etc. OVM Manager 3.0.3 is up.

      Configure VNC for "ovm",

      [root@ovm303-m ~]# su - ovm

      [ovm@ovm303-m ~]$ vncserver

      You will require a password to access your desktops.

      Password: Welcome1
      Verify: Welcome1
      xauth: creating new authority file /home/ovm/.Xauthority

      New 'ovm303-m:1 (ovm)' desktop is ovm303-m:1

      Creating default startup script /home/ovm/.vnc/xstartup
      Starting applications specified in /home/ovm/.vnc/xstartup
      Log file is /home/ovm/.vnc/ovm303-m:1.log

      [ovm@ovm303-m ~]$ vncserver -kill :1
      Killing Xvnc process ID 12499

      Update "xstartup",

      [ovm@ovm303-m ~]$ cat /home/ovm/.vnc/xstartup
      #!/bin/sh

      # Uncomment the following two lines for normal desktop:
      unset SESSION_MANAGER
      exec /etc/X11/xinit/xinitrc

      #[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
      #[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
      #xsetroot -solid grey
      #vncconfig -iconic &
      #xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
      #twm &

      [ovm@ovm303-m ~]$ vncserver

      New 'ovm303-m:1 (ovm)' desktop is ovm303-m :1

      Starting applications specified in /home/ovm/.vnc/xstartup
      Log file is /home/ovm/.vnc/ovm303-m:1.log

      Configure "/etc/sysconfig/vncservers",

      [root@ovm303-m ~]# chkconfig --list vncserver
      vncserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off

      [root@ovm303-m ~]# chkconfig vncserver on

      [root@ovm303-m ~]# chkconfig --list vncserver
      vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off

      [root@ovm303-m ~]# tail -2 /etc/sysconfig/vncservers
      # Start VNC session for ovm, JAP 20120404
      VNCSERVERS="1:ovm"