Changeset 5e79e4c037fae3b96d716a9266b75fd6685ea404

Show
Ignore:
Timestamp:
02/26/07 20:42:02 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1172522522 +0000
git-parent:

[52c8f50e2f7095ebfcaf92b28a3e9761cc4aefce]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1172522522 +0000
Message:

integrate the recv feature into the agent. If the target host isn't in the
configuration, we will fallback to using /usr/sbin/zfs.

closes #1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • zetaback

    r52c8f50 r5e79e4c  
    341341sub zfs_restore_part($$$) { 
    342342  my ($host, $fs, $file) = @_; 
     343  my $command; 
     344  if(exists($conf{$host})) { 
     345    my $agent = config_get($host, 'agent'); 
     346    $command = "$agent -r -z $fs"; 
     347  } 
     348  else { 
     349    $command = "/usr/sbin/zfs recv $fs"; 
     350  } 
    343351  open(DUMP, "gzip -dfc $file |"); 
    344352  eval { 
    345     open(RECEIVER, "| ssh $host /sbin/zfs recv $fs"); 
     353    open(RECEIVER, "| ssh $host $command"); 
    346354    my $buffer; 
    347355    while(my $len = sysread(DUMP, $buffer, $BLOCKSIZE)) { 
  • zetaback_agent

    re57012c r5e79e4c  
    77my %conf; 
    88my $CONF = q^/etc/zetaback_agent.conf^; 
    9 use vars qw/$LIST $FULL $SNAP $ZFS $BASE/; 
     9use vars qw/$LIST $FULL $SNAP $ZFS $BASE $RESTORE/; 
    1010 
    1111GetOptions( 
    1212  "c=s" => \$CONF, 
    1313  "l"   => \$LIST, 
     14  "r"   => \$RESTORE, 
    1415  "z=s" => \$ZFS, 
    1516  "d=s" => \$SNAP, 
     
    8283} 
    8384 
     85sub zfs_agent_perform_restore { 
     86  my $fs = $ZFS; 
     87  unless($ZFS && $RESTORE) { 
     88    die "zfs_agent_perform_restore: bad state\n"; 
     89  } 
     90  my @cmd = ("/usr/sbin/zfs", "recv", $fs); 
     91  exec { $cmd[0] } @cmd; 
     92  exit; 
     93} 
     94 
    8495if($LIST) { zfs_agent_list(); exit; } 
    8596if($ZFS && $SNAP) { zfs_agent_remove_snap(); exit; } 
    8697if($ZFS && $FULL) { zfs_agent_perform_full(); exit; } 
    8798if($ZFS && $BASE) { zfs_agent_perform_incremental(); exit; } 
     99if($ZFS && $RESTORE) { zfs_agent_perform_restore(); exit; }