From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] fix 3214: storage dir structure creation with mkdir 0
Date: Tue, 22 Dec 2020 11:53:40 +0100 [thread overview]
Message-ID: <20201222105340.23286-1-a.lauterer@proxmox.com> (raw)
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
next reply other threads:[~2020-12-22 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-22 10:53 Aaron Lauterer [this message]
2020-12-22 12:57 ` Wolfgang Bumiller
2020-12-22 13:25 ` Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201222105340.23286-1-a.lauterer@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox