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.
This commit is contained in:
Wolfgang Bumiller
2016-06-06 15:44:45 +02:00
committed by Dietmar Maurer
parent 0be02e0f21
commit b521247bf4
2 changed files with 12 additions and 2 deletions

View File

@ -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);
}

View File

@ -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 <support@proxmox.com> Tue, 07 Jun 2016 10:30:02 +0200
libpve-storage-perl (4.0-51) unstable; urgency=medium