[pve-devel] [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types
Friedrich Weber
f.weber at proxmox.com
Wed Jun 7 11:39:13 CEST 2023
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 at 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
More information about the pve-devel
mailing list