[pve-devel] [PATCH guest-common] replication: avoid "expected snapshot missing warning" when irrelevant

Fiona Ebner f.ebner at proxmox.com
Thu Sep 22 13:00:23 CEST 2022


Namely, when there are no snapshots at all on the volume, which also
is the case when the volume doesn't exist. This happens when a fresh
volume is added to an already replicated guest.

Fixes replication tests in pve-manager, which didn't like the additional
output.

Fixes: c0b2948 ("replication: prepare: safeguard against removal if expected snapshot is missing")
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/Replication.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm
index 8591d0e..680ffe1 100644
--- a/src/PVE/Replication.pm
+++ b/src/PVE/Replication.pm
@@ -178,7 +178,7 @@ sub prepare {
 	$removal_ok = 0 if $last_sync == 0; # last_sync=0 if the VM was stolen, don't remove!
 	$removal_ok = 1 if $last_sync == 1; # last_sync=1 is a special value used to remove all
 	$logfunc->("expected snapshot $snapname not present for $volid, not removing others")
-	    if !$removal_ok && $last_sync > 1;
+	    if !$removal_ok && $last_sync > 1 && scalar(keys $info->%*) > 0;
 
 	for my $snap (keys $info->%*) {
 	    if ( # check if it's a stale replication snapshot
-- 
2.30.2






More information about the pve-devel mailing list