Browse code

Merge branch 'master' of git.schokokeks.org:zfs-sync

Lorenz Hüdepohl authored on 10/11/2017 00:32:11
Showing 1 changed files
... ...
@@ -38,6 +38,9 @@ parser.add_argument('-c', '--cache-dir', metavar="DIR",
38 38
 parser.add_argument('-m', '--min-cache-size',
39 39
                     help='Minimum (estimated) size of stream to use the cache-dir funcitonality, default 50M')
40 40
 
41
+parser.add_argument('-z', '--compression', action="store_true",
42
+                    help='Filter network streams through gzip/gunzip')
43
+
41 44
 parser.add_argument('-v', '--verbose', action="append_const", const=1,
42 45
                     help='Echo the commands that are issued. Two -v pass a -v along to the zfs send/recv commands')
43 46
 
... ...
@@ -96,8 +99,6 @@ def prefix_ssh(location):
96 99
 ssh_dest, dest_host, destination = prefix_ssh(args.destination)
97 100
 ssh_orig, orig_host, origin = prefix_ssh(args.origin)
98 101
 
99
-compression = ssh_orig or ssh_dest
100
-
101 102
 if args.cache_dir:
102 103
     if ":" in args.cache_dir:
103 104
         orig_cache_dir, dest_cache_dir = args.cache_dir.split(":")
... ...
@@ -274,12 +275,12 @@ for fs, snapname in origin_snapshots:
274 275
         orig_url = ((orig_host + ":") if orig_host else "") + orig_cache_filename
275 276
         dest_url = ((dest_host + ":") if dest_host else "") + dest_cache_filename
276 277
 
277
-    if compression:
278
+    if args.compression:
278 279
         send_cmd += ["|", "gzip"]
279 280
     if use_cache_dir:
280 281
         send_cmd += [">", orig_cache_filename]
281 282
 
282
-    if compression:
283
+    if args.compression:
283 284
         pre_pipe = ["gunzip", "|"]
284 285
     else:
285 286
         pre_pipe = []