[pve-devel] [PATCH container] fix #1851: check 'replicate' flag for non-volume mountpoints

Dominik Csapak d.csapak at proxmox.com
Tue Jul 31 13:43:14 CEST 2018


setting replicate=0 for a bind mount only makes sense if we
really skip it for replication

also cleanup for them is not necessary, as bind mounts
could not have ever been replicated, thus there should
not be anything to clean up

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/LXC/Config.pm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index e7548ff..23586fb 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1320,11 +1320,18 @@ sub get_replicatable_volumes {
     my $test_volid = sub {
 	my ($volid, $mountpoint) = @_;
 
+	my $replicate = $mountpoint->{replicate} // 1;
+
 	return if !$volid;
 
 	my $mptype = $mountpoint->{type};
-	die "unable to replicate mountpoint type '$mptype'\n"
-	    if $mptype ne 'volume';
+
+	if ($mptype ne 'volume') {
+	    # skip bindmounts if replicate = 0 even for cleanup,
+	    # since bind mounts could not have been replicated ever
+	    return if !$replicate;
+	    die "unable to replicate mountpoint type '$mptype'\n"
+	}
 
 	my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr);
 	return if !$storeid;
@@ -1337,7 +1344,7 @@ sub get_replicatable_volumes {
 
 	die "unable to replicate volume '$volid', type '$vtype'\n" if $vtype ne 'images';
 
-	return if !$cleanup && defined($mountpoint->{replicate}) && !$mountpoint->{replicate};
+	return if !$cleanup && !$replicate;
 
 	if (!PVE::Storage::volume_has_feature($storecfg, 'replicate', $volid)) {
 	    return if $cleanup || $noerr;
-- 
2.11.0





More information about the pve-devel mailing list