Solved

Oracle OVM Virtual Machine Backup script help

Posted on 2014-04-11
6
1,939 Views
Last Modified: 2014-04-22
First off you have to understand I just inherited a Oracle OVM environment. I am more of a VMware ESXi guy so I know how ESXi operates. I was recently told (yesterday) that we do not have a backup and restore solution in place for the Oracle environment, so this includes the Oracle OVM manager environment, several production and non-production VMs as well as our Oracle OEM environment which is currently configured as an Oracle VM.

So until a real Certified Oracle backup software solution can be found and purchased, I need help designing a backup script for handing our Oracle OVM environment virtual machines.

1) Extract from remote OVM server the following information:
    A) OVM_Simple_Name (VM Name) from the /OVS/Repositories/*/VirtualMachines/*/vm.cfg file.
        a) The '*' is a unique identifier (directory mapping) and virtual guest.
    B) OVS Repository Base Directory Mapping as seen via 'ls -l'.
        a) Example: /OVS/Repositories/[THIS FIELD HERE]/VirtualMachines/0004fb00000600008325ba01bbe2760e/vm.cfg
    C) OVS Repository Virtual Machine Mapped Directory
        a) Example: /OVS/Repositories/0004fb0000030000821c5840499bb505/VirtualMachines/[THIS FIELD HERE]/vm.cfg
    D) The actual virtual disk(s) paired to the Virtual Machine in the vm.cfg file
        a) ['file:/OVS/Repositories/0004fb0000030000821c5840499bb505/VirtualDisks/[THIS FIELD HERE].img,xvda,w']


2) Take all of the above information and plug it into a self-cleaning backup script

    A) Create the $SCRIPT_HOME/VMBackup/backup.sh file
    B) Plug in the variables from #1 above into special 'scp' format
      a) scp "$OVM_SERVER_ADDRESS:/OVS/Repositories/[Mapped Directory]/VirtualDisks/[VM Directory FIELD]/vm*.img" /u01/backup/VMBackups/[VM Name]/$3.img
    C) Change the permissions for the $SCRIPT_HOME/VMBackup/backup.sh file
    D) Execute the $SCRIPT_HOME/VMBackup/backup.sh file
    E) Remove the $SCRIPT_HOME/VMBackup/backup.sh file

Since I am trying to do this in pieces (for my understanding), I need help on the Part 1 piece.

So far I have been able to get part of section 1A done. Just need to clean it up to just show the OVM_simple_name as a single string (to be used by the backup script to create the directory and direct the backup img files there once created).

find /OVS/Repositories/*/VirtualMachines/*/vm.cfg -print -exec grep OVM_simple_name {} \;

RETURNS:
/OVS/Repositories/0004fb0000030000821c5840499bb505/VirtualMachines/0004fb00000600008325ba01bbe2760e/vm.cfg
OVM_simple_name = 'jxappadmq002'


For Part 1B, I can see the disk structure, just can't figure out how to separate the individual disks and exclude cdrom:

find /OVS/Repositories/*/VirtualMachines/*/vm.cfg -print -exec grep disk {} \; | awk '{print $3 $4;}'

EXAMPLES...

Single XVDA File EXAMPLE tied to one OVM_Simple_Name:
['file:/OVS/Repositories/0004fb0000030000821c5840499bb505/VirtualDisks/0004fb00001200003fe23103dc82d3a1.img,xvda,w']

Multiple XVD? File EXAMPLE tied to one OVM_Simple_Name:
disk = ['file:/OVS/Repositories/0004fb0000030000cae72a692fd2ee21/VirtualDisks/0004fb000012000050472217c569152a.img,xvda,w', 'file:/OVS/Repositories/0004fb0000030000cae72a692fd2ee21/VirtualDisks/0004fb00001200005d5cd7e82ab81fff.img,xvdb,w', ',xvdc:cdrom,r']

And that's as far as I have gotten.

