So far this only prevented the creation of the toplevel
directory. This does not cover all problem cases,
particularly when said directory is supposed to be a mount
point, including NFS and glusterfs beside ZFS.
The directory based storages we have already use mkpath
whenever they need to create files, and for actions on files
which are supposed to exist it's fine if it errors out.
So it should also be safe to skip the creation of standard
subdirectories in activate_storage().
Additionally NFS and glusterfs storages should also accept
the mkdir option as they otherwise may exhibit similar
issues, eg. when an NFS storage is mounted onto a directory
inside a ZFS subvolume.
maxfiles => { optional => 1 },
content => { optional => 1 },
format => { optional => 1 },
maxfiles => { optional => 1 },
content => { optional => 1 },
format => { optional => 1 },
+ mkdir => { optional => 1 },
if (!glusterfs_is_mounted($volume, $path, $cache->{mountdata})) {
if (!glusterfs_is_mounted($volume, $path, $cache->{mountdata})) {
+ mkpath $path if !(defined($scfg->{mkdir}) && !$scfg->{mkdir});
die "unable to activate storage '$storeid' - " .
"directory '$path' does not exist\n" if ! -d $path;
die "unable to activate storage '$storeid' - " .
"directory '$path' does not exist\n" if ! -d $path;
options => { optional => 1 },
content => { optional => 1 },
format => { optional => 1 },
options => { optional => 1 },
content => { optional => 1 },
format => { optional => 1 },
+ mkdir => { optional => 1 },
# NOTE: only call mkpath when not mounted (avoid hang
# when NFS server is offline
# NOTE: only call mkpath when not mounted (avoid hang
# when NFS server is offline
+ mkpath $path if !(defined($scfg->{mkdir}) && !$scfg->{mkdir});
die "unable to activate storage '$storeid' - " .
"directory '$path' does not exist\n" if ! -d $path;
die "unable to activate storage '$storeid' - " .
"directory '$path' does not exist\n" if ! -d $path;
die "unable to activate storage '$storeid' - " .
"directory '$path' does not exist\n" if ! -d $path;
die "unable to activate storage '$storeid' - " .
"directory '$path' does not exist\n" if ! -d $path;
+ return if defined($scfg->{mkdir}) && !$scfg->{mkdir};
+
if (defined($scfg->{content})) {
foreach my $vtype (keys %$vtype_subdirs) {
# OpenVZMigrate uses backup (dump) dir
if (defined($scfg->{content})) {
foreach my $vtype (keys %$vtype_subdirs) {
# OpenVZMigrate uses backup (dump) dir