From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 guest-common 2/4] replication: rename last_snapshots to local_snapshots
Date: Mon, 13 Jun 2022 12:29:57 +0200 [thread overview]
Message-ID: <20220613102959.36556-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20220613102959.36556-1-f.ebner@proxmox.com>
because prepare() was changed in 8d1cd44 ("partially fix #3111:
replication: be less picky when selecting incremental base") to return
all local snapshots.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
New in v2.
src/PVE/Replication.pm | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm
index fcd59bb..d84f469 100644
--- a/src/PVE/Replication.pm
+++ b/src/PVE/Replication.pm
@@ -36,10 +36,7 @@ sub find_common_replication_snapshot {
my $last_sync_snapname =
PVE::ReplicationState::replication_snapshot_name($jobid, $last_sync);
- # test if we have a replication_ snapshot from last sync
- # and remove all other/stale replication snapshots
-
- my $last_snapshots =
+ my $local_snapshots =
prepare($storecfg, $volumes, $jobid, $last_sync, $parent_snapname, $logfunc);
# prepare remote side
@@ -58,7 +55,7 @@ sub find_common_replication_snapshot {
my $base_snapshots = {};
foreach my $volid (@$volumes) {
- my $local_info = $last_snapshots->{$volid};
+ my $local_info = $local_snapshots->{$volid};
my $remote_info = $remote_snapshots->{$volid};
if (defined($local_info) && defined($remote_info)) {
@@ -103,7 +100,7 @@ sub find_common_replication_snapshot {
}
}
- return ($base_snapshots, $last_snapshots, $last_sync_snapname);
+ return ($base_snapshots, $local_snapshots, $last_sync_snapname);
}
sub remote_prepare_local_job {
@@ -172,7 +169,7 @@ sub prepare {
$prefix = '__replicate_';
}
- my $last_snapshots = {};
+ my $local_snapshots = {};
my $cleaned_replicated_volumes = {};
foreach my $volid (@$volids) {
my $info = PVE::Storage::volume_snapshot_info($storecfg, $volid);
@@ -200,12 +197,12 @@ sub prepare {
$logfunc->("delete stale replication snapshot error: $err");
}
} else {
- $last_snapshots->{$volid}->{$snap} = $info->{$snap};
+ $local_snapshots->{$volid}->{$snap} = $info->{$snap};
}
}
}
- return wantarray ? ($last_snapshots, $cleaned_replicated_volumes) : $last_snapshots;
+ return wantarray ? ($local_snapshots, $cleaned_replicated_volumes) : $local_snapshots;
}
sub replicate_volume {
@@ -291,7 +288,7 @@ sub replicate {
my $ssh_info = PVE::SSHInfo::get_ssh_info($jobcfg->{target}, $migration_network);
- my ($base_snapshots, $last_snapshots, $last_sync_snapname) = find_common_replication_snapshot(
+ my ($base_snapshots, $local_snapshots, $last_sync_snapname) = find_common_replication_snapshot(
$ssh_info, $jobid, $vmid, $storecfg, $sorted_volids, $state->{storeid_list}, $last_sync, $conf, $logfunc);
my $storeid_hash = {};
@@ -373,7 +370,7 @@ sub replicate {
PVE::ReplicationState::record_sync_end($jobcfg, $state, $start_time);
# remove old snapshots because they are no longer needed
- $cleanup_local_snapshots->($last_snapshots, $last_sync_snapname);
+ $cleanup_local_snapshots->($local_snapshots, $last_sync_snapname);
eval {
remote_finalize_local_job($ssh_info, $jobid, $vmid, $sorted_volids, $start_time, $logfunc);
--
2.30.2
next prev parent reply other threads:[~2022-06-13 10:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 10:29 [pve-devel] [PATCH-SERIES v2 manager/guest-common] replication: improve removal of stale snapshots/volumes Fabian Ebner
2022-06-13 10:29 ` [pve-devel] [PATCH v2 manager 1/2] pvesr: rename last_snapshots to local_snapshots Fabian Ebner
2022-06-13 10:29 ` [pve-devel] [PATCH v2 manager 2/2] pvesr: prepare local job: remove stale replicated volumes immediately Fabian Ebner
2022-06-13 10:29 ` [pve-devel] [PATCH v2 guest-common 1/4] replication: prepare: adapt/expand function comment Fabian Ebner
2022-06-13 10:29 ` Fabian Ebner [this message]
2022-06-13 10:29 ` [pve-devel] [PATCH v2 guest-common 3/4] replication: also consider storages from replication state upon removal Fabian Ebner
2022-06-13 10:29 ` [pve-devel] [RFC v2 guest-common 4/4] replication: prepare: safeguard against removal if expected snapshot is missing Fabian Ebner
2022-07-27 11:22 ` [pve-devel] [PATCH-SERIES v2 manager/guest-common] replication: improve removal of stale snapshots/volumes Fiona Ebner
2022-08-02 9:08 ` [pve-devel] applied-series: " Fabian Grünbichler
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=20220613102959.36556-5-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