From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH zsync 6/6] fix #3351: allow keeping a different number of snapshots on source and destination
Date: Tue, 11 May 2021 14:59:55 +0200 [thread overview]
Message-ID: <20210511125955.25105-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210511125955.25105-1-f.ebner@proxmox.com>
by introducing a new dest-maxsnap parameter which can be used to override
maxsnap for the destination side.
This is useful for backups, as one can potentially save a lot of space on the
source side (or the destination side if one can come up with a use case for
that) by keeping fewer snapshots around.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
pve-zsync | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/pve-zsync b/pve-zsync
index 1213361..39ead0d 100755
--- a/pve-zsync
+++ b/pve-zsync
@@ -244,6 +244,7 @@ sub parse_argv {
verbose => undef,
limit => undef,
maxsnap => undef,
+ dest_maxsnap => undef,
name => undef,
skip => undef,
method => undef,
@@ -261,6 +262,7 @@ sub parse_argv {
'verbose' => \$param->{verbose},
'limit=i' => \$param->{limit},
'maxsnap=i' => \$param->{maxsnap},
+ 'dest-maxsnap=i' => \$param->{dest_maxsnap},
'name=s' => \$param->{name},
'skip' => \$param->{skip},
'method=s' => \$param->{method},
@@ -336,6 +338,7 @@ sub param_to_job {
$job->{method} = "ssh" if !$job->{method};
$job->{limit} = $param->{limit};
$job->{maxsnap} = $param->{maxsnap};
+ $job->{dest_maxsnap} = $param->{dest_maxsnap};
$job->{source} = $param->{source};
$job->{source_user} = $param->{source_user};
$job->{dest_user} = $param->{dest_user};
@@ -460,6 +463,7 @@ sub format_job {
$text .= " root";
$text .= " $PROGNAME sync --source $job->{source} --dest $job->{dest}";
$text .= " --name $job->{name} --maxsnap $job->{maxsnap}";
+ $text .= " --dest-maxsnap $job->{dest_maxsnap}" if defined($job->{dest_maxsnap});
$text .= " --limit $job->{limit}" if $job->{limit};
$text .= " --method $job->{method}";
$text .= " --verbose" if $job->{verbose};
@@ -681,20 +685,31 @@ sub sync {
($dest->{old_snap}, $dest->{last_snap}) = snapshot_get(
$dest_dataset,
- $param->{maxsnap},
+ $param->{dest_maxsnap} // $param->{maxsnap},
$param->{name},
$dest->{ip},
$param->{dest_user},
);
+ ($source->{old_snap}) = snapshot_get(
+ $source->{all},
+ $param->{maxsnap},
+ $param->{name},
+ $source->{ip},
+ $param->{source_user},
+ );
+
prepare_prepended_target($source, $dest, $param->{dest_user}) if defined($dest->{prepend});
snapshot_add($source, $dest, $param->{name}, $date, $param->{source_user}, $param->{dest_user});
send_image($source, $dest, $param);
- for my $old_snap (@{$dest->{old_snap}}) {
+ for my $old_snap (@{$source->{old_snap}}) {
snapshot_destroy($source->{all}, $old_snap, $source->{ip}, $param->{source_user});
+ }
+
+ for my $old_snap (@{$dest->{old_snap}}) {
snapshot_destroy($dest_dataset, $old_snap, $dest->{ip}, $param->{dest_user});
}
};
@@ -1157,6 +1172,9 @@ $PROGNAME create --dest <string> --source <string> [OPTIONS]
The number of snapshots to keep until older ones are erased.
The default is 1, use 0 for unlimited.
+ --dest-maxsnap integer
+ Override maxsnap for the destination dataset.
+
--name string
The name of the sync job, if not set it is default
@@ -1197,6 +1215,9 @@ $PROGNAME sync --dest <string> --source <string> [OPTIONS]\n
The number of snapshots to keep until older ones are erased.
The default is 1, use 0 for unlimited.
+ --dest-maxsnap integer
+ Override maxsnap for the destination dataset.
+
--name string
The name of the sync job, if not set it is 'default'.
It is only necessary if scheduler allready contains this source.
--
2.20.1
next prev parent reply other threads:[~2021-05-11 13:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 12:59 [pve-devel] [PATCH-SERIES zsync] " Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 1/6] param_to_job: handle --maxsnap 0 on creation Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 2/6] usage: improve maxsnap description Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 3/6] remove all old snapshots belonging to a job Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 4/6] snapshot_get: make interface agnostic to source/dest Fabian Ebner
2021-05-11 12:59 ` [pve-devel] [PATCH zsync 5/6] snapshot_destroy: " Fabian Ebner
2021-05-11 12:59 ` Fabian Ebner [this message]
2021-05-24 16:00 ` [pve-devel] [PATCH zsync 6/6] fix #3351: allow keeping a different number of snapshots on source and destination Bruce Wainer
2021-05-25 5:10 ` Thomas Lamprecht
2021-05-25 12:02 ` [pve-devel] applied-series: [PATCH-SERIES zsync] " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210511125955.25105-7-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox