[pve-devel] [PATCH storage] fix 3214: storage dir structure creation with mkdir 0

Aaron Lauterer a.lauterer at proxmox.com
Tue Dec 22 11:53:40 CET 2020


We fail early when `mkdir 0` is set for the storage to avoid creating
the directories in the storage path.

This means that once `mkdir 0` is set, the code to create the needed
directory structure (e.g. dump, image, ...) at the storage location will
never run.

Adding an additional check to only return early if the storage path
currently does not exist solves the problem.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 PVE/Storage/Plugin.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 57c58a9..bda1beb 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -1158,8 +1158,8 @@ sub activate_storage {
 	"directory '$path' does not exist or is unreachable\n";
     }
 
-
-    return if defined($scfg->{mkdir}) && !$scfg->{mkdir};
+    my $st = File::stat::stat($path);
+    return if defined($scfg->{mkdir}) && !$scfg->{mkdir} && !defined($st);
 
     if (defined($scfg->{content})) {
 	foreach my $vtype (keys %$vtype_subdirs) {
-- 
2.20.1






More information about the pve-devel mailing list