Subversion Repositories zfs_utils

Rev

Rev 42 | Rev 44 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42 Rev 43
Line 138... Line 138...
138
         'dataset' => 'dataset1', # the dataset name
138
         'dataset' => 'dataset1', # the dataset name
139
      },
139
      },
140
      'files_share'  => {
140
      'files_share'  => {
141
         'source' => 'pool',
141
         'source' => 'pool',
142
         'target' => 'backup',
142
         'target' => 'backup',
143
         'dataset' => 'files_share'.
143
         'dataset' => 'files_share',
144
      },
144
      },
145
   }
145
   }
146
};
146
};
147
 
147
 
148
# read the status file and return as list. If the file doesn't exits, returns an empty list
148
# read the status file and return as list. If the file doesn't exits, returns an empty list
Line 206... Line 206...
206
      my $root = $config->{datasets}->{$dataset}->{source} . '/' . $config->{datasets}->{$dataset}->{dataset};
206
      my $root = $config->{datasets}->{$dataset}->{source} . '/' . $config->{datasets}->{$dataset}->{dataset};
207
      my $sourceList = [ runCmd( "zfs list -rt snap -H -o name $root" ) ];
207
      my $sourceList = [ runCmd( "zfs list -rt snap -H -o name $root" ) ];
208
      # remove the parent part, leave the dataset itself
208
      # remove the parent part, leave the dataset itself
209
      $sourceList =~ s|$config->{datasets}->{$dataset}->{source}/||;
209
      $sourceList =~ s|$config->{datasets}->{$dataset}->{source}/||;
210
      # process dataset here
210
      # process dataset here
211
      my $commands = makeReplicateCommands( $config->{datasets}->{$dataset}->{source}, $sourceList, $statusList, $newStatus );
211
      my $commands = makeReplicateCommands( $sourceList, $statusList, $newStatus );
-
 
212
 
212
      if ( %$commands ) {
213
      if ( %$commands ) {
213
         foreach my $cmd ( keys %$commands ) {
214
         foreach my $cmd ( keys %$commands ) {
214
            my $command = $commands->{$cmd};
215
            my $command = $commands->{$cmd};
-
 
216
            my $outputFile = $cmd;
-
 
217
            $outputFile =~ s/^$root//;
-
 
218
            $outputFile = replaceSlashWithDot($outputFile);
215
            $command .= " | openssl enc -aes-256-cbc -K $config->{transport}->{encryption}->{key} -iv $config->{transport}->{encryption}->{IV} " if $config->{transport}->{encryption}->{key};
219
            #$command .= " | openssl enc -aes-256-cbc -K $config->{transport}->{encryption}->{key} -iv $config->{transport}->{encryption}->{IV} " if $config->{transport}->{encryption}->{key};
216
            $command .= " > $config->{transport}->{mount_point}/" . replaceSlashWithDot($cmd);
220
            $command .= " > $config->{transport}->{mount_point}/" . $outputFile;
217
            logMsg("Running command: $command");
221
            logMsg("Running command: $command");
218
            runCmd(  $command  ) unless $DEBUG;
222
            runCmd(  $command  ) unless $DEBUG;
219
         }
223
         }
220
      } else {
224
      } else {
221
         logMsg( "Nothing to do for $dataset" ); 
225
         logMsg( "Nothing to do for $dataset" );