]> git.proxmox.com Git - pve-manager.git/commitdiff
pve7to8: content-dirs check: skip paths that cannot be resolved
authorFriedrich Weber <f.weber@proxmox.com>
Thu, 15 Jun 2023 13:22:31 +0000 (15:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 15 Jun 2023 14:46:59 +0000 (16:46 +0200)
The current inequality check for content-dirs does not correctly
handle the case in which `abs_path` returns undef. This can result in
confusing warnings:

  storage [...] uses directory  for multiple content types [...]

Fix this by skipping paths for which `abs_path` returns undef. This
matches the behavior of the actual content-dirs check in PVE 8 [0].

[0]: https://git.proxmox.com/?p=pve-storage.git;a=commit;h=09f1f847a

Fixes: ea0a4f1943ffafe94282afc800d5720db45df198
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
PVE/CLI/pve7to8.pm

index 524b0617c2a41f775eb9577361b68a926f53847e..73ea85b0b7aa6a3955f42e49c7fdeb0fd5a90493 100644 (file)
@@ -997,6 +997,7 @@ sub check_storage_content_dirs {
        my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
        for my $vtype (keys $scfg->{content}->%*) {
            my $abs_subdir = Cwd::abs_path($plugin->get_subdir($scfg, $vtype));
+           next if !defined($abs_subdir);
            push $resolved_subdirs->{$abs_subdir}->@*, $vtype;
        }
        for my $subdir (keys $resolved_subdirs->%*) {