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.k...@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to