[pve-devel] [RFC 2/2 pve-container] call map_volume before using volumes.

Dietmar Maurer dietmar at proxmox.com
Fri Sep 21 07:58:30 CEST 2018


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 0b57ae9..448ea34 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1302,12 +1302,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);
@@ -1414,7 +1411,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);
@@ -1467,7 +1466,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