Changeset ae9700b895f444ba92c6aac759ec8a6d257ae0e3

Show
Ignore:
Timestamp:
02/05/14 20:50:42 (3 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1391633442 -0500
git-parent:

[1208bdf5008961a7d08a63947c42e3eac9b88e33]

git-author:
Mark Harrison <mark@omniti.com> 1391633442 -0500
Message:

Add option to exclude alternate/inactive boot environments from a backup

This option obtains the ID of the currently active boot environment, and then
looks for filesystems eith either the BE uuid or parent BE uuid (for zone
filesystems) zfs properties set. If they are set, but don't match the uuid of
the current boot environment, they are excluded. This option is configurable
in zetaback_agent.conf.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • zetaback_agent.in

    r1208bdf rae9700b  
    148148zetaback_agent with the -l option. 
    149149 
     150=head2 Excluding inactive boot environments 
     151 
     152The zetaback_agent configuration file also has an option to not back up filesystems that are part of an alternate/inactive boot environment. To enable this option, add the following to the configuration file: 
     153 
     154  exclude_inactive_be=1 
     155 
    150156=head1 CONFIGURATION EXAMPLES 
    151157 
     
    189195# Read our config in 
    190196$conf{pattern} = '.'; 
     197$conf{exclude_inactive_be} = '0'; 
    191198open(CONF, "<$CONF"); 
    192199while(<CONF>) { /^\s*([^#](?:\S*)?)\s*=\s*(\S+)/ && ($conf{lc($1)} = $2); } 
     
    263270sub zfs_agent_list { 
    264271  my (%zfs, %storageclass); 
    265   open(ZFSLIST, "__ZFS__ list -H -t snapshot,filesystem,volume -o name,com.omniti.labs.zetaback:exclude,com.omniti.labs.zetaback:class |"); 
     272  open(ZFSLIST, "__ZFS__ list -H -t snapshot,filesystem,volume -o name,com.omniti.labs.zetaback:exclude,com.omniti.labs.zetaback:class,org.opensolaris.libbe:parentbe,org.opensolaris.libbe:uuid |"); 
     273  # Get the UUID (if any) of the current BE, should return blank on systems 
     274  # where beadm isn't present 
     275  my $currentbe = ""; 
     276  if($conf{exclude_inactive_be} eq '1') { 
     277    $currentbe = (split(/;/,`/sbin/beadm list -H 2>&1 | grep ';N'`))[1]; 
     278  } 
    266279  while(<ZFSLIST>) { 
    267280    chomp; 
     
    270283    my $excl = $line[1]; 
    271284    my $class = $line[2]; 
     285    my $parentbe = $line[3]; 
     286    my $beuuid = $line[4]; 
     287    if($conf{exclude_inactive_be} eq '1') { 
     288        next if ($parentbe ne '-' && $parentbe ne $currentbe); 
     289        next if ($beuuid ne '-' && $beuuid ne $currentbe); 
     290    } 
    272291    if(($excl ne "on") && ($fs =~ /$conf{pattern}/)) { 
    273292      if($line[0] =~ /(\S+)\@([^\@]+)$/) {