]> git.proxmox.com Git - pve-zsync.git/commitdiff
Fix #1381: add flag allowing one to send zfs properties
authorWolfgang Link <w.link@proxmox.com>
Wed, 6 Mar 2019 14:43:42 +0000 (15:43 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Mar 2019 11:04:08 +0000 (12:04 +0100)
Add properties flag for including the properties in the send stream.

With the flag, we do not break the current behavior and give the user
who like to sync their properties the possibility to do so.

Signed-off-by: Wolfgang Link <w.link@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
pve-zsync

index fa7fc37f68b1a6def607e066587c734a1708dd60..1d868e13e054d4a0aa21a37757879717ea3905eb 100755 (executable)
--- a/pve-zsync
+++ b/pve-zsync
@@ -212,6 +212,7 @@ sub parse_argv {
        method => undef,
        source_user => undef,
        dest_user => undef,
+       properties => undef,
     };
 
     my ($ret) = GetOptionsFromArray(
@@ -225,7 +226,8 @@ sub parse_argv {
        'skip' => \$param->{skip},
        'method=s' => \$param->{method},
        'source-user=s' => \$param->{source_user},
-       'dest-user=s' => \$param->{dest_user}
+       'dest-user=s' => \$param->{dest_user},
+       'properties' => \$param->{properties},
     );
 
     die "can't parse options\n" if $ret == 0;
@@ -294,6 +296,7 @@ sub param_to_job {
     $job->{source} = $param->{source};
     $job->{source_user} = $param->{source_user};
     $job->{dest_user} = $param->{dest_user};
+    $job->{properties} = $param->{properties} ? $param->{properties} : 0;
 
     return $job;
 }
@@ -439,6 +442,7 @@ sub format_job {
     $text .= " --verbose" if $job->{verbose};
     $text .= " --source-user $job->{source_user}";
     $text .= " --dest-user $job->{dest_user}";
+    $text .= " --properties $job->{properties}" if $job->{properties};
     $text .= "\n";
 
     return $text;
@@ -919,6 +923,7 @@ sub send_image {
 
     push @$cmd, 'ssh', '-o', 'BatchMode=yes', "$param->{source_user}\@$source->{ip}", '--' if $source->{ip};
     push @$cmd, 'zfs', 'send';
+    push @$cmd, '-p', if $param->{properties};
     push @$cmd, '-v' if $param->{verbose};
 
     if($source->{last_snap} && snapshot_exist($source , $dest, $param->{method}, $param->{dest_user})) {
@@ -1079,6 +1084,10 @@ $PROGNAME create -dest <string> -source <string> [OPTIONS]
         -source-user    string
 
                name of the user on the source target, root by default
+
+       -properties     boolean
+
+               Include the dataset's properties in the stream.
     },
     sync => qq{
 $PROGNAME sync -dest <string> -source <string> [OPTIONS]\n
@@ -1117,6 +1126,10 @@ $PROGNAME sync -dest <string> -source <string> [OPTIONS]\n
        -verbose   boolean
 
                print out the sync progress.
+
+       -properties     boolean
+
+               Include the dataset's properties in the stream.
     },
     list => qq{
 $PROGNAME list