public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] fix 3214: storage dir structure creation with mkdir 0
@ 2020-12-22 10:53 Aaron Lauterer
  2020-12-22 12:57 ` Wolfgang Bumiller
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lauterer @ 2020-12-22 10:53 UTC (permalink / raw)
  To: pve-devel

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@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-22 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 10:53 [pve-devel] [PATCH storage] fix 3214: storage dir structure creation with mkdir 0 Aaron Lauterer
2020-12-22 12:57 ` Wolfgang Bumiller
2020-12-22 13:25   ` Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal