From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id BEFB51FF16F for <inbox@lore.proxmox.com>; Tue, 15 Apr 2025 15:59:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ECF19A18C; Tue, 15 Apr 2025 15:59:35 +0200 (CEST) From: Daniel Kral <d.kral@proxmox.com> To: pve-devel@lists.proxmox.com Date: Tue, 15 Apr 2025 15:50:45 +0200 Message-Id: <20250415135045.255272-28-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250415135045.255272-1-d.kral@proxmox.com> References: <20250415135045.255272-1-d.kral@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.013 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH container v3 11/11] mount: raw/iso: use volume content type assertion helpers X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> 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@proxmox.com> --- changes since v2: * rename helper from *_supported to *_available I already pointed that out in a response to a v2 patch, but this already existing check in __mountpoint_mount will make it impossible AFAICS for users to move out of the error state of a root disk / mountpoint being on a storage that doesn't support the content type 'rootdir'. But this would be a follow-up if we want to change it. Also there is no check for subvols made here, i.e. container root disks / mountpoints on a ZFS pool can be started fine, while ones on e.g. directory storages cannot (because they are 'raw'). And on another note: The error message from this is rather cryptic for an end user and is only a little bit clarified in the output of `pct start ... --debug`, but else the user must guess: run_buffer: 571 Script exited with status 25 lxc_init: 845 Failed to run lxc.hook.pre-start for container "101" __lxc_start: 2034 Failed to initialize container "101" TASK ERROR: startup for container '101' failed I skipped adding a patch for this now, as it's out of scope of this already long patch series. 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 799aa9a..0beb49c 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -1978,17 +1978,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_available($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