Tuesday, November 30, 2010

Using Oracle OVM templates in VMware

I was looking through several of Oracle's pre-built OVM templates - whole working virtual environments of many of Oracle's products. I would like to use these templates as a starting point for some work I am doing, but need to use it in VMware, so the question is, how do I do it.

I started looking around and it appears that because OVM is based on XEN, there are some options. Below are the steps I took to open the templates and access the data from a Linux machine.
  1. Download the templates from http://edelivery.oracle.com/EPD/GetUserInfo/get_form?caller=LinuxWelcome (make sure you get all the downloads needed for an environment)
  2. Copy the zip files to a linux environment
    1. ensure the Linux system has qemu-img installed (run qemu-img --help to confirm)
  3. Unzip the files (unzip V21365-01.zip), repeat for each file
    1. NOTE: You can delete the original zip files once completed
  4. Combine and extract the multi-part files (cat E1_ENT_898.3.1_X86_64.tar.bz2.part.* | tar -xjvf -)
    1. NOTE: You can delete the original bz2.part files once completed
  5. Extract the single files (tar -xjvf E1_HTML_898.3.1_WLS_X86_64.tar.bz2)
    1. NOTE: You can delete the original bz2 files once completed
  6. Convert the *.img files to vmdk files (qemu-img convert -f raw E1_ENT.img -O vmdk E1_ENT.vmdk)
    1. Due to white space consolidation, the vmdk file may be significantly smaller than the img file
    2. NOTE: You can delete the original img files once completed
  7. Copy the vmdk files to a VMware datastore and attach them to a Linux VM
    1. Shutdown the VM and add an existing hard drive
    2. The hard drive will attach as an IDE disk, if this doesnt work in your environment, you can perform a V2V using the VMware converter
  8. Mount the new disk's LVM partition
    1. Confirm the disk and partition is there (fdisk -l /dev/hdb)
    2. As root, execute (vgchange -ay)
    3. Mount the disk (mount /dev/VolGroup01/LogVol00 /root/foo)
  9. Review the setup and configuration files for recreation in your environment
    1. You can now browse the virtual disk and copy any configurations you need
Because the virtual hardware between OVM and VMware is different, I dont believe a direct conversion is possible (unless you have a working OVM environment and attempt an online V2V). This process however should give you access to all configuration and installation steps/options.

NOTE: Your mileage may vary on the effectiveness of these steps. Also, I am not sure of any legal implications or licensing restrictions with regards to these products or downloads, make sure you check your licensing before using these.

Additional information:
Mounting LVM partition: http://www.fedoraforum.org/forum/archive/index.php/t-64964.html
Converting using qemu-img: http://communities.vmware.com/thread/193272, http://wiki.laptop.org/go/VMware/Convert

Monday, November 22, 2010

Removing left-over snapshots

We recently started using Avamar to perform VMDK backups of our VMware environment. This process creates a snapshot of a VM, mounts the snapshot to a backup appliance, backs up the snapshot, and then deletes the snapshot - a fairly decent process.
Unfortunatly, some times it doesnt delete the snapshot, and if you leave them they can cause issues. The snapshots usually have unique names like 'Avamar-12903912904b5c2b7dc3ea83ca7de0f1c7020f6820cd1f5326', not very descriptive, but at least we know they are Avamar snaps.

Powershell to list the snapshots
$snaps = Get-VM | Sort Name | Get-Snapshot | Where { $_.Name -like 'Avamar*' } 
$snaps | Select VM,Name,Description,Created

Powershell to remove the snapshots
foreach($snap in $snaps) 
{
    Remove-Snapshot -snapshot $snap -confirm:$false
}