From b521247bf496ccebbc25139b858da97299affd24 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 6 Jun 2016 15:44:45 +0200 Subject: [PATCH] fix 1012: dir: add mkdir option By default a directory storage creates its path. In some cases this can be undesired, mostly when storages have nested paths (eg. a dir storage on a ZFS path or in an NFS share, or inside custom mount points). As a simple fix to this the 'mkdir' option (default ON) can now be used to disable this behavior. --- PVE/Storage/DirPlugin.pm | 12 ++++++++++-- changelog.Debian | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/PVE/Storage/DirPlugin.pm b/PVE/Storage/DirPlugin.pm index bc3c61f..23cb6bb 100644 --- a/PVE/Storage/DirPlugin.pm +++ b/PVE/Storage/DirPlugin.pm @@ -28,6 +28,11 @@ sub properties { description => "File system path.", type => 'string', format => 'pve-storage-path', }, + mkdir => { + description => "Create the directory if it doesn't exist.", + type => 'boolean', + default => 'yes', + }, }; } @@ -40,6 +45,7 @@ sub options { maxfiles => { optional => 1 }, content => { optional => 1 }, format => { optional => 1 }, + mkdir => { optional => 1 }, }; } @@ -48,8 +54,10 @@ sub options { sub activate_storage { my ($class, $storeid, $scfg, $cache) = @_; - my $path = $scfg->{path}; - mkpath $path; + if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) { + my $path = $scfg->{path}; + mkpath $path; + } $class->SUPER::activate_storage($storeid, $scfg, $cache); } diff --git a/changelog.Debian b/changelog.Debian index 624f984..ecbd11b 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -4,6 +4,8 @@ libpve-storage-perl (4.0-52) unstable; urgency=medium * add ceph version helpers + * fix 1012: dir: add mkdir option + -- Proxmox Support Team Tue, 07 Jun 2016 10:30:02 +0200 libpve-storage-perl (4.0-51) unstable; urgency=medium