Merge pull request #239 from phreaker0/exclude
support excluding datasets from replication with a regular expression
This commit is contained in:
commit
e718dcd806
|
@ -150,6 +150,10 @@ As of 1.4.18, syncoid also automatically supports and enables resume of interrup
|
||||||
|
|
||||||
This argument tells syncoid to restrict itself to existing snapshots, instead of creating a semi-ephemeral syncoid snapshot at execution time. Especially useful in multi-target (A->B, A->C) replication schemes, where you might otherwise accumulate a large number of foreign syncoid snapshots.
|
This argument tells syncoid to restrict itself to existing snapshots, instead of creating a semi-ephemeral syncoid snapshot at execution time. Especially useful in multi-target (A->B, A->C) replication schemes, where you might otherwise accumulate a large number of foreign syncoid snapshots.
|
||||||
|
|
||||||
|
+ --exclude=REGEX
|
||||||
|
|
||||||
|
The given regular expression will be matched against all datasets which would be synced by this run and excludes them. This argument can be specified multiple times.
|
||||||
|
|
||||||
+ --no-resume
|
+ --no-resume
|
||||||
|
|
||||||
This argument tells syncoid to not use resumeable zfs send/receive streams.
|
This argument tells syncoid to not use resumeable zfs send/receive streams.
|
||||||
|
|
17
syncoid
17
syncoid
|
@ -19,7 +19,7 @@ use Sys::Hostname;
|
||||||
my %args = ('sshkey' => '', 'sshport' => '', 'sshcipher' => '', 'sshoption' => [], 'target-bwlimit' => '', 'source-bwlimit' => '');
|
my %args = ('sshkey' => '', 'sshport' => '', 'sshcipher' => '', 'sshoption' => [], 'target-bwlimit' => '', 'source-bwlimit' => '');
|
||||||
GetOptions(\%args, "no-command-checks", "monitor-version", "compress=s", "dumpsnaps", "recursive|r",
|
GetOptions(\%args, "no-command-checks", "monitor-version", "compress=s", "dumpsnaps", "recursive|r",
|
||||||
"source-bwlimit=s", "target-bwlimit=s", "sshkey=s", "sshport=i", "sshcipher|c=s", "sshoption|o=s@",
|
"source-bwlimit=s", "target-bwlimit=s", "sshkey=s", "sshport=i", "sshcipher|c=s", "sshoption|o=s@",
|
||||||
"debug", "quiet", "no-stream", "no-sync-snap", "no-resume") or pod2usage(2);
|
"debug", "quiet", "no-stream", "no-sync-snap", "no-resume", "exclude=s@") or pod2usage(2);
|
||||||
|
|
||||||
my %compressargs = %{compressargset($args{'compress'} || 'default')}; # Can't be done with GetOptions arg, as default still needs to be set
|
my %compressargs = %{compressargset($args{'compress'} || 'default')}; # Can't be done with GetOptions arg, as default still needs to be set
|
||||||
|
|
||||||
|
@ -141,6 +141,20 @@ sub getchilddatasets {
|
||||||
my @children = <FH>;
|
my @children = <FH>;
|
||||||
close FH;
|
close FH;
|
||||||
|
|
||||||
|
if (defined $args{'exclude'}) {
|
||||||
|
my $excludes = $args{'exclude'};
|
||||||
|
foreach (@$excludes) {
|
||||||
|
for my $i ( 0 .. $#children ) {
|
||||||
|
if ($children[$i] =~ /$_/) {
|
||||||
|
if ($debug) { print "DEBUG: excluded $children[$i] because of $_\n"; }
|
||||||
|
undef $children[$i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@children = grep{ defined }@children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return @children;
|
return @children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1141,6 +1155,7 @@ Options:
|
||||||
--target-bwlimit=<limit k|m|g|t> Bandwidth limit on the target transfer
|
--target-bwlimit=<limit k|m|g|t> Bandwidth limit on the target transfer
|
||||||
--no-stream Replicates using newest snapshot instead of intermediates
|
--no-stream Replicates using newest snapshot instead of intermediates
|
||||||
--no-sync-snap Does not create new snapshot, only transfers existing
|
--no-sync-snap Does not create new snapshot, only transfers existing
|
||||||
|
--exclude=REGEX Exclude specific datasets which match the given regular expression. Can be specified multiple times
|
||||||
|
|
||||||
--sshkey=FILE Specifies a ssh public key to use to connect
|
--sshkey=FILE Specifies a ssh public key to use to connect
|
||||||
--sshport=PORT Connects to remote on a particular port
|
--sshport=PORT Connects to remote on a particular port
|
||||||
|
|
Loading…
Reference in New Issue