[pve-devel] [PATCH container 1/1] call map_volume before using volumes.

Alwin Antreich a.antreich at proxmox.com
Thu Nov 8 14:05:16 CET 2018


From: Dietmar Maurer <dietmar at proxmox.com>

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/LXC.pm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 0f2aa5c..3a438ac 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1402,12 +1402,9 @@ sub mountpoint_mount {
 
 	my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
 
-	# early sanity checks:
-	# we otherwise call realpath on the rbd url
-	die "containers on rbd storage without krbd are not supported\n"
-	    if $scfg->{type} eq 'rbd' && !$scfg->{krbd};
+	my $path = PVE::Storage::map_volume($storage_cfg, $volid, $snapname);
 
-	my $path = PVE::Storage::path($storage_cfg, $volid, $snapname);
+	$path = PVE::Storage::path($storage_cfg, $volid, $snapname) if !defined($path);
 
 	my ($vtype, undef, undef, undef, undef, $isBase, $format) =
 	    PVE::Storage::parse_volname($storage_cfg, $volid);
@@ -1514,7 +1511,9 @@ sub format_disk {
 
     PVE::Storage::activate_volumes($storage_cfg, [$volid]);
 
-    my $path = PVE::Storage::path($storage_cfg, $volid);
+    my $path = PVE::Storage::map_volume($storage_cfg, $volid);
+
+    $path = PVE::Storage::path($storage_cfg, $volid) if !defined($path);
 
     my ($vtype, undef, undef, undef, undef, $isBase, $format) =
 	PVE::Storage::parse_volname($storage_cfg, $volid);
@@ -1567,7 +1566,6 @@ sub alloc_disk {
 
 	} elsif ($scfg->{type} eq 'rbd') {
 
-	    die "krbd option must be enabled on storage type '$scfg->{type}'\n" if !$scfg->{krbd};
 	    $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw', undef, $size_kb);
 	    $do_format = 1;
 	} else {
-- 
2.11.0





More information about the pve-devel mailing list