public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 guest-common 2/3] replication: find common base: improve error when no common base snapshot exists
Date: Wed, 13 Dec 2023 15:17:46 +0100	[thread overview]
Message-ID: <20231213141747.679613-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20231213141747.679613-1-f.ebner@proxmox.com>

Suggest an alternative solution by removing the problematic volumes
from the replication target rather than the whole job.

This is helpful if there are multiple replicated volumes to avoid the
need to fully re-sync all volumes in many cases.

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

No changes in v2.

 src/PVE/Replication.pm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm
index 05c2632..984ea34 100644
--- a/src/PVE/Replication.pm
+++ b/src/PVE/Replication.pm
@@ -53,6 +53,7 @@ sub find_common_replication_snapshot {
     );
 
     my $base_snapshots = {};
+    my @missing_snapshots = ();
 
     foreach my $volid (@$volumes) {
 	my $local_info = $local_snapshots->{$volid};
@@ -91,15 +92,19 @@ sub find_common_replication_snapshot {
 		    next;
 		}
 
-		# The volume exists on the remote side, so trying a full sync won't work.
-		# Die early with a clean error.
-		die "No common base to restore the job state\n".
-		    "please delete jobid: $jobid and create the job again\n"
-		    if !defined($base_snapshots->{$volid});
+		push @missing_snapshots, $volid if !defined($base_snapshots->{$volid});
 	    }
 	}
     }
 
+    if (scalar(@missing_snapshots) > 0) {
+	# There exist volumes without common base snapshot on the remote side.
+	# Trying to (do a full) sync won't work, so die early with a clean error.
+	my $volume_string = join(',', @missing_snapshots);
+	die "No common base snapshot on volume(s) $volume_string\nPlease remove the problematic " .
+	    "volume(s) from the replication target or delete and re-create the whole job $jobid\n";
+    }
+
     return ($base_snapshots, $local_snapshots, $last_sync_snapname);
 }
 
-- 
2.39.2





  parent reply	other threads:[~2023-12-13 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 14:17 [pve-devel] [PATCH-SERIES v2 guest-common] replication improvements Fiona Ebner
2023-12-13 14:17 ` [pve-devel] [PATCH v2 guest-common 1/3] replication: prepare: include volumes without snapshots in the result Fiona Ebner
2023-12-13 14:17 ` Fiona Ebner [this message]
2023-12-13 14:17 ` [pve-devel] [PATCH v2 guest-common 3/3] abstract config: fix snapshot needed by replication check Fiona Ebner
2024-04-11 11:58 ` [pve-devel] [PATCH-SERIES v2 guest-common] replication improvements Fiona Ebner
2024-04-11 16:18 ` [pve-devel] applied-series: " 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=20231213141747.679613-3-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal