[pve-devel] [PATCH container v2 11/11] mount: raw/iso: use volume content type assertion helpers

Daniel Kral d.kral at proxmox.com
Tue Feb 11 17:08:25 CET 2025


Make use of the newly introduced content type assertion helpers at
verifying the content type when mounting mountpoints, which have the
format "raw" or "iso".

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
changes since v1:
- new!

 src/PVE/LXC.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 1631f82..9cbe8b2 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1965,17 +1965,17 @@ sub __mountpoint_mount {
 		}
 	    };
 	    my $use_loopdev = 0;
-	    if ($scfg->{content}->{rootdir}) {
-		if ($scfg->{path}) {
-		    $mounted_dev = run_with_loopdev($domount, $path, $readonly);
-		    $use_loopdev = 1;
-		} else {
-		    $mounted_dev = $path;
-		    &$domount($path);
-		}
+
+	    PVE::Storage::assert_content_type_supported($storage_cfg, $storage, 'rootdir');
+
+	    if ($scfg->{path}) {
+		$mounted_dev = run_with_loopdev($domount, $path, $readonly);
+		$use_loopdev = 1;
 	    } else {
-		die "storage '$storage' does not support containers\n";
+		$mounted_dev = $path;
+		&$domount($path);
 	    }
+
 	    return wantarray ? ($path, $use_loopdev, $mounted_dev) : $path;
 	} else {
 	    die "unsupported image format '$format'\n";
-- 
2.39.5





More information about the pve-devel mailing list