* [pve-devel] [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types
@ 2023-06-07 9:39 Friedrich Weber
2023-06-07 12:08 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Friedrich Weber @ 2023-06-07 9:39 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types
2023-06-07 9:39 [pve-devel] [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types Friedrich Weber
@ 2023-06-07 12:08 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-06-07 12:08 UTC (permalink / raw)
To: Proxmox VE development discussion, Friedrich Weber
Am 07/06/2023 um 11:39 schrieb Friedrich Weber:
> 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(+)
>
>
applied, but also added a general pass/fail message if any storage is affected, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-07 12:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 9:39 [pve-devel] [PATCH manager] pve7to8: warn if storage uses a directory for multiple content types Friedrich Weber
2023-06-07 12:08 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox