all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types
Date: Wed,  7 Jun 2023 11:39:13 +0200	[thread overview]
Message-ID: <20230607093913.110474-1-f.weber@proxmox.com> (raw)

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 <f.weber@proxmox.com>
---
 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





             reply	other threads:[~2023-06-07  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  9:39 Friedrich Weber [this message]
2023-06-07 12:08 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230607093913.110474-1-f.weber@proxmox.com \
    --to=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal