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 guest-common] replication: avoid "expected snapshot missing warning" when irrelevant
Date: Thu, 22 Sep 2022 13:00:23 +0200	[thread overview]
Message-ID: <20220922110023.115994-1-f.ebner@proxmox.com> (raw)

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@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





             reply	other threads:[~2022-09-22 11:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 11:00 Fiona Ebner [this message]
2022-09-22 11:13 ` Fiona Ebner

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=20220922110023.115994-1-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