From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH guest-common 1/2] replication: prepare: include volumes without snapshots in the result
Date: Fri, 20 Jan 2023 11:18:01 +0100 [thread overview]
Message-ID: <20230120101802.92746-1-f.ebner@proxmox.com> (raw)
Note that PVE::Storage::volume_snapshot_info() will fail when a volume
does not exist, so no non-existing volume will end up in the result
(prepare() is only called with volumes that should exist).
This makes it possible to detect a volume without snapshots in the
result of prepare(), and as a consequence, replication will now also
fail early in a situation where source and remote volume both exist,
but (at least) one of them doesn't have any snapshots.
Such a situation can happen, for example, by deleting and re-creating
a volume with the same name on the source side without running
replication after deletion.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/Replication.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm
index 469ca19..f9d454d 100644
--- a/src/PVE/Replication.pm
+++ b/src/PVE/Replication.pm
@@ -172,6 +172,8 @@ sub prepare {
my $local_snapshots = {};
my $cleaned_replicated_volumes = {};
foreach my $volid (@$volids) {
+ $local_snapshots->{$volid} = {};
+
my $info = PVE::Storage::volume_snapshot_info($storecfg, $volid);
my $removal_ok = !defined($snapname) || $info->{$snapname};
--
2.30.2
next reply other threads:[~2023-01-20 10:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 10:18 Fiona Ebner [this message]
2023-01-20 10:18 ` [pve-devel] [PATCH guest-common 2/2] replication: find common base: improve error when no common base snapshot exists 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=20230120101802.92746-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