all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-zsync] close #1824: add 'compressed' option enabling -c and -L for send
@ 2022-05-10 11:19 Fabian Ebner
  2022-05-12 15:16 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2022-05-10 11:19 UTC (permalink / raw)
  To: pve-devel

If one of the features lz4_compress, zstd_compress or large_blocks is
actively used/required by the source dataset, but not enabled on the
destination, zfs send/recv will fail and recommend upgrading the pool.

It's not required that the target dataset is also compressed.
Specifying '--properties' to have the target inherit the compression
property even works during later syncs (but pre-existing data won't be
recompressed automatically then).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

Put it near 'properties' as I felt like that was the most similar one.

 pve-zsync | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/pve-zsync b/pve-zsync
index 46b0ba7..98190b2 100755
--- a/pve-zsync
+++ b/pve-zsync
@@ -252,6 +252,7 @@ sub parse_argv {
 	source_user => undef,
 	dest_user => undef,
 	prepend_storage_id => undef,
+	compressed => undef,
 	properties => undef,
 	dest_config_path => undef,
     };
@@ -270,6 +271,7 @@ sub parse_argv {
 	'source-user=s' => \$param->{source_user},
 	'dest-user=s' => \$param->{dest_user},
 	'prepend-storage-id' => \$param->{prepend_storage_id},
+	'compressed' => \$param->{compressed},
 	'properties' => \$param->{properties},
 	'dest-config-path=s' => \$param->{dest_config_path},
     );
@@ -343,6 +345,7 @@ sub param_to_job {
     $job->{source_user} = $param->{source_user};
     $job->{dest_user} = $param->{dest_user};
     $job->{prepend_storage_id} = !!$param->{prepend_storage_id};
+    $job->{compressed} = !!$param->{compressed};
     $job->{properties} = !!$param->{properties};
     $job->{dest_config_path} = $param->{dest_config_path} if $param->{dest_config_path};
 
@@ -470,6 +473,7 @@ sub format_job {
     $text .= " --source-user $job->{source_user}";
     $text .= " --dest-user $job->{dest_user}";
     $text .= " --prepend-storage-id" if $job->{prepend_storage_id};
+    $text .= " --compressed" if $job->{compressed};
     $text .= " --properties" if $job->{properties};
     $text .= " --dest-config-path $job->{dest_config_path}" if $job->{dest_config_path};
     $text .= "\n";
@@ -1028,6 +1032,8 @@ sub send_image {
 
     push @$cmd, 'ssh', '-o', 'BatchMode=yes', "$param->{source_user}\@$source->{ip}", '--' if $source->{ip};
     push @$cmd, 'zfs', 'send';
+    push @$cmd, '-L', if $param->{compressed}; # no effect if dataset never had large recordsize
+    push @$cmd, '-c', if $param->{compressed};
     push @$cmd, '-p', if $param->{properties};
     push @$cmd, '-v' if $param->{verbose};
 
@@ -1190,6 +1196,11 @@ $PROGNAME create --dest <string> --source <string> [OPTIONS]
 	--source-user    string
 		The (ssh) user-name on the source target, root by default
 
+	--compressed
+		If specified, send data without decompressing first. If features lz4_compress,
+		zstd_compress or large_blocks are in use by the source, they need to be enabled on
+		the target as well.
+
 	--properties
 		If specified, include the dataset's properties in the stream.
 
@@ -1234,6 +1245,11 @@ $PROGNAME sync --dest <string> --source <string> [OPTIONS]\n
 	--verbose
 		If specified, print out the sync progress.
 
+	--compressed
+		If specified, send data without decompressing first. If features lz4_compress,
+		zstd_compress or large_blocks are in use by the source, they need to be enabled on
+		the target as well.
+
 	--properties
 		If specified, include the dataset's properties in the stream.
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH pve-zsync] close #1824: add 'compressed' option enabling -c and -L for send
  2022-05-10 11:19 [pve-devel] [PATCH pve-zsync] close #1824: add 'compressed' option enabling -c and -L for send Fabian Ebner
@ 2022-05-12 15:16 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-05-12 15:16 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Ebner

Am 5/10/22 um 13:19 schrieb Fabian Ebner:
> If one of the features lz4_compress, zstd_compress or large_blocks is
> actively used/required by the source dataset, but not enabled on the
> destination, zfs send/recv will fail and recommend upgrading the pool.
> 
> It's not required that the target dataset is also compressed.
> Specifying '--properties' to have the target inherit the compression
> property even works during later syncs (but pre-existing data won't be
> recompressed automatically then).
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> Put it near 'properties' as I felt like that was the most similar one.
> 
>  pve-zsync | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-12 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 11:19 [pve-devel] [PATCH pve-zsync] close #1824: add 'compressed' option enabling -c and -L for send Fabian Ebner
2022-05-12 15:16 ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal