Tuesday 30 May 2017

Automatically backup VIOS configuration changes

Automatically backup VIOS configuration changes


The latest release of the VIOS provides a way to automatically backup your virtual device configuration whenever it changes. From the IBM Knowledge Center for POWER8:


"The viosbr command automatically creates a backup, whenever there are any configuration changes. This functionality is known as the autoviosbr backup. It is triggered every hour, and checks if there are any configuration changes, or any other changes. If it detects any changes, a backup is created. Otherwise, no action is taken. The backup files resulting from the autoviosbr backup are located under the default path /home/padmin/cfgbackups with the names autoviosbr_SSP.<cluster_name>.tar.gz for cluster level and autoviosbr_<hostname>.tar.gz for node level. The cluster-level backup file is present only in the default path of the database node.

The -autobackup flag is provided for the autoviosbr backup functionality. By default, autoviosbr backup is enabled on the system. To disable the autoviosbr backup, use the stop parameter and to enable it you can use the start parameter. When the autoviosbr backupis disabled, no autoviosbr related tar.gz file is generated.

To check if the autoviosbr backup file, present in the default path is up to date, you can use the status parameter. To access the cluster-level backup file on any node of the cluster, use the save parameter. This action is necessary as the cluster-level backup file is present in the default path of the database node only.

If the node is a part of cluster, you can use the -type flag to specify the parameter. The parameter can be either cluster or node, depending on if it is a cluster-level or a node-level backup.
Flags""

On your VIOS, under oem_setup_env (as root), you'll find the following new entry in root's crontab:

# crontab -l | grep autoviosbr
0 * * * * /usr/ios/sbin/autoviosbr -start 1>/dev/null 2>/dev/null

This entry will check for any configuration changes and generate a new backup if necessary. Here's an example from my VIOS, running 2.2.5.10.

$ ioslevel
2.2.5.10

I create a new virtual optical device, which should trigger a new backup the next time the autoviosbr script runs (once per hour). Prior to creating the device, viosbr shows the autobackup status as Complete (no changes). I ensure that autobackup is configured by stopping and starting it with the viosbr command.

$ viosbr -autobackup stop -type node
Autobackup stopped successfully.

$ viosbr -autobackup start -type node
Autobackup started successfully.

$ viosbr -autobackup status -type node
Node configuration changes:Complete.

$ mkvdev -fbo -vadapter vhost34
vtopt13 Available

Immediately after the vtopt device is created, the autobackup status displays as Pending (something has changed but has not yet been backed up).

$ viosbr -autobackup status -type node
Node configuration changes:Pending.

The autoviosbr file is created in /home/padmin/cfgbackups.

$ r oem
oem_setup_env

# cd /home/padmin/cfgbackups
# ls -tlr
total 72
-rw-r--r--    1 root     staff         12189 May 10 14:00 autoviosbr_s824vio2.tar.gz

On the hour, the autoviosbr script runs, notices that the configuration has changed and generates a new viosbr backup file. The viosbr autobackup status changes to Complete.

$ viosbr -autobackup status -type node
Node configuration changes:Complete.

# ls -ltr
total 88
-rw-r--r--    1 root     staff         12218 May 10 15:00 autoviosbr_s824vio2.tar.gz

What's inside the tar file?

# cp /home/padmin/cfgbackups/autoviosbr_s824vio2.tar.gz /tmp/cg/
# cd /tmp/cg
# gzip -d autoviosbr_s824vio2.tar.gz
# tar -xvf autoviosbr_s824vio2.tar
x ArtexRules_MTM8286-42A02214F58VP2.xml, 20549 bytes, 41 media blocks.
x autoviosbr_s824vio2, 198554 bytes, 388 media blocks.
# ls -ltr
total 888
-rw-r--r--   1 root staff  198554 May 10 15:00 autoviosbr_s824vio2
-rw-r--r--   1 root staff  20549 May 10 15:00 ArtexRules_MTM8286-42A02214F58VP2.xml
-rw-r--r--   1 root staff  225280 May 10 15:00 autoviosbr_s824vio2.tar

The ArtexRules file contains device specific configuration attributes.

# head ArtexRules_MTM8286-42A02214F58VP2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Profile origin="get" version="3.0.0" date="2017-05-10T04:10:54Z">
 <Catalog id="devParam.disk.fcp.mpioosdisk" version="3.0">
  <Parameter name="reserve_policy" value="single_path" applyType="nextboot" reboot="true">
   <Target class="device" instance="disk/fcp/mpioosdisk"/>
  </Parameter>
 </Catalog>
 <Catalog id="devParam.disk.fcp.mpioapdisk" version="3.0">
  <Parameter name="reserve_policy" value="single_path" applyType="nextboot" reboot="true">
   <Target class="device" instance="disk/fcp/mpioapdisk"/>
#

The autoviosbr file contains virtual device configuration information. In this file I can confirm that the configuration of my new virtual optical device (vtopt13) has been backed up.

# grep vtopt13 autoviosbr_s824vio2
                <name>vtopt13</name>
                        <vtdName>vtopt13</vtdName>
                        <value>vtopt13</value>
                                          
# vi autoviosbr_s824vio2
...
        <virtDevOPT>
                <name>vtopt13</name>
                <state>AVAILABLE</state>
                <locCode>U8286.42A.214F58V-V2-C101-L2</locCode>
                <unique_type>virtual_target/vtdev/fbopt</unique_type>
                <type>BDOPFBOPT</type>
                <fbOpt>
                </fbOpt>
                <CuAtcount>2</CuAtcount>
                <CuAt name="LogicalUnitAddr" value="0x8200000000000000" action="FALSE" />
                <CuAt name="udid" value="19cc3cb76ad94674c3" action="TRUE" />
        </virtDevOPT>
...

If you want to force a backup to run, before the next hour, manually run the following as root (oem_setup_env):

$ oem_setup_env
# /usr/ios/sbin/autoviosbr -start

No comments:

Post a Comment