From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0F4E39EB09 for ; Wed, 7 Jun 2023 11:40:30 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E5DA43F020 for ; Wed, 7 Jun 2023 11:39:59 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 7 Jun 2023 11:39:59 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2E35541DEA for ; Wed, 7 Jun 2023 11:39:59 +0200 (CEST) From: Friedrich Weber To: pve-devel@lists.proxmox.com Date: Wed, 7 Jun 2023 11:39:13 +0200 Message-Id: <20230607093913.110474-1-f.weber@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.369 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jun 2023 09:40:30 -0000 Using a directory for multiple content types will throw an error in PVE 8 (see 5f4b5bd1 in pve-storage). Hence, detect this in pve7to8 for active storages and warn if needed. Signed-off-by: Friedrich Weber --- PVE/CLI/pve7to8.pm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/PVE/CLI/pve7to8.pm b/PVE/CLI/pve7to8.pm index b01ce19f..9110dbc7 100644 --- a/PVE/CLI/pve7to8.pm +++ b/PVE/CLI/pve7to8.pm @@ -3,6 +3,8 @@ package PVE::CLI::pve7to8; use strict; use warnings; +use Cwd; + use PVE::API2::APT; use PVE::API2::Ceph; use PVE::API2::LXC; @@ -263,6 +265,10 @@ sub check_storage_health { } check_storage_content(); + eval { + check_storage_content_dirs(); + }; + log_fail("failed to check storage content directories - $@") if $@; } sub check_cluster_corosync { @@ -948,6 +954,39 @@ sub check_storage_content { } } +sub check_storage_content_dirs { + my $storage_cfg = PVE::Storage::config(); + + # check that content dirs are pairwise inequal + for my $storeid (sort keys $storage_cfg->{ids}->%*) { + my $scfg = $storage_cfg->{ids}->{$storeid}; + + next if !PVE::Storage::storage_check_enabled($storage_cfg, $storeid, undef, 1); + next if !$scfg->{path}; + next if !$scfg->{content}; + + eval { PVE::Storage::activate_storage($storage_cfg, $storeid) }; + if (my $err = $@) { + log_warn("activating '$storeid' failed - $err"); + next; + } + + my $resolved_subdirs = {}; + my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); + foreach my $vtype (keys $scfg->{content}->%*) { + my $abs_subdir = Cwd::abs_path($plugin->get_subdir($scfg, $vtype)); + push $resolved_subdirs->{$abs_subdir}->@*, $vtype; + } + foreach my $subdir (keys $resolved_subdirs->%*) { + if (scalar($resolved_subdirs->{$subdir}->@*) > 1) { + log_warn("storage '$storeid' uses directory $subdir for multiple content types" + . " (" . join(", ", $resolved_subdirs->{$subdir}->@*) . "). " + . "This is no longer supported in PVE 8.x!"); + } + } + } +} + sub check_containers_cgroup_compat { if ($forced_legacy_cgroup) { log_warn("System explicitly configured for legacy hybrid cgroup hierarchy.\n" -- 2.39.2