[pve-devel] [PATCH v2 guest-common 1/3] replication: prepare: include volumes without snapshots in the result
Fiona Ebner
f.ebner at proxmox.com
Wed Dec 13 15:17:45 CET 2023
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 at proxmox.com>
---
No changes in v2.
src/PVE/Replication.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/PVE/Replication.pm b/src/PVE/Replication.pm
index bd627e5..05c2632 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.39.2
More information about the pve-devel
mailing list