Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Oracle OVM Virtual Machine Backup script help

Posted on 2014-04-11
6
Medium Priority
?
2,159 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 Worsham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 62

Expert Comment

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

Assisted Solution

by:skullnobrains
skullnobrains earned 1500 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 Worsham 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 27

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 62

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 Worsham
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

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

664 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