[pve-devel] [PATCH pve-container 2/4] reuse existing loop bindings

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Nov 20 14:04:27 CET 2015


This allows starting a container while its raw images are
already loop-mounted. By reusing the same loop device we
don't run into the MMProtection.
---
 src/PVE/LXC.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 52f1077..3c23948 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2170,8 +2170,12 @@ sub mountpoint_mount {
 	    my $use_loopdev = 0;
 	    my @extra_opts;
 	    if ($scfg->{path}) {
-		push @extra_opts, '-o', 'loop';
 		$use_loopdev = 1;
+		if (my $loop = query_loopdev($path)) {
+		    $path = $loop;
+		} else {
+		    push @extra_opts, '-o', 'loop';
+		}
 	    } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'lvm' || $scfg->{type} eq 'rbd') {
 		# do nothing
 	    } else {
-- 
2.1.4





More information about the pve-devel mailing list