Here's an example of a vm.cfg file that I am trying to extract all of the data variables from:
vif = ['mac=00:21:f6:01:00:04,bridge=10c3a851b1', 'mac=00:21:f6:01:00:05,bridge=10c3a851b1']
OVM_simple_name = 'jxappvtxq001'
disk = ['file:/OVS/Repositories/0004fb0000030000cae72a692fd2ee21/VirtualDisks/0004fb0000120000ac64aa852f59979a.img,xvda,w', 'file:/OVS/Repositories/0004fb0000030000cae72a692fd2ee21/VirtualDisks/0004fb0000120000bbf0792baf175fa3.img,xvdb,w']
bootargs = ''
uuid = '0004fb00-0006-0000-262b-2ab85dc66b61'
on_reboot = 'restart'
cpu_weight = 27500
OVM_os_type = 'Oracle Linux 5'
cpu_cap = 0
maxvcpus = 2
OVM_high_availability = False
memory = 4096
OVM_description = ''
on_poweroff = 'destroy'
on_crash = 'restart'
bootloader = '/usr/bin/pygrub'
guest_os_type = 'linux'
name = '0004fb0000060000262b2ab85dc66b61'
vfb = ['type=vnc,vncunused=1,vnclisten=127.0.0.1,keymap=en-us']
vcpus = 2
OVM_cpu_compat_group = ''
OVM_domain_type = 'xen_pvm'

Open in new window

0
Comment
Question by:Michael W
  • 2
  • 2
  • 2
6 Comments
 
LVL 61

Expert Comment

by:gheist
ID: 39995538
Maybe run data backup inside guests? It must be much easier to manage.
0
 
LVL 26

Assisted Solution

by:skullnobrains
skullnobrains earned 500 total points
ID: 39995907
have a look here
https://blogs.oracle.com/wim/entry/oracle_vm_manager_cli_and_web_1
it is probably much easier to use the cli than grepping in the files and it is more likely that it won't break in the future

vm_info --- Get a VM info (which will include the disk information)
vm_list --- Get a list of VMs

the free ose version has equivalent features using the virtualbox command.
both feature a webservice that can be used to perform some of these tasks over the network.

note that performing an scp of the disk's vm while it is running will produce unpredictable results (but most likely not working ones) so you need to pause, clone, or snapshot the machine if you want to copy the disk's contents

also note that if iscsi disks are mounted inside the guests, ovm does not know about them
0
 
LVL 29

Accepted Solution

by:
Michael W earned 0 total points
ID: 39996087
Problem is that Oracle has either been unwilling or unable to provide a backup solution vendor that is considered "Oracle certified", so I am having to go the route of backing up the OVM as a whole as well as the individual VM images. Problem is that Oracle's Xen throws the virtual disks all over the place and doesn't keep them all in the same directory like VMware ESXi platforms do with datastores.

If it was my option, I would convert all of the Oracle VMs into VMware ESXi OVFs and migrate them over to ESXi. At least Veeam's backup solution works for ESXi platforms.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 26

Expert Comment

by:skullnobrains
ID: 39996188
dunno if that would be an idea. anyway writing your script using these commands should be easier than grepping files all over the place.

if you can export a vm to ovf format, it could be simpler, but i have no idea if this is supported in ovm (i'd assume yes)

if not, you should be able to do something like this

for each vm_list
do
  vm_clone
  vm_list_disk (notice there is a vm_list_cdrom so i'd assume you'll only get hds)
  scp drive
  vm_del clone
done

looks reasonably simple to code
0
 
LVL 61

Expert Comment

by:gheist
ID: 39996410
Please stop bashing oracle and download backup best practices guide (i leave web link to google) and get to work.
0
 
LVL 29

Author Closing Comment

by:Michael W
ID: 40014360
Oracle support would never give us an actual answer for a "certified" backup platform for the OVM environment, so they suck in that regard. So I am going to try the OVM CLI first for the short term needs then work on converting the OVM actual VMs over to ESXi VM format. We discovered that Symantec's Backup EXEC universal client for Linux platforms can actually be used on the Oracle VM instances then through the GUI, do a restore of the data profile on an ESXi VM so we won't have to do V2V conversions.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Fine Tune your automatic Updates for Ubuntu / Debian
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now