[Zetaback-devel] [zetaback commit] r175 - branches/sendr

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Wed Mar 2 16:11:29 EST 2011


Author: mark
Date: 2011-03-02 16:11:29 -0500 (Wed, 02 Mar 2011)
New Revision: 175

Modified:
   branches/sendr/zetaback.in
Log:
Only consider topmost dir of a recursive snapshot

This is intended for retention, but applies everywhere backups are scanned.
This means that when looking at backups with -sx and -sv and so on, only the
topmost backup will be seen. Some work on the restore step still needs to be
done and this needs testing.


Modified: branches/sendr/zetaback.in
===================================================================
--- branches/sendr/zetaback.in	2011-03-02 21:08:38 UTC (rev 174)
+++ branches/sendr/zetaback.in	2011-03-02 21:11:29 UTC (rev 175)
@@ -555,6 +555,7 @@
   return \%info if ($@);
   my $rv = open(ZFSLIST, "__ZFS__ list -H -r -t snapshot $storefs |");
   return \%info unless $rv;
+  my $lastfs = '';
   while (<ZFSLIST>) {
       my @F = split(' ');
       my ($rawfs, $snap) = split('@', $F[0]);
@@ -567,6 +568,12 @@
       } else {
         $fs = $rawfs;
         $fs =~ s+$storefs/++;
+        # Skip child filesystems of any snapshots. This relies on the fact
+        # that the filesystem listing is in order
+        if ($lastfs && $fs =~ /^$lastfs/) {
+          next
+        }
+        $lastfs = $fs;
       }
       # Treat a dataset backup as a full backup from the point of view of the
       # backup lists
@@ -961,7 +968,11 @@
         if ($filename) {
           unlink($filename) || print "ERROR: unlink $filename: $?\n";
         } elsif ($dataset) {
-          `__ZFS__ destroy $dataset`;
+          if (config_get($host, 'dataset_recursive') == 1) {
+            `__ZFS__ destroy -r $dataset`;
+          } else {
+            `__ZFS__ destroy $dataset`;
+          }
           if ($?) {
             print "ERROR: zfs destroy $dataset: $?\n";
           }



More information about the Zetaback-devel mailing list